Bug 92020 - wglCreatePbufferARB handle attrib error
Summary: wglCreatePbufferARB handle attrib error
Status: ASSIGNED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 11.0
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-16 10:27 UTC by zeif
Modified: 2015-10-09 12:21 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zeif 2015-09-16 10:27:56 UTC
HPBUFFERARB WINAPI
wglCreatePbufferARB(HDC hCurrentDC,
                    int iPixelFormat,
                    int iWidth,
                    int iHeight,
                    const int *piAttribList)
{
//......

   for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
      switch (*piAttrib) {
      case WGL_PBUFFER_LARGEST_ARB:
         piAttrib++;
         useLargest = *piAttrib;
         break;
      default:
         SetLastError(ERROR_INVALID_DATA);
         return 0;// <-- delete this
      }
   }

//.....
}
Comment 1 Emil Velikov 2015-09-16 11:49:15 UTC
Hi zeif,

This looks like a user error, rather than a mesa bug.

Namely, I suspect that you're feeding attrib as defined by some extension, without first checking if the latter is available. Is that the case ?

For example if you want to use WGL_DEPTH_TEXTURE_FORMAT_NV, you should first check for the WGL_NV_render_depth_texture extension.
Comment 2 zeif 2015-09-16 12:39:59 UTC
(In reply to Emil Velikov from comment #1)
> Hi zeif,
> 
> This looks like a user error, rather than a mesa bug.
> 
> Namely, I suspect that you're feeding attrib as defined by some extension,
> without first checking if the latter is available. Is that the case ?
> 
> For example if you want to use WGL_DEPTH_TEXTURE_FORMAT_NV, you should first
> check for the WGL_NV_render_depth_texture extension.





/////////////////////////////////////////////////////////////////

Thx :

I was a rookie at opengl..

But , Android source code do the same things as me.

So, I push mesa to Emulator's folder.

Android Emulator is not work..


/////////////////////////////////////////////////////////////////

// Android source code : 

//http://androidxref.com/4.3_r2.1/xref/sdk/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp#498



int pbAttribs[] = {
                   WGL_TEXTURE_TARGET_ARB   ,wglTexTarget,
                   WGL_TEXTURE_FORMAT_ARB   ,wglTexFormat,
                   0
                  };
				  
if(!s_wglExtProcs->wglCreatePbufferARB) return NULL;

EGLNativePbufferType pb = s_wglExtProcs->wglCreatePbufferARB(dpy,cfg->nativeId(),width,height,pbAttribs);

if(!pb) {
    DWORD err = GetLastError();
    return NULL;
}
//////////////////////////////////////////////////////////
Comment 3 Emil Velikov 2015-09-16 15:09:23 UTC
Congratulations - seems like you found a bug in the emulator :-)

I would suggest taking a closer look into the emulator code.

To do things properly it should:
1. Create OpenGL context
2. Call wglGetProcAddress("wglGetExtensionsStringARB")
3. If non NULL, call the function to get a list of WGL extensions
4. Search for "WGL_ARB_render_texture" (the provider of WGL_TEXTURE_TARGET_ARB   and WGL_TEXTURE_FORMAT_ARB)
5. Act depending on its presence.

Here are a couple of links which should be useful

[1] https://www.opengl.org/wiki/Load_OpenGL_Functions#Windows_2
[2] https://www.opengl.org/registry/specs/ARB/wgl_render_texture.txt


If you want to add support for the extension in mesa that'll be great. Check the Developer info [3] page for more details.


Cheers,
Emil

[3] http://www.mesa3d.org/devinfo.html
Comment 4 Emil Velikov 2015-09-16 15:20:24 UTC
While one's in the emulator they could also fix the strstr in wglGetExtentionsProcAddress.

Currently it will trigger whenever it finds FooBar, even if it's looking for Foo.
Comment 5 zeif 2015-09-17 02:01:23 UTC
(In reply to Emil Velikov from comment #4)
> While one's in the emulator they could also fix the strstr in
> wglGetExtentionsProcAddress.
> 
> Currently it will trigger whenever it finds FooBar, even if it's looking for
> Foo.

Sincerely thank you for your help,

(In reply to Emil Velikov from comment #4)
> While one's in the emulator they could also fix the strstr in
> wglGetExtentionsProcAddress.
> 
> Currently it will trigger whenever it finds FooBar, even if it's looking for
> Foo.

////////////////////////////////////////

Sincerely thank you for your help.

I know what I'm going to do.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.