<div dir="ltr">On 27 August 2013 18:45, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
<br>
This may eventually replace uses of 'vertex shader file'.  Even if it<br>
doesn't, future patches will use this.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
Cc: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
Cc: Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>><br>
---<br>
 tests/shaders/shader_runner.c | 20 ++++++++++++++++++++<br>
 1 file changed, 20 insertions(+)<br>
<br>
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c<br>
index 5129105..41dbcc0 100644<br>
--- a/tests/shaders/shader_runner.c<br>
+++ b/tests/shaders/shader_runner.c<br>
@@ -56,6 +56,15 @@ PIGLIT_GL_TEST_CONFIG_BEGIN<br>
<br>
 PIGLIT_GL_TEST_CONFIG_END<br>
<br>
+const char passthrough_vertex_shader_source[] =<br>
+       "#if __VERSION__ >= 300\n"<br></blockquote><div><br></div><div>How about<br><br></div><div>#if __VERSION__ >= 130<br><br></div><div>That way, if forward-compatible contexts are in use, we won't try to use the deprecated keyword "attribute" when compiling for GLSL 1.30-1.50.<br>
<br></div><div>With that change, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+       "in vec4 piglit_vertex;\n"<br>
+       "#else\n"<br>
+       "attribute vec4 piglit_vertex;\n"<br>
+       "#endif\n"<br>
+       "void main() { gl_Position = piglit_vertex; }\n"<br>
+       ;<br>
+<br>
 struct component_version {<br>
        enum version_tag {<br>
                VERSION_GL,<br>
@@ -106,6 +115,7 @@ enum states {<br>
        requirements,<br>
        vertex_shader,<br>
        vertex_shader_file,<br>
+       vertex_shader_passthrough,<br>
        vertex_program,<br>
        geometry_shader,<br>
        geometry_shader_file,<br>
@@ -642,6 +652,10 @@ leave_state(enum states state, const char *line)<br>
                compile_glsl(GL_VERTEX_SHADER, false);<br>
                break;<br>
<br>
+       case vertex_shader_passthrough:<br>
+               compile_glsl(GL_VERTEX_SHADER, false);<br>
+               break;<br>
+<br>
        case vertex_shader_file:<br>
                compile_glsl(GL_VERTEX_SHADER, true);<br>
                break;<br>
@@ -809,6 +823,11 @@ process_test_script(const char *script_name)<br>
                        } else if (string_match("[vertex program]", line)) {<br>
                                state = vertex_program;<br>
                                shader_string = NULL;<br>
+                       } else if (string_match("[vertex shader passthrough]", line)) {<br>
+                               state = vertex_shader_passthrough;<br>
+                               shader_string =<br>
+                                       (char *) passthrough_vertex_shader_source;<br>
+                               shader_string_size = strlen(shader_string);<br>
                        } else if (string_match("[vertex shader file]", line)) {<br>
                                state = vertex_shader_file;<br>
                                shader_string = NULL;<br>
@@ -842,6 +861,7 @@ process_test_script(const char *script_name)<br>
                } else {<br>
                        switch (state) {<br>
                        case none:<br>
+                       case vertex_shader_passthrough:<br>
                                break;<br>
<br>
                        case requirements:<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
</font></span></blockquote></div><br></div></div>