[Piglit] [PATCH] glslparsertest: Test compute shaders.

Paul Berry stereotype441 at gmail.com
Mon Jan 6 09:01:18 PST 2014


---
 framework/glsl_parser_test.py                          |  2 +-
 tests/all.tests                                        |  6 ++++++
 tests/glslparsertest/glslparsertest.c                  | 11 +++++++++++
 tests/spec/arb_compute_shader/compiler/do_nothing.comp | 13 +++++++++++++
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_compute_shader/compiler/do_nothing.comp

diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 74034e8..91f59cb 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -70,7 +70,7 @@ def import_glsl_parser_tests(group, basepath, subdirectories):
             for f in filenames:
                 # Add f as a test if its file extension is good.
                 ext = f.rsplit('.')[-1]
-                if ext in ['vert', 'geom', 'frag']:
+                if ext in ['vert', 'geom', 'frag', 'comp']:
                     filepath = path.join(dirpath, f)
                     # testname := filepath relative to
                     # basepath.
diff --git a/tests/all.tests b/tests/all.tests
index edf066b..3268d3e 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2779,6 +2779,12 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'],
                          os.path.join(testsDir, 'spec', 'arb_geometry_shader4'),
                          ['compiler'])
 
+arb_compute_shader = Group()
+spec['ARB_compute_shader'] = arb_compute_shader
+import_glsl_parser_tests(spec['ARB_compute_shader'],
+                         os.path.join(testsDir, 'spec', 'arb_compute_shader'),
+                         ['compiler'])
+
 # group glslparsertest ------------------------------------------------------
 glslparsertest = Group()
 # Add all shader source files in the directories below.
diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index 00e4fcc..fbfbb16 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -206,6 +206,8 @@ test(void)
 #ifdef PIGLIT_USE_OPENGL
 	else if (strcmp(filename + strlen(filename) - 4, "geom") == 0)
 		type = GL_GEOMETRY_SHADER;
+	else if (strcmp(filename + strlen(filename) - 4, "comp") == 0)
+		type = GL_COMPUTE_SHADER;
 #endif
 	else {
 		fprintf(stderr, "Couldn't determine type of program %s\n",
@@ -216,6 +218,15 @@ test(void)
 	piglit_require_vertex_shader();
 	piglit_require_fragment_shader();
 
+	if (type == GL_COMPUTE_SHADER) {
+		if (!piglit_is_extension_supported("GL_ARB_compute_shader") &&
+		    (piglit_is_gles() || piglit_get_gl_version() < 43)) {
+			printf("Test requires GL version 4.3 or "
+			       "GL_ARB_compute_shader\n");
+			piglit_report_result(PIGLIT_SKIP);
+		}
+	}
+
 	prog_string = piglit_load_text_file(filename, NULL);
 	if (prog_string == NULL) {
 		fprintf(stderr, "Couldn't open program %s: %s\n",
diff --git a/tests/spec/arb_compute_shader/compiler/do_nothing.comp b/tests/spec/arb_compute_shader/compiler/do_nothing.comp
new file mode 100644
index 0000000..fa2ac7e
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/do_nothing.comp
@@ -0,0 +1,13 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+}
-- 
1.8.5.2



More information about the Piglit mailing list