[Piglit] [PATCH 10/13] glsl: Allow limit checking on negative constants

Ian Romanick idr at freedesktop.org
Mon Aug 26 10:33:12 PDT 2013


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

GLSL ES 3.00 adds gl_MinProgramTexelOffset with a negative value.
This constant must be -8 or less.  For now, assume that all negative
constants want a <= comparison.  The alternative is to compare the
name for 'gl_Min' instead of 'gl_Max'.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/shaders/built-in-constants.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/shaders/built-in-constants.c b/tests/shaders/built-in-constants.c
index b01e1e2..9e5b940 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -41,7 +41,7 @@ char *required_glsl_version_string = NULL;
 
 
 static const char *const uniform_template =
-	"uniform float f[%s >= %d ? 1 : -1];\n"
+	"uniform float f[%s %s %d ? 1 : -1];\n"
 	;
 
 static const char *const vertex_shader_body =
@@ -150,6 +150,7 @@ parse_file(const char *filename)
 	 * major.minor
 	 * gl_MaxFoo 8
 	 * gl_MaxBar 16
+	 * gl_MinAsdf -2
 	 */
 
 	/* Process the version requirement.
@@ -173,7 +174,8 @@ parse_file(const char *filename)
 
 		line = (char *) eat_whitespace(line);
 
-		if (strncmp("gl_Max", line, 6) != 0) {
+		if (strncmp("gl_Max", line, 6) != 0
+		    && strncmp("gl_Min", line, 6) != 0) {
 			char bad_name[32];
 
 			strncpy(bad_name, line, sizeof(bad_name));
@@ -295,13 +297,14 @@ piglit_init(int argc, char **argv)
 
 	for (i = 0; i < num_tests; i++) {
 		bool subtest_pass = true;
+		const char *comparitor = (tests[i].minimum < 0) ? "<=" : ">=";
 
 		/* Generate the uniform declaration for the test.  This will
 		 * be shared by all shader stages.
 		 */
 		snprintf(uniform, sizeof(uniform),
 			 uniform_template,
-			 tests[i].name, tests[i].minimum);
+			 tests[i].name, comparitor, tests[i].minimum);
 
 		/* Try to compile the vertex shader.
 		 */
-- 
1.8.1.4



More information about the Piglit mailing list