[Mesa-dev] [PATCH 2/3] mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile

Marek Olšák maraeo at gmail.com
Sat Oct 21 12:54:34 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

We already have piglit tests testing alpha, luminance, and intensity
formats. They were skipped by piglit until now.

Additionally, I'm enabling one ARB_texture_buffer_range piglit test to run
with the compat profile.
---
 src/mapi/glapi/gen/apiexec.py                | 12 +++++-------
 src/mesa/drivers/dri/i965/intel_extensions.c |  8 +++++---
 src/mesa/main/extensions_table.h             |  6 +++---
 src/mesa/main/get.c                          |  2 --
 src/mesa/main/get_hash_params.py             | 20 ++++++++++----------
 src/mesa/main/tests/dispatch_sanity.cpp      |  8 ++++----
 src/mesa/main/texparam.c                     |  4 ++--
 src/mesa/state_tracker/st_context.c          |  2 +-
 src/mesa/state_tracker/st_extensions.c       |  8 +++++++-
 src/mesa/state_tracker/st_extensions.h       |  3 ++-
 src/mesa/state_tracker/st_manager.c          |  2 +-
 11 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py
index 61eda4b..7da0818 100644
--- a/src/mapi/glapi/gen/apiexec.py
+++ b/src/mapi/glapi/gen/apiexec.py
@@ -28,21 +28,21 @@ class exec_info():
     10).  For example, glCreateProgram was added in OpenGL 2.0, so
     compatibility=20 and core=31.
 
     If the attribute is None, then it cannot be supported by that
     API.  For example, glNewList was removed from core profiles, so
     compatibility=10 and core=None.
 
     Each of the attributes that is not None must have a valid value.  The
     valid ranges are:
 
-        compatiblity: [10, 30]
+        compatibility: [10, )
         core: [31, )
         es1: [10, 11]
         es2: [20, )
 
     These ranges are enforced by the constructor.
     """
     def __init__(self, compatibility=None, core=None, es1=None, es2=None):
         if compatibility is not None:
             assert isinstance(compatibility, int)
             assert compatibility >= 10
@@ -59,23 +59,22 @@ class exec_info():
         if es2 is not None:
             assert isinstance(es2, int)
             assert es2 >= 20
 
         self.compatibility = compatibility
         self.core = core
         self.es1 = es1
         self.es2 = es2
 
 functions = {
-    # OpenGL 3.1 / GL_ARB_texture_buffer_object.  Mesa only exposes this
-    # extension with core profile.
-    "TexBuffer": exec_info(core=31, es2=31),
+    # OpenGL 3.1 / GL_ARB_texture_buffer_object.
+    "TexBuffer": exec_info(compatibility=20, core=31, es2=31),
 
     # OpenGL 3.2 / GL_OES_geometry_shader.
     "FramebufferTexture": exec_info(core=32, es2=31),
 
     # OpenGL 4.0 / GL_ARB_shader_subroutines. Mesa only exposes this
     # extension with core profile.
     "GetSubroutineUniformLocation": exec_info(core=31),
     "GetSubroutineIndex": exec_info(core=31),
     "GetActiveSubroutineUniformiv": exec_info(core=31),
     "GetActiveSubroutineUniformName": exec_info(core=31),
@@ -137,23 +136,22 @@ functions = {
     "ViewportIndexedf": exec_info(core=32, es2=31),
     "ViewportIndexedfv": exec_info(core=32, es2=31),
     "ScissorArrayv": exec_info(core=32, es2=31),
     "ScissorIndexed": exec_info(core=32, es2=31),
     "ScissorIndexedv": exec_info(core=32, es2=31),
     "DepthRangeArrayv": exec_info(core=32),
     "DepthRangeIndexed": exec_info(core=32),
     # GetFloati_v also GL_ARB_shader_atomic_counters
     # GetDoublei_v also GL_ARB_shader_atomic_counters
 
-    # OpenGL 4.3 / GL_ARB_texture_buffer_range.  Mesa can expose the extension
-    # with OpenGL 3.1.
-    "TexBufferRange": exec_info(core=31, es2=31),
+    # OpenGL 4.3 / GL_ARB_texture_buffer_range.
+    "TexBufferRange": exec_info(compatibility=20, core=31, es2=31),
 
     # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments.  Mesa can expose the
     # extension with OpenGL 3.0.
     "FramebufferParameteri": exec_info(compatibility=30, core=31, es2=31),
     "GetFramebufferParameteri": exec_info(compatibility=30, core=31, es2=31),
 
     # OpenGL 4.5 / GL_ARB_direct_state_access.   Mesa can expose the extension
     # with core profile.
     "CreateTransformFeedbacks": exec_info(core=31),
     "TransformFeedbackBufferBase": exec_info(core=31),
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 519d0a5..21cf632 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -171,23 +171,25 @@ intelInitExtensions(struct gl_context *ctx)
          !driQueryOptionb(&brw->optionCache, "disable_blend_func_extended");
       ctx->Extensions.ARB_conditional_render_inverted = true;
       ctx->Extensions.ARB_cull_distance = true;
       ctx->Extensions.ARB_draw_buffers_blend = true;
       ctx->Extensions.ARB_enhanced_layouts = true;
       ctx->Extensions.ARB_ES3_compatibility = true;
       ctx->Extensions.ARB_fragment_layer_viewport = true;
       ctx->Extensions.ARB_pipeline_statistics_query = true;
       ctx->Extensions.ARB_sample_shading = true;
       ctx->Extensions.ARB_shading_language_420pack = true;
-      ctx->Extensions.ARB_texture_buffer_object = true;
-      ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
-      ctx->Extensions.ARB_texture_buffer_range = true;
+      if (ctx->API == API_OPENGL_CORE) {
+         ctx->Extensions.ARB_texture_buffer_object = true;
+         ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
+         ctx->Extensions.ARB_texture_buffer_range = true;
+      }
       ctx->Extensions.ARB_texture_cube_map_array = true;
       ctx->Extensions.ARB_texture_gather = true;
       ctx->Extensions.ARB_texture_multisample = true;
       ctx->Extensions.ARB_uniform_buffer_object = true;
 
       ctx->Extensions.AMD_vertex_shader_layer = true;
       ctx->Extensions.EXT_framebuffer_multisample = true;
       ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = true;
       ctx->Extensions.EXT_transform_feedback = true;
       ctx->Extensions.ARB_transform_feedback_overflow_query = true;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 2075311..e26d395 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -126,23 +126,23 @@ EXT(ARB_shader_viewport_layer_array         , ARB_shader_viewport_layer_array
 EXT(ARB_shading_language_100                , dummy_true                             , GLL,  x ,  x ,  x , 2003)
 EXT(ARB_shading_language_420pack            , ARB_shading_language_420pack           , GLL, GLC,  x ,  x , 2011)
 EXT(ARB_shading_language_packing            , ARB_shading_language_packing           , GLL, GLC,  x ,  x , 2011)
 EXT(ARB_shadow                              , ARB_shadow                             , GLL,  x ,  x ,  x , 2001)
 EXT(ARB_sparse_buffer                       , ARB_sparse_buffer                      , GLL, GLC,  x ,  x , 2014)
 EXT(ARB_stencil_texturing                   , ARB_stencil_texturing                  , GLL, GLC,  x ,  x , 2012)
 EXT(ARB_sync                                , ARB_sync                               , GLL, GLC,  x ,  x , 2003)
 EXT(ARB_tessellation_shader                 , ARB_tessellation_shader                ,  x , GLC,  x ,  x , 2009)
 EXT(ARB_texture_barrier                     , NV_texture_barrier                     , GLL, GLC,  x ,  x , 2014)
 EXT(ARB_texture_border_clamp                , ARB_texture_border_clamp               , GLL,  x ,  x ,  x , 2000)
-EXT(ARB_texture_buffer_object               , ARB_texture_buffer_object              ,  x , GLC,  x ,  x , 2008)
-EXT(ARB_texture_buffer_object_rgb32         , ARB_texture_buffer_object_rgb32        ,  x , GLC,  x ,  x , 2009)
-EXT(ARB_texture_buffer_range                , ARB_texture_buffer_range               ,  x , GLC,  x ,  x , 2012)
+EXT(ARB_texture_buffer_object               , ARB_texture_buffer_object              , GLL, GLC,  x ,  x , 2008)
+EXT(ARB_texture_buffer_object_rgb32         , ARB_texture_buffer_object_rgb32        , GLL, GLC,  x ,  x , 2009)
+EXT(ARB_texture_buffer_range                , ARB_texture_buffer_range               , GLL, GLC,  x ,  x , 2012)
 EXT(ARB_texture_compression                 , dummy_true                             , GLL,  x ,  x ,  x , 2000)
 EXT(ARB_texture_compression_bptc            , ARB_texture_compression_bptc           , GLL, GLC,  x ,  x , 2010)
 EXT(ARB_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  x , 2004)
 EXT(ARB_texture_cube_map                    , ARB_texture_cube_map                   , GLL,  x ,  x ,  x , 1999)
 EXT(ARB_texture_cube_map_array              , ARB_texture_cube_map_array             , GLL, GLC,  x ,  x , 2009)
 EXT(ARB_texture_env_add                     , dummy_true                             , GLL,  x ,  x ,  x , 1999)
 EXT(ARB_texture_env_combine                 , ARB_texture_env_combine                , GLL,  x ,  x ,  x , 2001)
 EXT(ARB_texture_env_crossbar                , ARB_texture_env_crossbar               , GLL,  x ,  x ,  x , 2001)
 EXT(ARB_texture_env_dot3                    , ARB_texture_env_dot3                   , GLL,  x ,  x ,  x , 2001)
 EXT(ARB_texture_filter_anisotropic          , ARB_texture_filter_anisotropic         , GLL, GLC,  x ,  x , 2017)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index e68a93b..ea8d932 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -302,22 +302,20 @@ static const int extra_EXT_texture_integer_and_new_buffers[] = {
    EXTRA_END
 };
 
 static const int extra_GLSL_130_es3[] = {
    EXTRA_GLSL_130,
    EXTRA_API_ES3,
    EXTRA_END
 };
 
 static const int extra_texture_buffer_object[] = {
-   EXTRA_API_GL_CORE,
-   EXTRA_VERSION_31,
    EXT(ARB_texture_buffer_object),
    EXTRA_END
 };
 
 static const int extra_ARB_transform_feedback2_api_es3[] = {
    EXT(ARB_transform_feedback2),
    EXTRA_API_ES3,
    EXTRA_END
 };
 
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index acd5cd1..20ef6e4 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -435,20 +435,30 @@ descriptor=[
 # fetch extension is supported since the latter imposes no restrictions on
 # non-uniform per-sample discard.
   [ "FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT", "CONTEXT_BOOL(Extensions.MESA_shader_framebuffer_fetch), extra_EXT_shader_framebuffer_fetch" ],
 # GL_OES_EGL_image_external
   [ "TEXTURE_BINDING_EXTERNAL_OES", "LOC_CUSTOM, TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external" ],
   [ "TEXTURE_EXTERNAL_OES", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_OES_EGL_image_external" ],
 ]},
 
 # Enums in OpenGL and ES 3.1
 { "apis": ["GL", "GL_CORE", "GLES31"], "params": [
+# GL_ARB_texture_buffer_object / GL_OES_texture_buffer
+  [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ],
+  [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
+  [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ],
+  [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
+  [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
+
+# GL_ARB_texture_buffer_range
+  [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ],
+
 # GL_ARB_shader_image_load_store / GLES 3.1
   [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), extra_ARB_shader_image_load_store" ],
   [ "MAX_VERTEX_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), extra_ARB_shader_image_load_store" ],
   [ "MAX_FRAGMENT_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), extra_ARB_shader_image_load_store" ],
   [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), extra_ARB_shader_image_load_store" ],
 
 # GL_ARB_shader_atomic_counters / GLES 3.1
   [ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_atomic_counters" ],
   [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters" ],
   [ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), extra_ARB_shader_atomic_counters" ],
@@ -595,30 +605,20 @@ descriptor=[
 # GL_ARB_uniform_buffer_object / geometry shader
   [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
   [ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
 
 # GL_ARB_viewport_array / GL_OES_geometry_shader
   [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Const.LayerAndVPIndexProvokingVertex), extra_ARB_viewport_array_or_oes_geometry_shader" ],
 
 # GL_ARB_gpu_shader5 / GL_OES_geometry_shader
   [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5_or_oes_geometry_shader" ],
 
-# GL_ARB_texture_buffer_object / GL_OES_texture_buffer
-  [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ],
-  [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
-  [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ],
-  [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
-  [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
-
-# GL_ARB_texture_buffer_range
-  [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ],
-
 # GL_OES_primitive_bounding_box
   [ "PRIMITIVE_BOUNDING_BOX_ARB", "CONTEXT_FLOAT8(PrimitiveBoundingBox), extra_OES_primitive_bounding_box" ],
 
 # GL_ARB_viewport_array / GL_OES_viewport_array
   [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports), extra_ARB_viewport_array_or_oes_viewport_array" ],
   [ "VIEWPORT_SUBPIXEL_BITS", "CONTEXT_INT(Const.ViewportSubpixelBits), extra_ARB_viewport_array_or_oes_viewport_array" ],
   [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), extra_ARB_viewport_array_or_oes_viewport_array" ],
   [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM(Const.LayerAndVPIndexProvokingVertex), extra_ARB_viewport_array_or_oes_viewport_array" ],
 
 # INTEL_conservative_rasterization
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index aea9ffb..a46ff38 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -497,20 +497,24 @@ const struct function common_desktop_functions_possible[] = {
    { "glClearBufferiv", 30, -1 },
    { "glClearBufferuiv", 30, -1 },
    { "glClearBufferfv", 30, -1 },
    { "glClearBufferfi", 30, -1 },
    { "glGetStringi", 30, -1 },
 
    /* GL 3.1 */
    { "glDrawArraysInstanced", 31, -1 },
    { "glDrawElementsInstanced", 31, -1 },
    { "glPrimitiveRestartIndex", 31, -1 },
+   { "glTexBuffer", 31, -1 },
+
+   /* GL_ARB_texture_buffer_range */
+   { "glTexBufferRange", 43, -1 },
 
    /* GL_ARB_shader_objects */
    { "glDeleteObjectARB", 31, -1 },
    { "glGetHandleARB", 31, -1 },
    { "glDetachObjectARB", 31, -1 },
    { "glCreateShaderObjectARB", 31, -1 },
    { "glCreateProgramObjectARB", 31, -1 },
    { "glAttachObjectARB", 31, -1 },
    { "glGetObjectParameterfvARB", 31, -1 },
    { "glGetObjectParameterivARB", 31, -1 },
@@ -1494,23 +1498,20 @@ const struct function gl_compatibility_functions_possible[] = {
    { "glActiveStencilFaceEXT", 10, -1 },
    { "glStencilFuncSeparateATI", 10, -1 },
    { "glProgramEnvParameters4fvEXT", 10, -1 },
    { "glProgramLocalParameters4fvEXT", 10, -1 },
    { "glPrimitiveRestartNV", 10, -1 },
 
    { NULL, 0, -1 }
 };
 
 const struct function gl_core_functions_possible[] = {
-   /* GL 3.1 */
-   { "glTexBuffer", 31, -1 },
-
    /* GL 3.2 */
    { "glFramebufferTexture", 32, -1 },
 
    /* GL 4.0 */
    { "glGetSubroutineUniformLocation", 40, -1 },
    { "glGetSubroutineIndex", 40, -1 },
    { "glGetActiveSubroutineUniformiv", 40, -1 },
    { "glGetActiveSubroutineUniformName", 40, -1 },
    { "glGetActiveSubroutineName", 40, -1 },
    { "glUniformSubroutinesuiv", 40, -1 },
@@ -1801,21 +1802,20 @@ const struct function gl_core_functions_possible[] = {
    { "glInvalidateSubFramebuffer", 43, -1 },
    { "glMultiDrawArraysIndirect", 43, -1 },
    { "glMultiDrawElementsIndirect", 43, -1 },
    { "glGetProgramInterfaceiv", 43, -1 },
    { "glGetProgramResourceIndex", 43, -1 },
    { "glGetProgramResourceName", 43, -1 },
    { "glGetProgramResourceiv", 43, -1 },
    { "glGetProgramResourceLocation", 43, -1 },
    { "glGetProgramResourceLocationIndex", 43, -1 },
 // { "glShaderStorageBlockBinding", 43, -1 },           // XXX: Add to xml
-   { "glTexBufferRange", 43, -1 },
 // { "glTextureBufferRangeEXT", 43, -1 },               // XXX: Add to xml
    { "glTexStorage2DMultisample", 43, -1 },
    { "glTexStorage3DMultisample", 43, -1 },
 // { "glTextureStorage2DMultisampleEXT", 43, -1 },      // XXX: Add to xml
 // { "glTextureStorage3DMultisampleEXT", 43, -1 },      // XXX: Add to xml
 
 /* GL 4.5 */
    { "glMemoryBarrierByRegion", 45, -1 },
 
    /* GL_ARB_direct_state_access */
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 039b933..4a0f61e 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1280,22 +1280,22 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
        *    RESOLVED:  No. [...] Note that the spec edits above don't add
        *    explicit error language for any of these cases.  That is because
        *    each of the functions enumerate the set of valid <target>
        *    parameters.  Not editing the spec to allow TEXTURE_BUFFER_ARB in
        *    these cases means that target is not legal, and an INVALID_ENUM
        *    error should be generated."
        *
        * From the OpenGL 3.1 spec:
        * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
        */
-      return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
-         _mesa_has_OES_texture_buffer(ctx);
+      return (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) ||
+             _mesa_has_OES_texture_buffer(ctx);
    case GL_TEXTURE_CUBE_MAP_ARRAY:
       return _mesa_has_texture_cube_map_array(ctx);
    }
 
    if (!_mesa_is_desktop_gl(ctx))
       return GL_FALSE;
 
    /* Rest of the desktop GL targets. */
    switch (target) {
    case GL_TEXTURE_1D:
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 5d8dd8b..a96e454 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -401,21 +401,21 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
    st->has_time_elapsed =
       screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED);
    st->has_half_float_packing =
       screen->get_param(screen, PIPE_CAP_TGSI_PACK_HALF_FLOAT);
    st->has_multi_draw_indirect =
       screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT);
 
    /* GL limits and extensions */
    st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
    st_init_extensions(pipe->screen, &ctx->Const,
-                      &ctx->Extensions, &st->options);
+                      &ctx->Extensions, &st->options, ctx->API);
 
    if (st_have_perfmon(st)) {
       ctx->Extensions.AMD_performance_monitor = GL_TRUE;
    }
 
    /* Enable shader-based fallbacks for ARB_color_buffer_float if needed. */
    if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
       if (!screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_CLAMPED)) {
          st->clamp_vert_color_in_shader = GL_TRUE;
       }
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 3dec5a8..bf0ec2d 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -565,21 +565,22 @@ get_max_samples_for_formats(struct pipe_screen *screen,
 /**
  * Use pipe_screen::get_param() to query PIPE_CAP_ values to determine
  * which GL extensions are supported.
  * Quite a few extensions are always supported because they are standard
  * features or can be built on top of other gallium features.
  * Some fine tuning may still be needed.
  */
 void st_init_extensions(struct pipe_screen *screen,
                         struct gl_constants *consts,
                         struct gl_extensions *extensions,
-                        struct st_config_options *options)
+                        struct st_config_options *options,
+                        gl_api api)
 {
    unsigned i;
    GLboolean *extension_table = (GLboolean *) extensions;
 
    static const struct st_extension_cap_mapping cap_mapping[] = {
       { o(ARB_base_instance),                PIPE_CAP_START_INSTANCE                   },
       { o(ARB_bindless_texture),             PIPE_CAP_BINDLESS_TEXTURE                 },
       { o(ARB_buffer_storage),               PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT   },
       { o(ARB_clear_texture),                PIPE_CAP_CLEAR_TEXTURE                    },
       { o(ARB_clip_control),                 PIPE_CAP_CLIP_HALFZ                       },
@@ -1082,20 +1083,25 @@ void st_init_extensions(struct pipe_screen *screen,
 
    if (options->disable_glsl_line_continuations)
       consts->DisableGLSLLineContinuations = 1;
 
    if (options->allow_glsl_extension_directive_midshader)
       consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE;
 
    consts->MinMapBufferAlignment =
       screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
 
+   /* The OpenGL Compatibility profile requires arbitrary buffer swizzling. */
+   if (api == API_OPENGL_COMPAT &&
+       screen->get_param(screen, PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY))
+      extensions->ARB_texture_buffer_object = GL_FALSE;
+
    if (extensions->ARB_texture_buffer_object) {
       consts->MaxTextureBufferSize =
          _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
               (1u << 31) - 1);
       consts->TextureBufferOffsetAlignment =
          screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT);
 
       if (consts->TextureBufferOffsetAlignment)
          extensions->ARB_texture_buffer_range = GL_TRUE;
 
diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h
index 951185c..7bf1aa8 100644
--- a/src/mesa/state_tracker/st_extensions.h
+++ b/src/mesa/state_tracker/st_extensions.h
@@ -33,14 +33,15 @@
 struct st_context;
 struct pipe_screen;
 
 extern void st_init_limits(struct pipe_screen *screen,
                            struct gl_constants *c,
                            struct gl_extensions *extensions);
 
 extern void st_init_extensions(struct pipe_screen *screen,
                                struct gl_constants *consts,
                                struct gl_extensions *extensions,
-                               struct st_config_options *options);
+                               struct st_config_options *options,
+                               gl_api api);
 
 
 #endif /* ST_EXTENSIONS_H */
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index eebde62..dab987c 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -1161,21 +1161,21 @@ get_version(struct pipe_screen *screen,
    GLuint version;
 
    if (_mesa_override_gl_version_contextless(&consts, &api, &version)) {
       return version;
    }
 
    _mesa_init_constants(&consts, api);
    _mesa_init_extensions(&extensions);
 
    st_init_limits(screen, &consts, &extensions);
-   st_init_extensions(screen, &consts, &extensions, options);
+   st_init_extensions(screen, &consts, &extensions, options, api);
 
    return _mesa_get_version(&extensions, &consts, api);
 }
 
 static void
 st_api_query_versions(struct st_api *stapi, struct st_manager *sm,
                       struct st_config_options *options,
                       int *gl_core_version,
                       int *gl_compat_version,
                       int *gl_es1_version,
-- 
2.7.4



More information about the mesa-dev mailing list