<div dir="ltr">On 29 August 2013 09:05, 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>
Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
<br>
    "If gl_Color is redeclared with an interpolation qualifier, then<br>
    gl_FrontColor and gl_BackColor (if they are written to) must also be<br>
    redeclared with the same interpolation qualifier, and vice versa. If<br>
    gl_SecondaryColor is redeclared with an interpolation qualifier,<br>
    then gl_FrontSecondaryColor and gl_BackSecondaryColor (if they are<br>
    written to) must also be redeclared with the same interpolation<br>
    qualifier, and vice versa. This qualifier matching on predeclared<br>
    variables is only required for variables that are statically used<br>
    within the shaders in a program."<br>
<br>
This adds five sets of tests from a single generator script:<br>
<br>
    - Set an interpolation qualifier, possibly the default, for one of<br>
      gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or<br>
      gl_BackSecondaryColor in the vertex shader, and set a different<br>
      interpolation qualifier, possibly the default, for the matching<br>
      gl_Color or gl_SecondaryColor in the fragment shader.  This should<br>
      fail to link.<br>
<br>
    - Set a non-default interpolation qualifier for one of<br>
      gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or<br>
      gl_BackSecondaryColor in the vertex shader, and have no<br>
      redeclaration in the fragment shader.  In the fragment shader,<br>
      neither gl_Color nor gl_SecondaryColor is used.  This should<br>
      successfully link.<br>
<br>
    - Set a non-default interpolation qualifier for one of gl_Color or<br>
      gl_SecondaryColor in the fragment shader, and have no<br>
      redeclaration in the vertex shader.  In the vertex shader, none of<br>
      the built-in color variables are used.  This should successfully<br>
      link.<br>
<br>
    - Set an interpolation qualifier, possibly the default, for one of<br>
      gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or<br>
      gl_BackSecondaryColor in the vertex shader, and set a different<br>
      interpolation qualifier, possibly the default, for the matching<br>
      gl_Color or gl_SecondaryColor in the fragment shader.  Neither<br>
      stage uses any of the color variables.  This should successfully<br>
      to link.<br>
<br>
    - Set conflicting interpolation qualifiers for gl_FrontColor /<br>
      gl_BackColor or gl_FrontSecondaryColor / gl_BackSecondaryColor in<br>
      the vertex shader, and set a matching interpolation qualifier on<br>
      gl_Color or gl_SecondaryColor in the fragment shader for one of<br>
      the vertex shader built-in varaibles.  This should fail to link.<br></blockquote><div><br></div>Do we care about testing variants where the variable is statically accessed in the VS but not in the FS (or vice versa)?  It's not entirely clear to me what the spec says about these situations.<br>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Mesa, all of the tests that expect linking failures fail.  Basically,<br>
Mesa's linker accepts everything.<br>
<br>
NVIDIA (304.64 on GTX 260) fails the same set of tests.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=47755" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=47755</a><br>
---<br>
<br>
I haven't run this on AMD's driver yet.  If someone would be so kind<br>
as to:<br>
<br>
  1. Apply this patch.<br>
<br>
  2. make<br>
<br>
  3. Run the following bit of shell:<br>
<br>
    for i in generated_tests/spec/glsl-1.30/linker/interpolation-qualifiers/*.shader_test<br>
    do<br>
        echo $i<br>
        bin/shader_runner $i -auto -fbo<br>
    done > output.txt<br>
<br>
  4. Email output.txt to me.<br>
<br>
  Thanks!<br>
<br>
 generated_tests/CMakeLists.txt                     |   6 +-<br>
 .../interpolation-qualifier-built-in-variable.py   | 390 +++++++++++++++++++++<br>
 2 files changed, 395 insertions(+), 1 deletion(-)<br>
 create mode 100644 generated_tests/interpolation-qualifier-built-in-variable.py<br>
<br>
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt<br>
index a0ba4b1..a4d85dc 100644<br>
--- a/generated_tests/CMakeLists.txt<br>
+++ b/generated_tests/CMakeLists.txt<br>
@@ -60,6 +60,9 @@ piglit_make_generated_tests(<br>
 piglit_make_generated_tests(<br>
        cl_store_tests.list<br>
        generate-cl-store-tests.py)<br>
+piglit_make_generated_tests(<br>
+       interpolation-qualifier-built-in-variable.list<br>
+       interpolation-qualifier-built-in-variable.py)<br>
<br>
 # Add a "gen-tests" target that can be used to generate all the<br>
 # tests without doing any other compilation.<br>
@@ -73,4 +76,5 @@ add_custom_target(gen-tests ALL<br>
                non-lvalue_tests.list<br>
                texture_query_lod_tests.list<br>
                shader_bit_encoding_tests.list<br>
-               uniform-initializer_tests.list)<br>
+               uniform-initializer_tests.list<br>
+               interpolation-qualifier-built-in-variable.list)<br>
diff --git a/generated_tests/interpolation-qualifier-built-in-variable.py b/generated_tests/interpolation-qualifier-built-in-variable.py<br>
new file mode 100644<br>
index 0000000..d03ed4d<br>
--- /dev/null<br>
+++ b/generated_tests/interpolation-qualifier-built-in-variable.py<br>
@@ -0,0 +1,390 @@<br>
+# coding=utf-8<br>
+#<br>
+# Copyright © 2013 Intel Corporation<br>
+#<br>
+# Permission is hereby granted, free of charge, to any person obtaining a<br>
+# copy of this software and associated documentation files (the "Software"),<br>
+# to deal in the Software without restriction, including without limitation<br>
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+# and/or sell copies of the Software, and to permit persons to whom the<br>
+# Software is furnished to do so, subject to the following conditions:<br>
+#<br>
+# The above copyright notice and this permission notice (including the next<br>
+# paragraph) shall be included in all copies or substantial portions of the<br>
+# Software.<br>
+#<br>
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+# DEALINGS IN THE SOFTWARE.<br>
+<br>
+import struct<br>
+import os<br>
+import os.path<br>
+from mako.template import Template<br>
+from textwrap import dedent<br>
+<br>
+interpolation_modes = {<br>
+    'flat',<br>
+    'noperspective',<br>
+    'smooth',<br>
+    'default'<br>
+}<br></blockquote><div><br></div><div>This uses Python's "set literal" syntax, which was introduced in Python 2.7.  Piglit only requires 2.6, so I think we should change this to a list:<br><br></div><div>interpolation_modes = [<br>
</div><div>    'flat',<br></div><div>    'noperspective',<br></div><div>    'smooth',<br></div><div>    'default'<br>]<br><br></div><div>Same with vertex_shader_variables and vertex_shader_variables_front_only.<br>
<br></div><div>All of my other comments (below) are minor, so with this fixed, the patch is:<br><br></div><div>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">
+<br>
+vertex_shader_variables = {<br>
+    'gl_FrontColor',<br>
+    'gl_BackColor',<br>
+    'gl_FrontSecondaryColor',<br>
+    'gl_BackSecondaryColor'<br>
+}<br>
+<br>
+vertex_shader_variables_front_only = {<br>
+    'gl_FrontColor',<br>
+    'gl_FrontSecondaryColor',<br>
+}<br>
+<br>
+vertex_shader_variables_other_side = {<br>
+    'gl_FrontColor': 'gl_BackColor',<br>
+    'gl_BackColor': 'gl_FrontColor',<br>
+    'gl_FrontSecondaryColor': 'gl_BackSecondaryColor',<br>
+    'gl_BackSecondaryColor': 'gl_FrontSecondaryColor'<br>
+}<br>
+<br>
+fragment_shader_variables = {<br>
+    'gl_FrontColor': 'gl_Color',<br>
+    'gl_BackColor': 'gl_Color',<br>
+    'gl_FrontSecondaryColor': 'gl_SecondaryColor',<br>
+    'gl_BackSecondaryColor': 'gl_SecondaryColor'<br>
+}<br></blockquote><div><br></div><div>Minor quibble: vertex_shader_variables_other_side and fragment_shader_variables sound like names of lists, when they're in fact mappings from one variable name to another.  Maybe rename to something like "other_side_map" and "vs_to_fs_map"?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+template = Template(dedent("""\<br>
+    # Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
+    #<br>
+    #     "If gl_Color is redeclared with an interpolation qualifier, then<br>
+    #     gl_FrontColor and gl_BackColor (if they are written to) must<br>
+    #     also be redeclared with the same interpolation qualifier, and<br>
+    #     vice versa. If gl_SecondaryColor is redeclared with an<br>
+    #     interpolation qualifier, then gl_FrontSecondaryColor and<br>
+    #     gl_BackSecondaryColor (if they are written to) must also be<br>
+    #     redeclared with the same interpolation qualifier, and vice<br>
+    #     versa. This qualifier matching on predeclared variables is only<br>
+    #     required for variables that are statically used within the<br>
+    #     shaders in a program."<br>
+    #<br>
+    # Even though some of the other rules for interpolation qualifier<br>
+    # matching changed in 4.x specifications, this rule has remained the<br>
+    # same.<br>
+    [require]<br>
+    GLSL >= 1.30<br>
+<br>
+    [vertex shader]<br>
+    % if vs_mode != 'default':<br>
+    ${vs_mode} out vec4 ${vs_variable};<br>
+    % endif<br>
+    void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }<br>
+<br>
+    [fragment shader]<br>
+    % if fs_mode != 'default':<br>
+    ${fs_mode} in vec4 ${fs_variable};<br>
+    % endif<br>
+    out vec4 c;<br>
+    void main() { c = ${fs_variable}; }<br>
+<br>
+    [test]<br>
+    link error<br>
+    """))<br>
+<br>
+for fs_mode in interpolation_modes:<br>
+    for vs_mode in interpolation_modes:<br>
+        if vs_mode == fs_mode:<br>
+            continue<br>
+<br>
+        for var in vertex_shader_variables:<br>
+            filename = os.path.join('spec',<br>
+                                    'glsl-1.30',<br>
+                                    'linker',<br>
+                                    'interpolation-qualifiers',<br>
+                                    '{0}-{1}-{2}-{3}.shader_test'.format(vs_mode,<br>
+                                                                         var,<br>
+                                                                         fs_mode,<br>
+                                                                         fragment_shader_variables[var]))<br>
+            print filename<br>
+<br>
+            dirname = os.path.dirname(filename)<br>
+            if not os.path.exists(dirname):<br>
+                os.makedirs(dirname)<br>
+<br>
+            f = open(filename, 'w')<br>
+            f.write(template.render(vs_mode=vs_mode,<br>
+                                    vs_variable=var,<br>
+                                    fs_mode=fs_mode,<br>
+                                    fs_variable=fragment_shader_variables[var]))<br>
+            f.close()<br>
+<br>
+template = Template(dedent("""\<br>
+    # Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
+    #<br>
+    #     "If gl_Color is redeclared with an interpolation qualifier, then<br>
+    #     gl_FrontColor and gl_BackColor (if they are written to) must<br>
+    #     also be redeclared with the same interpolation qualifier, and<br>
+    #     vice versa. If gl_SecondaryColor is redeclared with an<br>
+    #     interpolation qualifier, then gl_FrontSecondaryColor and<br>
+    #     gl_BackSecondaryColor (if they are written to) must also be<br>
+    #     redeclared with the same interpolation qualifier, and vice<br>
+    #     versa. This qualifier matching on predeclared variables is only<br>
+    #     required for variables that are statically used within the<br>
+    #     shaders in a program."<br>
+    #<br>
+    # Even though some of the other rules for interpolation qualifier<br>
+    # matching changed in 4.x specifications, this rule has remained the<br>
+    # same.<br>
+    #<br>
+    # We interpret the sentence "variables that are statically used within the<br>
+    # shaders in a program" to mean static use of the variable in a shader stage<br>
+    # invokes the redeclaration requirement for that stage only.  This is based on<br>
+    # the additional text "..gl_FrontColor and gl_BackColor (if they are written<br>
+    # to) must also be redeclared with the same interpolation qualifier..."<br>
+    [require]<br>
+    GLSL >= 1.30<br>
+<br>
+    [vertex shader]<br>
+    ${vs_mode} out vec4 ${vs_variable};<br>
+    void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }<br>
+<br>
+    [fragment shader]<br>
+    out vec4 c;<br>
+    void main() { c = vec4(0); }<br>
+<br>
+    [test]<br>
+    link success<br>
+    """))<br>
+<br>
+for vs_mode in interpolation_modes:<br>
+    if vs_mode == 'default':<br>
+        continue<br>
+<br>
+    for var in vertex_shader_variables:<br>
+        filename = os.path.join('spec',<br>
+                                'glsl-1.30',<br>
+                                'linker',<br>
+                                'interpolation-qualifiers',<br>
+                                '{0}-{1}-unused-{2}.shader_test'.format(vs_mode,<br>
+                                                                        var,<br>
+                                                                        fragment_shader_variables[var]))<br>
+        print filename<br>
+<br>
+        dirname = os.path.dirname(filename)<br>
+        if not os.path.exists(dirname):<br>
+            os.makedirs(dirname)<br>
+<br>
+        f = open(filename, 'w')<br>
+        f.write(template.render(vs_mode=vs_mode,<br>
+                                vs_variable=var))<br>
+        f.close()<br>
+<br>
+template = Template(dedent("""\<br>
+    # Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
+    #<br>
+    #     "If gl_Color is redeclared with an interpolation qualifier, then<br>
+    #     gl_FrontColor and gl_BackColor (if they are written to) must<br>
+    #     also be redeclared with the same interpolation qualifier, and<br>
+    #     vice versa. If gl_SecondaryColor is redeclared with an<br>
+    #     interpolation qualifier, then gl_FrontSecondaryColor and<br>
+    #     gl_BackSecondaryColor (if they are written to) must also be<br>
+    #     redeclared with the same interpolation qualifier, and vice<br>
+    #     versa. This qualifier matching on predeclared variables is only<br>
+    #     required for variables that are statically used within the<br>
+    #     shaders in a program."<br>
+    #<br>
+    # Even though some of the other rules for interpolation qualifier<br>
+    # matching changed in 4.x specifications, this rule has remained the<br>
+    # same.<br>
+    #<br>
+    # We interpret the sentence "variables that are statically used within the<br>
+    # shaders in a program" to mean static use of the variable in a shader stage<br>
+    # invokes the redeclaration requirement for that stage only.  This is based on<br>
+    # the additional text "..gl_FrontColor and gl_BackColor (if they are written<br>
+    # to) must also be redeclared with the same interpolation qualifier..."<br>
+    [require]<br>
+    GLSL >= 1.30<br>
+<br>
+    [vertex shader]<br>
+    void main() { gl_Position = vec4(0); }<br>
+<br>
+    [fragment shader]<br>
+    ${fs_mode} in vec4 ${fs_variable};<br>
+    out vec4 c;<br>
+    void main() { c = ${fs_variable}; }<br>
+<br>
+    [test]<br>
+    link success<br>
+    """))<br>
+<br>
+for fs_mode in interpolation_modes:<br>
+    if fs_mode == 'default':<br>
+        continue<br>
+<br>
+    for var in vertex_shader_variables_front_only:<br>
+        filename = os.path.join('spec',<br>
+                                'glsl-1.30',<br>
+                                'linker',<br>
+                                'interpolation-qualifiers',<br>
+                                'unused-{0}-{1}-{2}.shader_test'.format(var,<br>
+                                                                        fs_mode,<br>
+                                                                        fragment_shader_variables[var]))<br>
+        print filename<br>
+<br>
+        dirname = os.path.dirname(filename)<br>
+        if not os.path.exists(dirname):<br>
+            os.makedirs(dirname)<br>
+<br>
+        f = open(filename, 'w')<br>
+        f.write(template.render(vs_mode=vs_mode,<br>
+                                vs_variable=var,<br>
+                                fs_mode=fs_mode,<br>
+                                fs_variable=fragment_shader_variables[var]))<br>
+        f.close()<br>
+<br>
+<br>
+template = Template(dedent("""\<br>
+    # Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
+    #<br>
+    #     "If gl_Color is redeclared with an interpolation qualifier, then<br>
+    #     gl_FrontColor and gl_BackColor (if they are written to) must<br>
+    #     also be redeclared with the same interpolation qualifier, and<br>
+    #     vice versa. If gl_SecondaryColor is redeclared with an<br>
+    #     interpolation qualifier, then gl_FrontSecondaryColor and<br>
+    #     gl_BackSecondaryColor (if they are written to) must also be<br>
+    #     redeclared with the same interpolation qualifier, and vice<br>
+    #     versa. This qualifier matching on predeclared variables is only<br>
+    #     required for variables that are statically used within the<br>
+    #     shaders in a program."<br>
+    #<br>
+    # Even though some of the other rules for interpolation qualifier<br>
+    # matching changed in 4.x specifications, this rule has remained the<br>
+    # same.<br>
+    #<br>
+    # We interpret the sentence "variables that are statically used within the<br>
+    # shaders in a program" to mean static use of the variable in any shader in<br>
+    # the program invokes the redeclaration requirement.  Since neither shader<br>
+    # accesses any built-in variables, linking should succeed no matter what the<br>
+    # interpolation qualifiers say.<br>
+    [require]<br>
+    GLSL >= 1.30<br>
+<br>
+    [vertex shader]<br>
+    % if vs_mode != 'default':<br>
+    ${vs_mode} out vec4 ${vs_variable};<br>
+    % endif<br>
+    void main() { gl_Position = vec4(0); }<br>
+<br>
+    [fragment shader]<br>
+    % if fs_mode != 'default':<br>
+    ${fs_mode} in vec4 ${fs_variable};<br>
+    % endif<br>
+    out vec4 c;<br>
+    void main() { c = vec4(0); }<br>
+<br>
+    [test]<br>
+    link success<br>
+    """))<br>
+<br>
+for fs_mode in interpolation_modes:<br>
+    for vs_mode in interpolation_modes:<br>
+        if vs_mode == fs_mode:<br>
+            continue<br>
+<br>
+        for var in vertex_shader_variables:<br>
+            filename = os.path.join('spec',<br>
+                                    'glsl-1.30',<br>
+                                    'linker',<br>
+                                    'interpolation-qualifiers',<br>
+                                    'unused-{0}-{1}-unused-{2}-{3}.shader_test'.format(vs_mode,<br>
+                                                                                       var,<br>
+                                                                                       fs_mode,<br>
+                                                                                       fragment_shader_variables[var]))<br>
+            print filename<br>
+<br>
+            dirname = os.path.dirname(filename)<br>
+            if not os.path.exists(dirname):<br>
+                os.makedirs(dirname)<br>
+<br>
+            f = open(filename, 'w')<br>
+            f.write(template.render(vs_mode=vs_mode,<br>
+                                    vs_variable=var,<br>
+                                    fs_mode=fs_mode,<br>
+                                    fs_variable=fragment_shader_variables[var]))<br>
+            f.close()<br>
+<br>
+<br>
+template = Template(dedent("""\<br>
+    # Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:<br>
+    #<br>
+    #     "If gl_Color is redeclared with an interpolation qualifier, then<br>
+    #     gl_FrontColor and gl_BackColor (if they are written to) must<br>
+    #     also be redeclared with the same interpolation qualifier, and<br>
+    #     vice versa. If gl_SecondaryColor is redeclared with an<br>
+    #     interpolation qualifier, then gl_FrontSecondaryColor and<br>
+    #     gl_BackSecondaryColor (if they are written to) must also be<br>
+    #     redeclared with the same interpolation qualifier, and vice<br>
+    #     versa. This qualifier matching on predeclared variables is only<br>
+    #     required for variables that are statically used within the<br>
+    #     shaders in a program."<br>
+    #<br>
+    # Even though some of the other rules for interpolation qualifier<br>
+    # matching changed in 4.x specifications, this rule has remained the<br>
+    # same.<br>
+    [require]<br>
+    GLSL >= 1.30<br>
+<br>
+    [vertex shader]<br>
+    % if fs_mode != 'default':<br>
+    ${fs_mode} out vec4 ${front_variable};<br>
+    % endif<br>
+    % if vs_mode != 'default':<br>
+    ${vs_mode} out vec4 ${back_variable};<br></blockquote><div><br></div><div>It seems a little misleading to call these "front_variable" and "back_variable" when in fact sometimes the former is the back variable and the latter is the front variable.  How about just "vs_variable_1" and "vs_variable_2"?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    % endif<br>
+    void main() { gl_Position = vec4(0); ${front_variable} = vec4(0); ${back_variable} = vec4(1); }<br>
+<br>
+    [fragment shader]<br>
+    % if fs_mode != 'default':<br>
+    ${fs_mode} in vec4 ${fs_variable};<br>
+    % endif<br>
+    out vec4 c;<br>
+    void main() { c = ${fs_variable}; }<br>
+<br>
+    [test]<br>
+    link error<br>
+    """))<br>
+<br>
+for fs_mode in interpolation_modes:<br>
+    for vs_mode in interpolation_modes:<br>
+        if vs_mode == fs_mode:<br>
+            continue<br>
+<br>
+        for var in vertex_shader_variables:<br>
+            var_back = vertex_shader_variables_other_side[var]<br></blockquote><div><br></div><div>Similar comment here: "var_back" is a misleading name.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+            filename = os.path.join('spec',<br>
+                                    'glsl-1.30',<br>
+                                    'linker',<br>
+                                    'interpolation-qualifiers',<br>
+                                    '{0}-{1}-{2}-{3}.shader_test'.format(vs_mode,<br>
+                                                                         var,<br>
+                                                                         fs_mode,<br>
+                                                                         var_back))<br>
+            print filename<br>
+<br>
+            dirname = os.path.dirname(filename)<br>
+            if not os.path.exists(dirname):<br>
+                os.makedirs(dirname)<br>
+<br>
+            f = open(filename, 'w')<br>
+            f.write(template.render(vs_mode=vs_mode,<br>
+                                    front_variable=var,<br>
+                                    back_variable=var_back,<br>
+                                    fs_mode=fs_mode,<br>
+                                    fs_variable=fragment_shader_variables[var]))<br>
+            f.close()<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>