[Piglit] [PATCH] glsl-uniform-out-of-bounds-2: work with or without [0] after array names

Frank Henigman fjhenigman at google.com
Mon Jan 28 13:18:04 PST 2013


Make glsl-uniform-out-of-bounds-2 work whether or not array names
that come out of glGetActiveUniform() have a "[0]" at the end.

https://bugs.freedesktop.org/show_bug.cgi?id=59688

Signed-off-by: Frank Henigman <fjhenigman at google.com>
---
 tests/shaders/glsl-uniform-out-of-bounds-2.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/glsl-uniform-out-of-bounds-2.c b/tests/shaders/glsl-uniform-out-of-bounds-2.c
index db46a1e..2ad992b 100644
--- a/tests/shaders/glsl-uniform-out-of-bounds-2.c
+++ b/tests/shaders/glsl-uniform-out-of-bounds-2.c
@@ -83,17 +83,18 @@ piglit_init(int argc, char **argv)
 		glGetActiveUniform(prog, k, ARRAY_SIZE(name), NULL,
 				   &num_active_elements,
 				   &type, name);
-		if (!((name[0] == 'v' || name[0] == 'm') && name[1] == 0))
+		if (!((name[0] == 'v' || name[0] == 'm')
+				&& (name[1] == 0 || name[1] == '[')))
 			continue;
-		printf("array '%s' active elements %d\n",
-		       name, num_active_elements);
+		printf("array '%c' active elements %d\n",
+		       name[0], num_active_elements);
 
 		/* for each index in array, plus some before and after */
 		for (i = -2; i < 6; ++i) {
 			bool is_active = 0 <= i && i < num_active_elements;
 			GLchar element[9];
 			GLint loc;
-			sprintf(element, "%s[%d]", name, i);
+			sprintf(element, "%c[%d]", name[0], i);
 			loc = glGetUniformLocation(prog, element);
 
 			/* does glGetUniformLocation agree with
-- 
1.8.1



More information about the Piglit mailing list