[Mesa-dev] [PATCH 04/18] mesa: Expose texture buffer objects when the context is GL 3.1 core.

Ian Romanick idr at freedesktop.org
Sun Aug 26 09:59:14 PDT 2012


On 08/24/2012 01:19 PM, Eric Anholt wrote:
> Ian Romanick <idr at freedesktop.org> writes:
>
>> From: Eric Anholt <eric at anholt.net>
>>
>> v2: Use API_OPENGL_CORE.
>>
>> v3: Only require desktop GL.  If a driver can't support TexBOs in a non-core
>> context, it should not enable them.
>
>  From the v3 comment, it sounds like you intend that i965 should not set
> GL_ARB_texture_buffer_object, since it can't do TBO in non-core.  That
> was what my v2 did, but...

The idea is that a driver will set the 
ctx->Extensions.ARB_texture_buffer_object flag in any context where it 
can support that functionality.  For i965, this is when the user asked 
for either a 3.0 forward compatible context, a 3.1 context, or a 3.2+ 
core profile context.  Inside Mesa, all of these get API_OPENGL_CORE. 
Other drivers could, hypothetically do other things.

The patch "i965: Advertise GLSL 1.40 and TexBOs in core contexts" does 
exactly this:

@@ -106,6 +110,10 @@ intelInitExtensions(struct gl_context *ctx)
        ctx->Extensions.ARB_blend_func_extended = 
!driQueryOptionb(&intel->optionCache, "disable_blend_func_extended");
        ctx->Extensions.ARB_draw_buffers_blend = true;
        ctx->Extensions.ARB_uniform_buffer_object = true;
+
+      if (ctx->API == API_OPENGL_CORE) {
+         ctx->Extensions.ARB_texture_buffer_object = true;
+      }
     }

     if (intel->gen >= 5)

Other than the hunk just below, I think we're okay?

>> +static const int extra_texture_buffer_object[] = {
>> +   EXTRA_VERSION_31,
>> +   EXT(ARB_texture_buffer_object),
>> +   EXTRA_END
>> +};
>
> Here, it's still changing from logic that is "support if ARB_tbo" to
> "support if ARB_tbo or GL 3.1", good.

So, this is actually the bug. :)

>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index 8ec48eb..2595717 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -754,7 +754,8 @@ _mesa_select_tex_object(struct gl_context *ctx,
>>         case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
>>            return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
>>         case GL_TEXTURE_BUFFER:
>> -         return ctx->Extensions.ARB_texture_buffer_object
>> +         return _mesa_is_desktop_gl(ctx)
>> +            && ctx->Extensions.ARB_texture_buffer_object
>>               ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
>
> but here we're changing from "support if ARB_tbo" to "support if ARB_tbo
> and desktop".  So, i965, not exposing ARB_tbo, would fail to work in a
> 3.1 core context.  Similarly for the rest of the file.


More information about the mesa-dev mailing list