[Piglit] [PATCH v3 2/3] shader_runner: Add INT support in require section

Jordan Justen jordan.l.justen at intel.com
Mon Feb 23 13:22:23 PST 2015


This allows a shader_test to require something like:
INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 tests/shaders/shader_runner.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c193de9..e9a56ff 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -566,7 +566,36 @@ process_requirement(const char *line)
 	 * can also require that a particular extension not be supported by
 	 * prepending ! to the extension name.
 	 */
-	if (string_match("GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", line)) {
+	if (string_match("INT ", line)) {
+		enum comparison cmp;
+		const char *enum_name = eat_whitespace(line+3);
+		const char *int_string;
+		int comparison_value, gl_int_value;
+		GLenum int_enum;
+
+		strcpy_to_space(buffer, enum_name);
+
+		int_enum = piglit_get_gl_enum_from_name(buffer);
+
+		int_string = process_comparison(eat_whitespace(enum_name + strlen(buffer)), &cmp);
+		comparison_value = atoi(int_string);
+
+		glGetIntegerv(int_enum, &gl_int_value);
+		if (!piglit_check_gl_error(GL_NO_ERROR)) {
+			fprintf(stderr, "Error reading %s\n", buffer);
+			piglit_report_result(PIGLIT_FAIL);
+		}
+
+		if (!compare(comparison_value, gl_int_value, cmp)) {
+			printf("Test requires %s %s %i.  "
+			       "The driver supports %i.\n",
+			       buffer,
+			       comparison_string(cmp),
+			       comparison_value,
+			       gl_int_value);
+			piglit_report_result(PIGLIT_SKIP);
+		}
+	} else if (string_match("GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", line)) {
 		enum comparison cmp;
 		int maxcomp;
 
-- 
2.1.4



More information about the Piglit mailing list