mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile
authorMarek Olšák <marek.olsak@amd.com>
Thu, 19 Oct 2017 20:22:15 +0000 (22:22 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 9 Nov 2017 22:55:31 +0000 (23:55 +0100)
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.

i965 behavior is unchanged except that it doesn't expose TBOs in the Compat
profile. Not sure how that affects the GL version override.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mapi/glapi/gen/apiexec.py
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/main/extensions_table.h
src/mesa/main/get.c
src/mesa/main/get_hash_params.py
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/texparam.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_extensions.h
src/mesa/state_tracker/st_manager.c

index 61eda4b0f980583e377b5f2d23ba32119f50d4ba..7da0818f8ab913a5db4352684fb4533513068186 100644 (file)
@@ -35,7 +35,7 @@ class exec_info():
     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, )
@@ -66,9 +66,8 @@ class exec_info():
         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),
@@ -144,9 +143,8 @@ functions = {
     # 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.
index 519d0a56cbf4d909044116e1159460613d82effe..4d17393948aa0110e0c8223c336c9c06417a8d9a 100644 (file)
@@ -178,9 +178,11 @@ intelInitExtensions(struct gl_context *ctx)
       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_COMPAT) {
+         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;
index 8d8b6376dc7a4c096bbce6ebad8d2759c74b6a6d..5b66e7d30df0a170ab5e586dd87bd1575bdf90f8 100644 (file)
@@ -133,9 +133,9 @@ EXT(ARB_sync                                , ARB_sync
 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)
index e68a93b10ee1913e86904ae9be363674564bd0df..ea8d932b182cf8007411cde1c29f4c668ea9409a 100644 (file)
@@ -309,8 +309,6 @@ static const int extra_GLSL_130_es3[] = {
 };
 
 static const int extra_texture_buffer_object[] = {
-   EXTRA_API_GL_CORE,
-   EXTRA_VERSION_31,
    EXT(ARB_texture_buffer_object),
    EXTRA_END
 };
index acd5cd1f0119c8325b5ed29a51d6dd1b5bda3988..20ef6e4977a1875ef5a197c5268401addbdcf87a 100644 (file)
@@ -442,6 +442,16 @@ descriptor=[
 
 # 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" ],
@@ -602,16 +612,6 @@ descriptor=[
 # 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" ],
 
index 8c511805b51ba92753d9faf1793d6566bdeaaaf9..d7183de0f1a3d00b5bc4995a806c9049cd13d4be 100644 (file)
@@ -504,6 +504,10 @@ const struct function common_desktop_functions_possible[] = {
    { "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 },
@@ -1501,9 +1505,6 @@ const struct function gl_compatibility_functions_possible[] = {
 };
 
 const struct function gl_core_functions_possible[] = {
-   /* GL 3.1 */
-   { "glTexBuffer", 31, -1 },
-
    /* GL 3.2 */
    { "glFramebufferTexture", 32, -1 },
 
@@ -1808,7 +1809,6 @@ const struct function gl_core_functions_possible[] = {
    { "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 },
index 039b93349e4a545020947d658f66bf0f14e145fe..4a0f61eda8182b67105b963bf009183c298b2bb7 100644 (file)
@@ -1287,8 +1287,8 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
        * 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);
    }
index e82090b7e457a96f30ee0b954910029107b1a5c3..8abf879ab980e52c9216230fde681e7dcafeb62c 100644 (file)
@@ -412,7 +412,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
    /* 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;
index d4b8dc911391033521abef09f0c136f2deab33e5..de3d1ef4e9bd8b4f7c9e10342e38d70b25197f66 100644 (file)
@@ -603,7 +603,8 @@ get_max_samples_for_formats(struct pipe_screen *screen,
 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;
@@ -1120,6 +1121,11 @@ void st_init_extensions(struct pipe_screen *screen,
    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),
index 951185caa3bdc7f5331f0c4008a47a0c1c3a8465..7bf1aa8c8cbee1f60feb947c00c777a93dc8cf2a 100644 (file)
@@ -40,7 +40,8 @@ extern void st_init_limits(struct pipe_screen *screen,
 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 */
index 953f7156c9064481e5276e2ab9b683b294160ea3..aedbc13f7d7608474e6b556b565b61aa467f291b 100644 (file)
@@ -1177,7 +1177,7 @@ get_version(struct pipe_screen *screen,
    _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);
 }