<p dir="ltr">The extra ext is only required for unorm and snorm formats, not all 16-bit ones.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Nov 9, 2016 6:39 AM, "Lionel Landwerlin" <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This tests that the compiler accepts the new layout formats introduced by<br>
NV_image_formats and also it's correct interaction with the<br>
EXT_texture_norm16 specification.<br>
<br>
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_image_nv_image_<wbr>formats_tests.py     | 230 +++++++++++++++++++++<br>
 2 files changed, 234 insertions(+)<br>
 create mode 100644 generated_tests/gen_shader_<wbr>image_nv_image_formats_tests.<wbr>py<br>
<br>
diff --git a/generated_tests/CMakeLists.<wbr>txt b/generated_tests/CMakeLists.<wbr>txt<br>
index ff43af5..fd38afe 100644<br>
--- a/generated_tests/CMakeLists.<wbr>txt<br>
+++ b/generated_tests/CMakeLists.<wbr>txt<br>
@@ -163,6 +163,9 @@ piglit_make_generated_tests(<br>
        shader_image_load_store_tests.<wbr>list<br>
        gen_shader_image_load_store_<wbr>tests.py)<br>
 piglit_make_generated_tests(<br>
+       shader_image_nv_image_formats_<wbr>tests.list<br>
+       gen_shader_image_nv_image_<wbr>formats_tests.py)<br>
+piglit_make_generated_tests(<br>
        variable_index_read_tests.list<br>
        gen_variable_index_read_tests.<wbr>py<br>
        templates/gen_variable_index_<wbr>read_tests/vs.shader_test.mako<br>
@@ -242,6 +245,7 @@ add_custom_target(gen-gl-tests<br>
                        conversion_fp64.list<br>
                        shader_precision_tests.list<br>
                        shader_image_load_store_tests.<wbr>list<br>
+                       shader_image_nv_image_formats_<wbr>tests.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>image_nv_image_formats_tests.<wbr>py b/generated_tests/gen_shader_<wbr>image_nv_image_formats_tests.<wbr>py<br>
new file mode 100644<br>
index 0000000..9b1861d<br>
--- /dev/null<br>
+++ b/generated_tests/gen_shader_<wbr>image_nv_image_formats_tests.<wbr>py<br>
@@ -0,0 +1,230 @@<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>
+from __future__ import print_function, division, absolute_import<br>
+import os.path<br>
+from mako.template import Template<br>
+from textwrap import dedent<br>
+<br>
+from modules import utils<br>
+<br>
+<br>
+def gen_header(status, norm16):<br>
+    """<br>
+    Generate a GLSL program header.<br>
+<br>
+    Generate header code for ARB_shader_image_load_store GLSL parser<br>
+    tests that are expected to give status as result.<br>
+    """<br>
+    return dedent("""<br>
+        /*<br>
+         * [config]<br>
+         * expect_result: {0}<br>
+         * glsl_version: 3.10 es<br>
+         * require_extensions: GL_NV_image_formats {1}<br>
+         * [end config]<br>
+         */<br>
+        #version 310 es<br>
+        #extension GL_NV_image_formats : enable<br>
+    """.format(status, "GL_EXT_texture_norm16" if norm16 else "!GL_EXT_texture_norm16"))<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>
+                                'nv_image_formats',<br>
+                                'compiler',<br>
+                                '{0}.{1}'.format(t['name'],<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(header = gen_header, **t))<br>
+<br>
+<br>
+shader_stages = [<br>
+    {'shader_stage': 'frag'},<br>
+    {'shader_stage': 'vert'}<br>
+]<br>
+<br>
+<br>
+image_types = [<br>
+    {<br>
+        'name': '2d',<br>
+        'image_type': 'image2D',<br>
+    },<br>
+    {<br>
+        'name': '3d',<br>
+        'image_type': 'image3D',<br>
+    },<br>
+    {<br>
+        'name': '2d-array',<br>
+        'image_type': 'image2DArray',<br>
+    },<br>
+    {<br>
+        'name': 'cube',<br>
+        'image_type': 'imageCube',<br>
+    }<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>
+    # Test image declarations.<br>
+    #<br>
+    gen('declaration-allow-<wbr>floating-point', """\<br>
+        ${header('pass', True)}<br>
+<br>
+        layout(rg32f) readonly uniform highp ${image_type} img_rg32f;<br>
+        layout(rg16f) readonly uniform highp ${image_type} img_rg16f;<br>
+        layout(r16f) readonly uniform highp ${image_type} img_r16f;<br>
+        layout(r11f_g11f_b10f) readonly uniform highp ${image_type} img_r11g11b10f;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+    gen('declaration-allow-unorm', """\<br>
+        ${header('pass', True)}<br>
+<br>
+        layout(rgba16) readonly uniform highp ${image_type} img_rgba16;<br>
+        layout(rgb10_a2) readonly uniform highp ${image_type} img_rgb10_a2;<br>
+        layout(rg16) readonly uniform highp ${image_type} img_rg16;<br>
+        layout(rg8) readonly uniform highp ${image_type} img_rg8;<br>
+        layout(r16) readonly uniform highp ${image_type} img_r16;<br>
+        layout(r8) readonly uniform highp ${image_type} img_r8;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+    gen('declaration-allow-snorm', """\<br>
+        ${header('pass', True)}<br>
+<br>
+        layout(rgba16_snorm) readonly uniform highp ${image_type} img_rgba16;<br>
+        layout(rg16_snorm) readonly uniform highp ${image_type} img_rgb10_a2;<br>
+        layout(rg8_snorm) readonly uniform highp ${image_type} img_rg16;<br>
+        layout(r16_snorm) readonly uniform highp ${image_type} img_rg8;<br>
+        layout(r8_snorm) readonly uniform highp ${image_type} img_r16;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+    gen('declaration-allow-uint', """\<br>
+        ${header('pass', True)}<br>
+<br>
+        layout(rgb10_a2ui) readonly uniform highp u${image_type} img_rgb10_a2ui;<br>
+        layout(rg32ui) readonly uniform highp u${image_type} img_rg32ui;<br>
+        layout(rg16ui) readonly uniform highp u${image_type} img_rg16ui;<br>
+        layout(rg8ui) readonly uniform highp u${image_type} img_rg8ui;<br>
+        layout(r16ui) readonly uniform highp u${image_type} img_r16ui;<br>
+        layout(r8ui) readonly uniform highp u${image_type} img_r8ui;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+    gen('declaration-allow-int', """\<br>
+        ${header('pass', True)}<br>
+<br>
+        layout(rg32i) readonly uniform highp i${image_type} img_rg32i;<br>
+        layout(rg16i) readonly uniform highp i${image_type} img_rg16i;<br>
+        layout(rg8i) readonly uniform highp i${image_type} img_rg8i;<br>
+        layout(r16i) readonly uniform highp i${image_type} img_r16i;<br>
+        layout(r8i) readonly uniform highp i${image_type} img_r8i;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+    gen('declaration-disallow-<wbr>16bit', """\<br>
+        ${header('fail', False)}<br>
+<br>
+        layout(rg16i) readonly uniform highp i${image_type} img_rg16i;<br>
+        layout(r16i) readonly uniform highp i${image_type} img_r16i;<br>
+<br>
+        layout(rg16ui) readonly uniform highp u${image_type} img_rg16ui;<br>
+        layout(r16ui) readonly uniform highp u${image_type} img_r16ui;<br>
+<br>
+        layout(r16f) readonly uniform highp ${image_type} img_r16f;<br>
+<br>
+        layout(rgba16) readonly uniform highp ${image_type} img_rgba16;<br>
+        layout(rg16) readonly uniform highp ${image_type} img_rg16;<br>
+        layout(r16) readonly uniform highp ${image_type} img_r16;<br>
+<br>
+        layout(rgba16_snorm) readonly uniform highp ${image_type} img_rgba16_snorm;<br>
+        layout(rg16_snorm) readonly uniform highp ${image_type} img_rgb10_a2_snorm;<br>
+        layout(r16_snorm) readonly uniform highp ${image_type} img_rg8_snorm;<br>
+<br>
+        void main()<br>
+        {<br>
+        }<br>
+    """, product(image_types, shader_stages))<br>
+<br>
+<br>
+if __name__ == '__main__':<br>
+    main()<br>
--<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>
</blockquote></div></div>