Bug 75779

Summary: wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either
Product: Mesa Reporter: turboloops
Component: OtherAssignee: mesa-dev
Status: RESOLVED NOTABUG QA Contact:
Severity: major    
Priority: medium CC: turboloops
Version: 10.0   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description turboloops 2014-03-04 23:26:16 UTC
I have built both 10.0.1 and 10.0.3 on Windows XP and am trying to make framebuffers work using glGenFrameBuffers. So I tried all variations with the normal wglCreateContext but that does not work. The function is there but it fails. The reported version is like 2.1 or something.

So now I try with wglCreateContextAttribsARB and it is not working either, except when the version in the attribs is 2.1 or less. 

The function wglCreateContextAttribsARB is simply not there with the windows gdi target, but is there with the gallium gdi target.

However whether a 2.1 context is created with wglCreateContextAttribsARB or with wglCreateContext there is an error as a result of calling glGenFrameBuffers etc...

When requesting a 3.1 context using wglCreateContextAttribsARB it returns zero and there is no error reported.

The WGL_ARB_create_context string is nowhere to be seen, and yes I did create a dummy context before reading in the function pointers and checking the extensions.

I have been trying for days now to make it work and it would be really good if even the software rasterizer can make a 3.1 context but nothing seems to be there. Even if it does not have programs and shaders that is fine but how do you make glGenFrameBuffers work on windows?


The code is something like this

    if Assigned(glCtx.wglCreateContextAttribsArb) then begin

      fillchar(attribs,sizeof(attribs),0);
      attribs[0] := WGL_CONTEXT_MAJOR_VERSION_ARB;
      attribs[1] := 2;
      attribs[2] := WGL_CONTEXT_MINOR_VERSION_ARB;
      attribs[3] := 1;
      attribs[4] := WGL_CONTEXT_FLAGS_ARB;
      attribs[5] := 0;
      //attribs[6] := WGL_CONTEXT_PROFILE_MASK_ARB;
      //attribs[7] := WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
      attribs[8] := 0;
      attribs[9] := 0;

      //temp_rc := glCtx^.wglCreateContext(dc);
      //wglMakeCurrent(dc,temp_rc);
      // These calls to glGEtIntegerV do not work either. 
      //glCtx.glGetIntegerv(GL_MAJOR_VERSION, @ver[0]);
      //glCtx.glGetIntegerv(GL_MINOR_VERSION, @ver[1]);
      //if ver[0] = 345 then throw_x;

      fRc := glCtx.wglCreateContextAttribsArb(dc,0,@attribs[0]);
      //wglMakeCurrent(dc,fRc);
      //wglMakeCurrent(0,0);
      //wglDeleteContext(temp_rc);
      //wglMakeCurrent(dc,fRc);
      //glGenFrameBuffers();
      if glCtx^.glGetError() <> 0 then
        fRc := 0;
    end;
    if fRc = 0 then begin
      fRc := glCtx^.wglCreateContext(dc);
      if (fRc = 0) then
        throw_x;
    end;


So please to save other people time if all this is not possible, change the documentation where it says OpenGL 3.1 is supported to something like that it in fact simply is not there. Or is it me? It says that OpenGl 3.1 is supported but then trails off with saying you only get an OpenGL 3.1 context by specifying one. So how does that work?
Comment 1 Brian Paul 2014-03-04 23:40:25 UTC
The windows gdi target/driver only supports OpenGL 2.1.  Where do you see that version 3.1 is supported on Windows in the docs?

In any case, glGenFrameBuffers() should work with an OpenGL 2.1 context.  In what way is that failing?
Comment 2 turboloops 2014-03-04 23:42:36 UTC
Ok, so I can make the glGenFrameBuffers work now and also it seems to work better by just calling the wglCreateContextAttribs function with absolutely no attribs, just a pointer to zeroes. I would still like to know how to make it OpenGL 3.1 proper as the release documentation says.
Comment 3 turboloops 2014-03-04 23:45:51 UTC
In the release notes of the newer versions it states that version OpenGL 3.1 is supported but the version returned is 2.1 by glGetString. Then it goes on to say that the 3.1 is available by creating a context that supports 3.1. 

I mean it does not say anything specific about Windows or Linux etc, so I was thinking now I could start running all the shaders and things using the software rasterizer which would help to build some other API. But the glGenFrameBuffers is good, and the error seems to be related to something in my code, but the wglCreateContextAttribsARB is a headache from any perspective when trying to get at OpenGL 3.1.
Comment 4 turboloops 2014-03-04 23:48:13 UTC
I think you can just go ahead and close this report, I mean if it simply is not there then no problem. A table of supported stuff per target instead of Mesa version would be very cool for those looking to get busy on windows. I was browsing through the code and saw shaders and what seemed like swrast compilers so I just assumed from the release notes that OpenGL 3.1 was ready to go for the software rasterizer. My mistake. Thanks.

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.