[Piglit] [PATCH] Modify shader_runner to skip tests with unsigned uniforms when GL<3.0

Paul Berry stereotype441 at gmail.com
Wed Feb 8 08:52:36 PST 2012


On implementations that support GLSL version 1.30 but not GL version
3.0 (for example Mesa, when built without floating point texture
support), it is impossible to test unsigned uniforms, because the
Uniform*ui{v} functions are not available.  So any shader_runner tests
that use unsigned uniforms should be skipped.

Since it's rare for implementations to support GLSL version 1.30 but
not GL version 3.0, we don't want to require test writers to remember
to add "GL>=3.0" to the top of their test scripts.  So instead, this
patch modifies shader_runner to automatically skip any test that uses
unsigned uniforms if the GL version is less than 3.0.

Avoids 404 bogus "crash" results in
spec/glsl-1.30/execution/built-in-functions when testing with a
version of Mesa that was built without floating point texture support.
---
 tests/shaders/shader_runner.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c666677..d61a34f 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -726,6 +726,19 @@ get_uints(const char *line, unsigned *uints, unsigned count)
 }
 
 
+/**
+ * Check that the GL implementation supports unsigned uniforms
+ * (e.g. through glUniform1ui).  If not, terminate the test with a
+ * SKIP.
+ */
+void
+check_unsigned_support()
+{
+	if (gl_version < 3.0)
+		piglit_report_result(PIGLIT_SKIP);
+}
+
+
 void
 set_uniform(const char *line)
 {
@@ -759,6 +772,7 @@ set_uniform(const char *line)
 		piglit_Uniform1i(loc, val);
 		return;
 	} else if (string_match("uint", type)) {
+		check_unsigned_support();
 		unsigned val = strtoul(line, NULL, 0);
 		piglit_Uniform1ui(loc, val);
 		return;
@@ -793,6 +807,7 @@ set_uniform(const char *line)
 			return;
 		}
 	} else if (string_match("uvec", type)) {
+		check_unsigned_support();
 		switch (type[4]) {
 		case '2':
 			get_uints(line, uints, 2);
-- 
1.7.7.6



More information about the Piglit mailing list