<div dir="ltr">Looks good to me :)<div><span style="font-size:12.8px">Reviewed-by: Plamena Manolova <</span><a href="mailto:lionel.g.landwerlin@intel.com" target="_blank" style="font-size:12.8px"><span class="gmail-il">plamena.manolova@intel.com</span></a><wbr style="font-size:12.8px"><span style="font-size:12.8px">></span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 3:51 PM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
 generated_tests/CMakeLists.txt                     |   4 +<br>
 .../gen_shader_intel_<wbr>conservative_rasterization.py | 173 +++++++++++++++++++++<br>
 2 files changed, 177 insertions(+)<br>
 create mode 100644 generated_tests/gen_shader_<wbr>intel_conservative_<wbr>rasterization.py<br>
<br>
diff --git a/generated_tests/CMakeLists.<wbr>txt b/generated_tests/CMakeLists.<wbr>txt<br>
index c22ac20..7aee214 100644<br>
--- a/generated_tests/CMakeLists.<wbr>txt<br>
+++ b/generated_tests/CMakeLists.<wbr>txt<br>
@@ -153,6 +153,9 @@ piglit_make_generated_tests(<br>
        templates/gen_conversion_fp64/<wbr>shader_base.mako<br>
        )<br>
 piglit_make_generated_tests(<br>
+       shader_intel_conservative_<wbr>rasterization.list<br>
+       gen_shader_intel_conservative_<wbr>rasterization.py)<br>
+piglit_make_generated_tests(<br>
        shader_precision_tests.list<br>
        gen_shader_precision_tests.py<br>
        builtin_function.py<br>
@@ -250,6 +253,7 @@ add_custom_target(gen-gl-tests<br>
                        shader_framebuffer_fetch_<wbr>tests.list<br>
                        shader_image_load_store_tests.<wbr>list<br>
                        shader_image_nv_image_formats_<wbr>tests.list<br>
+                       shader_intel_conservative_<wbr>rasterization.list<br>
                        variable_index_read_tests.list<br>
                        gen_extensions_defined.list<br>
                        vp-tex.list<br>
diff --git a/generated_tests/gen_shader_<wbr>intel_conservative_<wbr>rasterization.py b/generated_tests/gen_shader_<wbr>intel_conservative_<wbr>rasterization.py<br>
new file mode 100644<br>
index 0000000..5a3a5e9<br>
--- /dev/null<br>
+++ b/generated_tests/gen_shader_<wbr>intel_conservative_<wbr>rasterization.py<br>
@@ -0,0 +1,173 @@<br>
+# coding=utf-8<br>
+#<br>
+# Copyright (C) 2016 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 DEALINGS<br>
+# IN THE SOFTWARE.<br>
+<br>
+"""Generate a set of tests to verify that layout qualifiers introduced<br>
+ by INTEL_conservative_<wbr>rasterization are properly parsed.<br>
+<br>
+ This also verifies the interaction with ARB_post_depth_coverage.<br>
+<br>
+ This program outputs, to stdout, the name of each file it generates.<br>
+<br>
+"""<br>
+<br>
+import os.path<br>
+from textwrap import dedent<br>
+<br>
+from mako.template import Template<br>
+<br>
+from modules import utils<br>
+<br>
+def gen_header(status, gl_api, shader_stage):<br>
+    """<br>
+    Generate a GLSL program header.<br>
+<br>
+    Generate header code for INTEL_conservative_<wbr>rasterization GLSL parser<br>
+    tests that are expected to give status as result.<br>
+    """<br>
+<br>
+    if shader_stage != 'frag':<br>
+        status = 'fail'<br>
+    print("%s - %s" % (shader_stage, status))<br>
+<br>
+    if gl_api == "gles":<br>
+        glsl_version = ("3.20 es", "320 es")<br>
+    else:<br>
+        glsl_version = ("4.20", "420")<br>
+<br>
+    return dedent("""<br>
+        /*<br>
+         * [config]<br>
+         * expect_result: {0}<br>
+         * glsl_version: {1}<br>
+         * require_extensions: GL_INTEL_conservative_<wbr>rasterization<br>
+         * [end config]<br>
+         */<br>
+        #version {2}<br>
+        #extension GL_INTEL_conservative_<wbr>rasterization : enable<br>
+    """.format(status, glsl_version[0], glsl_version[1]))<br>
+<br>
+<br>
+def gen(name, src, tests):<br>
+    """<br>
+    Expand a source template for the provided list of test definitions.<br>
+<br>
+    Generate a GLSL parser test for each of the elements of the<br>
+    'tests' iterable, each of them should be a dictionary of<br>
+    definitions that will be used as environment to render the source<br>
+    template.<br>
+<br>
+    The file name of each test will be the concatenation of the 'name'<br>
+    argument with the 'name' item from the respective test dictionary.<br>
+    """<br>
+    template = Template(dedent(src))<br>
+<br>
+    for t in product([{'name': name}], tests):<br>
+        filename = os.path.join('spec',<br>
+                                'intel_conservative_<wbr>rasterization',<br>
+                                'compiler',<br>
+                                '{0}.{1}.{2}'.format(t['name']<wbr>,<br>
+                                                     t['gl_api'],<br>
+                                                     t['shader_stage']))<br>
+        print(filename)<br>
+<br>
+        dirname = os.path.dirname(filename)<br>
+        utils.safe_makedirs(dirname)<br>
+<br>
+        with open(filename, 'w') as f:<br>
+            f.write(template.render(<wbr>header=gen_header, **t))<br>
+<br>
+<br>
+shader_stages = [<br>
+    {'shader_stage': 'frag'},<br>
+    {'shader_stage': 'vert'}<br>
+]<br>
+<br>
+<br>
+gl_apis = [<br>
+    {'gl_api': 'gl'},<br>
+    {'gl_api': 'gles'}<br>
+]<br>
+<br>
+<br>
+def product(ps, *qss):<br>
+    """<br>
+    Generate the cartesian product of a number of lists of dictionaries.<br>
+<br>
+    Each generated element will be the union of some combination of<br>
+    elements from the iterable arguments.  The resulting value of each<br>
+    'name' item will be the concatenation of names of the respective<br>
+    element combination separated with dashes.<br>
+    """<br>
+    for q in (product(*qss) if qss else [{}]):<br>
+        for p in ps:<br>
+            r = dict(p, **q)<br>
+            r['name'] = '-'.join(s['name'] for s in (p, q) if s.get('name'))<br>
+            yield r<br>
+<br>
+<br>
+def main():<br>
+    """Main function."""<br>
+<br>
+<br>
+    #<br>
+    # Test inner_coverage layout qualifier.<br>
+    #<br>
+    gen('inner_coverage', """<br>
+        ${header('pass', gl_api, shader_stage)}<br>
+<br>
+        layout(inner_coverage) in;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(gl_apis, shader_stages))<br>
+<br>
+    #<br>
+    # Test depth_coverage layout qualifier.<br>
+    #<br>
+    gen('post_depth_coverage', """<br>
+        ${header('pass', gl_api, shader_stage)}<br>
+<br>
+        layout(post_depth_coverage) in;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(gl_apis, shader_stages))<br>
+<br>
+    #<br>
+    # Test depth_coverage layout qualifier.<br>
+    #<br>
+    gen('inner_post_depth_<wbr>coverage', """<br>
+        ${header('fail', gl_api, shader_stage)}<br>
+<br>
+        layout(inner_coverage) in;<br>
+        layout(post_depth_coverage) in;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(gl_apis, shader_stages))<br>
+<br>
+if __name__ == '__main__':<br>
+    main()<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.10.2<br>
<br>
______________________________<wbr>_________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div>