[Piglit] [PATCH 6/8] shader_runner: Add tessellation shader support

Jordan Justen jordan.l.justen at intel.com
Mon Jun 2 15:44:07 PDT 2014


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

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b71a401..5f6722a 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -98,6 +98,10 @@ const char *test_start = NULL;
 
 GLuint vertex_shaders[256];
 unsigned num_vertex_shaders = 0;
+GLuint tessellation_control_shaders[256];
+unsigned num_tessellation_control_shaders = 0;
+GLuint tessellation_evaluation_shaders[256];
+unsigned num_tessellation_evaluation_shaders = 0;
 GLuint geometry_shaders[256];
 unsigned num_geometry_shaders = 0;
 GLuint fragment_shaders[256];
@@ -131,6 +135,10 @@ enum states {
 	vertex_shader_file,
 	vertex_shader_passthrough,
 	vertex_program,
+	tessellation_control_shader,
+	tessellation_control_shader_file,
+	tessellation_evaluation_shader,
+	tessellation_evaluation_shader_file,
 	geometry_shader,
 	geometry_shader_file,
 	geometry_layout,
@@ -238,10 +246,14 @@ target_to_short_name(GLenum target)
 	switch (target) {
 	case GL_VERTEX_SHADER:
 		return "VS";
-	case GL_FRAGMENT_SHADER:
-		return "FS";
+	case GL_TESS_CONTROL_SHADER:
+		return "TCS";
+	case GL_TESS_EVALUATION_SHADER:
+		return "TES";
 	case GL_GEOMETRY_SHADER:
 		return "GS";
+	case GL_FRAGMENT_SHADER:
+		return "FS";
 	case GL_COMPUTE_SHADER:
 		return "CS";
 	default:
@@ -260,13 +272,18 @@ compile_glsl(GLenum target, bool release_text)
 	case GL_VERTEX_SHADER:
 		piglit_require_vertex_shader();
 		break;
-	case GL_FRAGMENT_SHADER:
-		piglit_require_fragment_shader();
+	case GL_TESS_CONTROL_SHADER:
+	case GL_TESS_EVALUATION_SHADER:
+		if (gl_version.num < 40)
+			piglit_require_extension("GL_ARB_tessellation_shader");
 		break;
 	case GL_GEOMETRY_SHADER:
 		if (gl_version.num < 32)
 			piglit_require_extension("GL_ARB_geometry_shader4");
 		break;
+	case GL_FRAGMENT_SHADER:
+		piglit_require_fragment_shader();
+		break;
 	case GL_COMPUTE_SHADER:
 		if (gl_version.num < 43)
 			piglit_require_extension("GL_ARB_compute_shader");
@@ -334,6 +351,14 @@ compile_glsl(GLenum target, bool release_text)
 		vertex_shaders[num_vertex_shaders] = shader;
 		num_vertex_shaders++;
 		break;
+	case GL_TESS_CONTROL_SHADER:
+		tessellation_control_shaders[num_tessellation_control_shaders] = shader;
+		num_tessellation_control_shaders++;
+		break;
+	case GL_TESS_EVALUATION_SHADER:
+		tessellation_evaluation_shaders[num_tessellation_evaluation_shaders] = shader;
+		num_tessellation_evaluation_shaders++;
+		break;
 	case GL_GEOMETRY_SHADER:
 		geometry_shaders[num_geometry_shaders] = shader;
 		num_geometry_shaders++;
@@ -713,6 +738,24 @@ leave_state(enum states state, const char *line)
 					 line - shader_string);
 		break;
 
+	case tessellation_control_shader:
+		shader_string_size = line - shader_string;
+		compile_glsl(GL_TESS_CONTROL_SHADER, false);
+		break;
+
+	case tessellation_control_shader_file:
+		compile_glsl(GL_TESS_CONTROL_SHADER, true);
+		break;
+
+	case tessellation_evaluation_shader:
+		shader_string_size = line - shader_string;
+		compile_glsl(GL_TESS_EVALUATION_SHADER, false);
+		break;
+
+	case tessellation_evaluation_shader_file:
+		compile_glsl(GL_TESS_EVALUATION_SHADER, true);
+		break;
+
 	case geometry_shader:
 		shader_string_size = line - shader_string;
 		compile_glsl(GL_GEOMETRY_SHADER, false);
@@ -781,6 +824,14 @@ link_and_use_shaders(void)
 		glAttachShader(prog, vertex_shaders[i]);
 	}
 
+	for (i = 0; i < num_tessellation_control_shaders; i++) {
+		glAttachShader(prog, tessellation_control_shaders[i]);
+	}
+
+	for (i = 0; i < num_tessellation_evaluation_shaders; i++) {
+		glAttachShader(prog, tessellation_evaluation_shaders[i]);
+	}
+
 	for (i = 0; i < num_geometry_shaders; i++) {
 		glAttachShader(prog, geometry_shaders[i]);
 	}
@@ -896,6 +947,18 @@ process_test_script(const char *script_name)
 			} else if (string_match("[vertex shader file]", line)) {
 				state = vertex_shader_file;
 				shader_string = NULL;
+			} else if (string_match("[tessellation control shader]", line)) {
+				state = tessellation_control_shader;
+				shader_string = NULL;
+			} else if (string_match("[tessellation control shader file]", line)) {
+				state = tessellation_control_shader_file;
+				shader_string = NULL;
+			} else if (string_match("[tessellation evaluation shader]", line)) {
+				state = tessellation_evaluation_shader;
+				shader_string = NULL;
+			} else if (string_match("[tessellation evaluation shader file]", line)) {
+				state = tessellation_evaluation_shader_file;
+				shader_string = NULL;
 			} else if (string_match("[geometry shader]", line)) {
 				state = geometry_shader;
 				shader_string = NULL;
@@ -945,6 +1008,8 @@ process_test_script(const char *script_name)
 
 			case vertex_shader:
 			case vertex_program:
+			case tessellation_control_shader:
+			case tessellation_evaluation_shader:
 			case geometry_shader:
 			case fragment_shader:
 			case fragment_program:
@@ -954,6 +1019,8 @@ process_test_script(const char *script_name)
 				break;
 
 			case vertex_shader_file:
+			case tessellation_control_shader_file:
+			case tessellation_evaluation_shader_file:
 			case geometry_shader_file:
 			case fragment_shader_file:
 			case compute_shader_file:
-- 
2.0.0.rc4



More information about the Piglit mailing list