[Mesa-dev] [PATCH 01/11] mesa: Fix GL_SHADER_BINARY_FORMATS query

Ian Romanick idr at freedesktop.org
Wed Dec 19 16:14:49 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

There were two bugs here.  First, this and several other queries were
not available in a desktop GL context with GL_ARB_ES2_compatibility.
Second, GL_NUM_SHADER_BINARY_FORMATS returns zero, but
GL_SHADER_BINARY_FORMATS writes one element of data to the buffer.  If
NUM is zero, no data should be written.

Fixes piglit test 'arb_get_program_binary-overrun shader'.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/get.c              |  6 +++++-
 src/mesa/main/get_hash_params.py | 26 ++++++++------------------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 273a79f..41f4612 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -296,8 +296,12 @@ static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
    EXTRA_END
 };
 
+static const int extra_ARB_ES2_compatibility[] = {
+   EXTRA_API_ES2,
+   EXT(ARB_ES2_compatibility),
+   EXTRA_END
+};
 
-EXTRA_EXT(ARB_ES2_compatibility);
 EXTRA_EXT(ARB_texture_cube_map);
 EXTRA_EXT(MESA_texture_array);
 EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index ac9c79c..9f67466 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -204,12 +204,6 @@ descriptor=[
   [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_client_array, Type), NO_EXTRA" ],
   [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA" ],
 
-# GL_ARB_ES2_compatibility
-  [ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ],
-  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility" ],
-  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
-  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
-
 # GL_ARB_multitexture
   [ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ],
   [ "CLIENT_ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
@@ -317,6 +311,14 @@ descriptor=[
 
 # GL_NV_read_buffer
   [ "READ_BUFFER", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, extra_NV_read_buffer_api_gl" ],
+
+# GL_ARB_ES2_compatibility
+  [ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ],
+  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility" ],
+  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
+  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
+  [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility" ],
+  [ "SHADER_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, extra_ARB_ES2_compatibility" ],
 ]},
 
 { "apis": ["GLES", "GLES2"], "params": [
@@ -325,18 +327,6 @@ descriptor=[
   [ "TEXTURE_EXTERNAL_OES", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_OES_EGL_image_external" ],
 ]},
 
-# Enums unique to OpenGL ES 2.0
-{ "apis": ["GLES2"], "params": [
-  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
-  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), NO_EXTRA" ],
-  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
-  [ "SHADER_COMPILER", "CONST(1), NO_EXTRA" ],
-# OES_get_program_binary
-  [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
-  [ "SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
-]},
-
-
 # Remaining enums are only in OpenGL
 { "apis": ["GL", "GL_CORE"], "params": [
   [ "ACCUM_RED_BITS", "BUFFER_INT(Visual.accumRedBits), NO_EXTRA" ],
-- 
1.7.11.7



More information about the mesa-dev mailing list