summaryrefslogtreecommitdiff
path: root/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-12-14 19:00:32 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-01-18 17:35:33 -0800
commitf59a3a0fe2c6ae7d2e29da7b6185039ba0a03079 (patch)
treec74b44b3e067fb1abbbf6196899a7981ebd68772 /src/mesa/main/uniform_query.cpp
parent8ef3c83ffe538d09380baaac5c3cd86a9f97ca47 (diff)
mesa: Array uniform name length includes length of [0]
This is required by OpenGL ES 3.0 and desktop OpenGL 4.2. Previous version were ambiguous. This also matches the behavior of NVIDIA's closed-source driver (version 304.64). Fixed gles3conformance test uniform_buffer_object_getactiveuniformsiv and uniform_buffer_object_structure_and_array_element_names (on my in-progress branch that fixes a bunch of other stuff...YMMV). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/main/uniform_query.cpp')
-rw-r--r--src/mesa/main/uniform_query.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index ec08ed48b40..f0ab0f07996 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -122,6 +122,16 @@ _mesa_GetActiveUniformsiv(GLuint program,
case GL_UNIFORM_NAME_LENGTH:
params[i] = strlen(uni->name) + 1;
+
+ /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
+ * spec says:
+ *
+ * "If the active uniform is an array, the uniform name returned
+ * in name will always be the name of the uniform array appended
+ * with "[0]"."
+ */
+ if (uni->array_elements != 0)
+ params[i] += 3;
break;
case GL_UNIFORM_BLOCK_INDEX: