[Piglit] [PATCH] Accept array uniform names with or without [0] from glGetActiveUniform

Ian Romanick idr at freedesktop.org
Mon Jan 28 16:30:11 PST 2013


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

This is required by OpenGL ES 3.0 and desktop OpenGL 4.2.  Previous
version were ambiguous.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Frank Henigman <fjhenigman at google.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59688
---
 tests/shaders/glsl-uniform-out-of-bounds-2.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/shaders/glsl-uniform-out-of-bounds-2.c b/tests/shaders/glsl-uniform-out-of-bounds-2.c
index db46a1e..2fc5c86 100644
--- a/tests/shaders/glsl-uniform-out-of-bounds-2.c
+++ b/tests/shaders/glsl-uniform-out-of-bounds-2.c
@@ -80,9 +80,26 @@ piglit_init(int argc, char **argv)
 		GLchar name[99];
 		GLint num_active_elements;
 		GLenum type;
+		char *bracket;
+
 		glGetActiveUniform(prog, k, ARRAY_SIZE(name), NULL,
 				   &num_active_elements,
 				   &type, name);
+
+		/* OpenGL 4.2 and OpenGL ES 3.0 require that the name returned
+		 * for an array have "[0]" on the end.  Earlier versions make
+		 * it optional.
+		 */
+		bracket = strchr(name, '[');
+		if (bracket != NULL) {
+			if (strncmp(bracket, "[0]", 3) != 0) {
+				printf("FAIL: invalid uniform array element "
+				       "returned: %s\n", name);
+				pass = false;
+			}
+			*bracket = '\0';
+		}
+
 		if (!((name[0] == 'v' || name[0] == 'm') && name[1] == 0))
 			continue;
 		printf("array '%s' active elements %d\n",
-- 
1.7.11.7



More information about the Piglit mailing list