[Mesa-dev] [PATCH] mesa: fix MAX_FRAMEBUFFER_LAYERS query

Ilia Mirkin imirkin at alum.mit.edu
Sat Jan 23 09:21:17 PST 2016


ARB_framebuffer_no_attachments can be enabled in compat contexts, where
there are no geometry shaders. But the spec still says that this enum
should be exposed.

This approach will also expose the query in plain GLES 3.1 contexts that
don't have GL_OES_geometry_shader enabled, but the get system doesn't
make it easy to do this perfectly right, and it seems like simplicity is
more important than accuracy, esp since

(a) Basically all GLES 3.1 drivers will end up with geometry shaders
(b) Not returning GL_INVALID_ENUM doesn't seem like such a huge deal

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/mesa/main/get.c              | 12 ------------
 src/mesa/main/get_hash_params.py | 10 ++++------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index e1dd82f..e6ecedb 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -153,7 +153,6 @@ enum value_extra {
    EXTRA_EXT_ATOMICS_TESS,
    EXTRA_EXT_SHADER_IMAGE_TESS,
    EXTRA_EXT_SSBO_GS,
-   EXTRA_EXT_FB_NO_ATTACH_GS,
    EXTRA_EXT_ES_GS,
 };
 
@@ -383,12 +382,6 @@ static const int extra_ARB_shader_storage_buffer_object_and_geometry_shader[] =
    EXTRA_END
 };
 
-
-static const int extra_ARB_framebuffer_no_attachments_and_geometry_shader[] = {
-   EXTRA_EXT_FB_NO_ATTACH_GS,
-   EXTRA_END
-};
-
 static const int extra_ARB_viewport_array_or_oes_geometry_shader[] = {
    EXT(ARB_viewport_array),
    EXTRA_EXT_ES_GS,
@@ -1216,11 +1209,6 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
          api_found = (ctx->Extensions.ARB_shader_storage_buffer_object &&
                       _mesa_has_geometry_shaders(ctx));
          break;
-      case EXTRA_EXT_FB_NO_ATTACH_GS:
-         api_check = GL_TRUE;
-         api_found = (ctx->Extensions.ARB_framebuffer_no_attachments &&
-                      _mesa_has_geometry_shaders(ctx));
-         break;
       case EXTRA_EXT_ES_GS:
          api_check = GL_TRUE;
          api_found = _mesa_has_OES_geometry_shader(ctx);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index a15f6b8..9439ebd 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -466,9 +466,10 @@ descriptor=[
   [ "MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxCombinedUniformComponents), extra_ARB_compute_shader_es31" ],
 
 # GL_ARB_framebuffer_no_attachments / GLES 3.1
-  ["MAX_FRAMEBUFFER_WIDTH", "CONTEXT_INT(Const.MaxFramebufferWidth), extra_ARB_framebuffer_no_attachments"],
-  ["MAX_FRAMEBUFFER_HEIGHT", "CONTEXT_INT(Const.MaxFramebufferHeight), extra_ARB_framebuffer_no_attachments"],
-  ["MAX_FRAMEBUFFER_SAMPLES", "CONTEXT_INT(Const.MaxFramebufferSamples), extra_ARB_framebuffer_no_attachments"],
+  [ "MAX_FRAMEBUFFER_WIDTH", "CONTEXT_INT(Const.MaxFramebufferWidth), extra_ARB_framebuffer_no_attachments" ],
+  [ "MAX_FRAMEBUFFER_HEIGHT", "CONTEXT_INT(Const.MaxFramebufferHeight), extra_ARB_framebuffer_no_attachments" ],
+  [ "MAX_FRAMEBUFFER_SAMPLES", "CONTEXT_INT(Const.MaxFramebufferSamples), extra_ARB_framebuffer_no_attachments" ],
+  [ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), extra_ARB_framebuffer_no_attachments" ],
 
 # GL_ARB_explicit_uniform_location / GLES 3.1
   [ "MAX_UNIFORM_LOCATIONS", "CONTEXT_INT(Const.MaxUserAssignableUniformLocations), extra_ARB_explicit_uniform_location" ],
@@ -522,9 +523,6 @@ descriptor=[
   [ "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_framebuffer_no_attachments / geometry shader
-  [ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), extra_ARB_framebuffer_no_attachments_and_geometry_shader" ],
-
 # GL_ARB_viewport_array / GL_OES_geometry_shader
   [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array_or_oes_geometry_shader" ],
 
-- 
2.4.10



More information about the mesa-dev mailing list