[Piglit] [PATCH 02/15] glslparsertest: Support tessellation shaders.

Fabian Bieler fabianbieler at fastmail.fm
Mon Mar 24 15:02:41 PDT 2014


Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 framework/glsl_parser_test.py         | 11 ++++++-----
 tests/glslparsertest/glslparsertest.c | 21 ++++++++++++++++++++-
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 82292b5..d731f64 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -69,7 +69,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', 'comp']:
+                if ext in ['vert', 'tesc', 'tese', 'geom', 'frag', 'comp']:
                     filepath = path.join(dirpath, f)
                     # testname := filepath relative to
                     # basepath.
@@ -85,9 +85,9 @@ class GLSLParserTest(PlainExecTest):
 
     This test takes a GLSL source file and passes it to the executable
     ``glslparsertest``. The GLSL source file being tested must have a GLSL
-    file extension: one of ``.vert``, ``.geom``, or ``.frag``. The test file
-    must have a properly formatted comment section containing configuration
-    data (see below).
+    file extension: one of ``.vert``, ``.tesc``, ``.tese``, ``.geom``,
+    ``.frag`` or ``.comp``. The test file must have a properly formatted comment section
+    containing configuration data (see below).
 
     For example test files, see the directory
     'piglit.repo/examples/glsl_parser_text`.
@@ -189,7 +189,8 @@ class GLSLParserTest(PlainExecTest):
 
     def __init__(self, filepath, runConcurrent=True):
         """
-        :filepath: Must end in one '.vert', '.geom', or '.frag'.
+        :filepath: Must end in one '.vert', '.tesc', '.tese', '.geom',
+                  '.frag' or '.comp'.
         """
         Test.__init__(self, runConcurrent)
         self.__config = None
diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index 18bd062..48c498b 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -128,6 +128,10 @@ get_shader_name(GLenum type)
 	switch(type) {
 	case GL_VERTEX_SHADER:
 		return "vertex";
+	case GL_TESS_CONTROL_SHADER:
+		return "tessellation control";
+	case GL_TESS_EVALUATION_SHADER:
+		return "tessellation evaluation";
 	case GL_GEOMETRY_SHADER:
 		return "geometry";
 	case GL_FRAGMENT_SHADER:
@@ -223,6 +227,10 @@ test(void)
 	else if (strcmp(filename + strlen(filename) - 4, "vert") == 0)
 		type = GL_VERTEX_SHADER;
 #ifdef PIGLIT_USE_OPENGL
+	else if (strcmp(filename + strlen(filename) - 4, "tesc") == 0)
+		type = GL_TESS_CONTROL_SHADER;
+	else if (strcmp(filename + strlen(filename) - 4, "tese") == 0)
+		type = GL_TESS_EVALUATION_SHADER;
 	else if (strcmp(filename + strlen(filename) - 4, "geom") == 0)
 		type = GL_GEOMETRY_SHADER;
 	else if (strcmp(filename + strlen(filename) - 4, "comp") == 0)
@@ -238,6 +246,15 @@ test(void)
 	piglit_require_vertex_shader();
 	piglit_require_fragment_shader();
 
+	if (type == GL_TESS_CONTROL_SHADER || type == GL_TESS_EVALUATION_SHADER) {
+		if (!piglit_is_extension_supported("GL_ARB_tessellation_shader") &&
+		    (piglit_is_gles() || piglit_get_gl_version() < 40)) {
+			printf("Test requires GL version 4.0 or "
+			       "GL_ARB_tessellation_shader\n");
+			piglit_report_result(PIGLIT_SKIP);
+		}
+	}
+
 	if (type == GL_COMPUTE_SHADER) {
 		if (!piglit_is_extension_supported("GL_ARB_compute_shader") &&
 		    (piglit_is_gles() || piglit_get_gl_version() < 43)) {
@@ -281,7 +298,9 @@ test(void)
 		if (requested_version == 100 || requested_version == 300)
 			attach_complementary_shader(shader_prog, type);
 #if PIGLIT_USE_OPENGL
-		if (type == GL_GEOMETRY_SHADER)
+		if (type == GL_GEOMETRY_SHADER ||
+		    type == GL_TESS_CONTROL_SHADER ||
+		    type == GL_TESS_EVALUATION_SHADER)
 			attach_dummy_shader(shader_prog, GL_VERTEX_SHADER);
 		if (test_requires_geometry_shader4) {
 			/* The default value of
-- 
1.8.3.2



More information about the Piglit mailing list