[Piglit] [PATCH 06/13] shader_runner: Add a 'vertex shader passthrough' mode

Ian Romanick idr at freedesktop.org
Tue Aug 27 18:45:49 PDT 2013


From: Ian Romanick <ian.d.romanick at intel.com>

This may eventually replace uses of 'vertex shader file'.  Even if it
doesn't, future patches will use this.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Paul Berry <stereotype441 at gmail.com>
Cc: Eric Anholt <eric at anholt.net>
---
 tests/shaders/shader_runner.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 5129105..41dbcc0 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -56,6 +56,15 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+const char passthrough_vertex_shader_source[] =
+	"#if __VERSION__ >= 300\n"
+	"in vec4 piglit_vertex;\n"
+	"#else\n"
+	"attribute vec4 piglit_vertex;\n"
+	"#endif\n"
+	"void main() { gl_Position = piglit_vertex; }\n"
+	;
+
 struct component_version {
 	enum version_tag {
 		VERSION_GL,
@@ -106,6 +115,7 @@ enum states {
 	requirements,
 	vertex_shader,
 	vertex_shader_file,
+	vertex_shader_passthrough,
 	vertex_program,
 	geometry_shader,
 	geometry_shader_file,
@@ -642,6 +652,10 @@ leave_state(enum states state, const char *line)
 		compile_glsl(GL_VERTEX_SHADER, false);
 		break;
 
+	case vertex_shader_passthrough:
+		compile_glsl(GL_VERTEX_SHADER, false);
+		break;
+
 	case vertex_shader_file:
 		compile_glsl(GL_VERTEX_SHADER, true);
 		break;
@@ -809,6 +823,11 @@ process_test_script(const char *script_name)
 			} else if (string_match("[vertex program]", line)) {
 				state = vertex_program;
 				shader_string = NULL;
+			} else if (string_match("[vertex shader passthrough]", line)) {
+				state = vertex_shader_passthrough;
+				shader_string =
+					(char *) passthrough_vertex_shader_source;
+				shader_string_size = strlen(shader_string);
 			} else if (string_match("[vertex shader file]", line)) {
 				state = vertex_shader_file;
 				shader_string = NULL;
@@ -842,6 +861,7 @@ process_test_script(const char *script_name)
 		} else {
 			switch (state) {
 			case none:
+			case vertex_shader_passthrough:
 				break;
 
 			case requirements:
-- 
1.8.1.4



More information about the Piglit mailing list