Re: [Piglit] [PATCH] version-mixing: gl_FragColor built-in is not available in core profile >= 4.20

2016-04-12 Thread Matt Turner
On Tue, Apr 12, 2016 at 6:00 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> ... so just use an explicit out declaration unconditionally for such versions.
> ---
>  tests/shaders/version-mixing.c | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/tests/shaders/version-mixing.c b/tests/shaders/version-mixing.c
> index 1948c9e..b349d46 100644
> --- a/tests/shaders/version-mixing.c
> +++ b/tests/shaders/version-mixing.c
> @@ -104,6 +104,24 @@ static const char *interstage_fs =
> "  gl_FragColor = vec4(0.0);\n"
> "}\n";
>
> +/* Section 1.2.1 (Summary of Changes from Version 4.10) of the OpenGL
> + * Shading Language 4.20 spec says:
> + *
> + * Move these previously deprecated features to be only in the
> + * compatibility profile:
> + *   ...
> + *   * The built-in variabls gl_FragColor and gl_FragData.

Typo: variables
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] version-mixing: gl_FragColor built-in is not available in core profile >= 4.20

2016-04-12 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Tue, Apr 12, 2016 at 9:00 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> ... so just use an explicit out declaration unconditionally for such versions.
> ---
>  tests/shaders/version-mixing.c | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/tests/shaders/version-mixing.c b/tests/shaders/version-mixing.c
> index 1948c9e..b349d46 100644
> --- a/tests/shaders/version-mixing.c
> +++ b/tests/shaders/version-mixing.c
> @@ -104,6 +104,24 @@ static const char *interstage_fs =
> "  gl_FragColor = vec4(0.0);\n"
> "}\n";
>
> +/* Section 1.2.1 (Summary of Changes from Version 4.10) of the OpenGL
> + * Shading Language 4.20 spec says:
> + *
> + * Move these previously deprecated features to be only in the
> + * compatibility profile:
> + *   ...
> + *   * The built-in variabls gl_FragColor and gl_FragData.
> + */
> +static const char *interstage_fs_420 =
> +   "#version %d\n"
> +   "\n"
> +   "out vec4 color;\n"
> +   "\n"
> +   "void main()\n"
> +   "{\n"
> +   "  color = vec4(0.0);\n"
> +   "}\n";
> +
>  static const char *intrastage_vs1 =
> "#version %d\n"
> "\n"
> @@ -213,8 +231,13 @@ test_interstage(int version_vs, int version_other, bool 
> use_gs)
> return false;
> }
> } else {
> +   const char *fs = interstage_fs;
> +
> +   if (version_other >= 420)
> +   fs = interstage_fs_420;
> +
> if (!try_attach_shader(prog, "fragment shader",
> -  GL_FRAGMENT_SHADER, interstage_fs,
> +  GL_FRAGMENT_SHADER, fs,
>version_other)) {
> glDeleteProgram(prog);
> return false;
> --
> 2.5.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Fixes for arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag

2016-04-12 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Tue, Apr 12, 2016 at 9:11 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> Core profile 4.20 does not have the gl_FragColor built-in, and atomic
> counters need a binding.
> ---
>  tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git 
> a/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag 
> b/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
> index e0dd221..da4fa3e 100644
> --- a/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
> @@ -9,7 +9,7 @@
>  #version 420
>  #extension GL_ARB_arrays_of_arrays: enable
>
> -uniform atomic_uint array01[1][1];
> +layout (binding = 0) uniform atomic_uint array01[1][1];
>  writeonly uniform image1D array02[1][1];
>  writeonly uniform iimage1D array03[1][1];
>  writeonly uniform uimage1D array04[1][1];
> @@ -43,5 +43,6 @@ writeonly uniform uimage2DMS array31[1][1];
>  writeonly uniform image2DMSArray array32[1][1];
>  writeonly uniform iimage2DMSArray array33[1][1];
>  writeonly uniform uimage2DMSArray array34[1][1];
> +out vec4 color;
>
> -void main() { gl_FragColor = vec4(0.0); }
> +void main() { color = vec4(0.0); }
> --
> 2.5.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Fixes for arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag

2016-04-12 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Core profile 4.20 does not have the gl_FragColor built-in, and atomic
counters need a binding.
---
 tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag 
b/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
index e0dd221..da4fa3e 100644
--- a/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
+++ b/tests/spec/arb_arrays_of_arrays/compiler/glsl-4.20-basic-types.frag
@@ -9,7 +9,7 @@
 #version 420
 #extension GL_ARB_arrays_of_arrays: enable
 
-uniform atomic_uint array01[1][1];
+layout (binding = 0) uniform atomic_uint array01[1][1];
 writeonly uniform image1D array02[1][1];
 writeonly uniform iimage1D array03[1][1];
 writeonly uniform uimage1D array04[1][1];
@@ -43,5 +43,6 @@ writeonly uniform uimage2DMS array31[1][1];
 writeonly uniform image2DMSArray array32[1][1];
 writeonly uniform iimage2DMSArray array33[1][1];
 writeonly uniform uimage2DMSArray array34[1][1];
+out vec4 color;
 
-void main() { gl_FragColor = vec4(0.0); }
+void main() { color = vec4(0.0); }
-- 
2.5.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] version-mixing: gl_FragColor built-in is not available in core profile >= 4.20

2016-04-12 Thread Nicolai Hähnle
From: Nicolai Hähnle 

... so just use an explicit out declaration unconditionally for such versions.
---
 tests/shaders/version-mixing.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/version-mixing.c b/tests/shaders/version-mixing.c
index 1948c9e..b349d46 100644
--- a/tests/shaders/version-mixing.c
+++ b/tests/shaders/version-mixing.c
@@ -104,6 +104,24 @@ static const char *interstage_fs =
"  gl_FragColor = vec4(0.0);\n"
"}\n";
 
+/* Section 1.2.1 (Summary of Changes from Version 4.10) of the OpenGL
+ * Shading Language 4.20 spec says:
+ *
+ * Move these previously deprecated features to be only in the
+ * compatibility profile:
+ *   ...
+ *   * The built-in variabls gl_FragColor and gl_FragData.
+ */
+static const char *interstage_fs_420 =
+   "#version %d\n"
+   "\n"
+   "out vec4 color;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "  color = vec4(0.0);\n"
+   "}\n";
+
 static const char *intrastage_vs1 =
"#version %d\n"
"\n"
@@ -213,8 +231,13 @@ test_interstage(int version_vs, int version_other, bool 
use_gs)
return false;
}
} else {
+   const char *fs = interstage_fs;
+
+   if (version_other >= 420)
+   fs = interstage_fs_420;
+
if (!try_attach_shader(prog, "fragment shader",
-  GL_FRAGMENT_SHADER, interstage_fs,
+  GL_FRAGMENT_SHADER, fs,
   version_other)) {
glDeleteProgram(prog);
return false;
-- 
2.5.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v3 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
Quoting Ilia Mirkin (2016-04-12 17:32:37)
> On Tue, Apr 12, 2016 at 8:20 PM, Dylan Baker  wrote:
> > +if not version.is_es:
> > +# if the actual version is GL and is less than 140 make a
> > +# compat test and a core test and a compat test
> 
> Probably just the one compat test ;)
> 
> Otherwise this is Acked-by: Ilia Mirkin 
> 
> Thanks a lot for automating these -- I was always lazy (/forgetful)
> about adding them for new exts.
> 
>   -ilia

Yeah, Matt and I noticed that coverage for this was very hit or miss,
and bascially none of what we had covered tess or compute, and very
little cover geometry.

I'll fix that comment

Dylan


signature.asc
Description: signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v3 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 8:20 PM, Dylan Baker  wrote:
> +if not version.is_es:
> +# if the actual version is GL and is less than 140 make a
> +# compat test and a core test and a compat test

Probably just the one compat test ;)

Otherwise this is Acked-by: Ilia Mirkin 

Thanks a lot for automating these -- I was always lazy (/forgetful)
about adding them for new exts.

  -ilia
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v3 0/4] Add a generator for testing GLSL defines

2016-04-12 Thread Dylan Baker
This series adds a generator for testing preprocessor defines in GLSL.  


   
IT generates both tests for defines that should be available, and those 


   
that should not. If the driver implements an extension the 'enabled'


   
tests will run and the 'disabled' will skip, if the driver does not 


   
implement an extension then the opposite will happen.   


   



   
The first patch is a bug fix for the installer, the seoncd two patches  


   
add some generic framework to help make writing generators easier. the  


   
final patch adds the generator, and deletes tests that it replaces. 


   



   
Patches 2 and 3 are quite large, but they include a pretty extensive set


   
of unit tests for the framework bits, since it's hoped that they're 


   
generic enough that other generators could use them.


   



   
This series exposes a bug in mesa, it can be seen by the fact that in a 


   
couple of cases the vert and frag disabled tests fail, and the other


   
stages pass in the enabled tests. 

Changes since v1:
- add a template for testing that when an extension isn't available 


   
  it cannot be included. (Ilia)  

Changes since v2:
- extend the minimum version helper to distinguish between minimum
  version per stage in core and with extension. This simplifies the
  generator, and fixes a bug in v1 were ES shaders would require desktop
  extensions inst

[Piglit] [PATCH v3 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
This replaces a large number of handrolled tests (and adds many new
ones) for testing that preprocessor defines are exposed correctly
(either exposed if the extension is enabled, or not if it's disabled)
across all shader stages. It tests for support in legacy (non
core/compat) mode and in profile mode, unless the extension itself
requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
and cs), and both GLES and GL.

It drives all of this from a simple, easily extended list in the
generator, and replaces over 1000 lines of code with about 300,
including the template files, and generates nearly 2000 tests currently.
These are GLSL parser tests and don't take more than a few seconds to
run.

The only known issue is that an extension can not currently be tested in
both GLES and OpenGL.

Signed-off-by: Dylan Baker 
---

There are some spelling errors in the docstrings, I've fixed those
locally.

 generated_tests/CMakeLists.txt |   8 +
 generated_tests/gen_extensions_defined.py  | 192 +
 .../gen_extensions_defined/disabled.glsl.mako  |  40 +
 .../gen_extensions_defined/enabled.glsl.mako   |  43 +
 .../undefined-require.glsl.mako|  37 
 tests/all.py   |   1 -
 tests/shaders/CMakeLists.gl.txt|   1 -
 .../glsl-arb-fragment-coord-conventions-define.c   |  83 -
 ...glsl-arb-fragment-coord-conventions-define.frag |  10 --
 .../amd_shader_trinary_minmax/compiler/define.frag |  19 --
 .../amd_shader_trinary_minmax/compiler/define.vert |  19 --
 .../arb_derivative_control/compiler/define.frag|  29 
 .../compiler/instanceidarb-disabled.frag   |  25 ---
 .../compiler/instanceidarb-disabled.vert   |  25 ---
 .../compiler/instanceidarb-enabled.frag|  24 ---
 .../compiler/instanceidarb-enabled.vert|  24 ---
 .../preprocessor/feature-macro-disabled.frag   |  12 --
 .../preprocessor/feature-macro-disabled.vert   |  12 --
 .../preprocessor/feature-macro-enabled.frag|  15 --
 .../preprocessor/feature-macro-enabled.vert|  15 --
 .../spec/arb_enhanced_layouts/compiler/define.frag |  19 --
 .../spec/arb_enhanced_layouts/compiler/define.vert |  19 --
 .../1.10/preprocessor/define.frag  |  19 --
 .../1.10/preprocessor/define.vert  |  19 --
 .../1.20/preprocessor/define.frag  |  19 --
 .../1.20/preprocessor/define.vert  |  19 --
 .../1.30/preprocessor/define-130.frag  |  19 --
 .../1.30/preprocessor/define-130.vert  |  19 --
 .../preprocessor/define.frag   |  20 ---
 .../preprocessor/define.vert   |  20 ---
 .../arb_gpu_shader_fp64/preprocessor/define.frag   |  19 --
 .../arb_gpu_shader_fp64/preprocessor/define.vert   |  19 --
 .../compiler/1.10/define.frag  |  18 --
 .../compiler/1.10/define.vert  |  18 --
 .../compiler/1.20/define.frag  |  18 --
 .../compiler/1.20/define.vert  |  18 --
 .../compiler/1.30/define.frag  |  18 --
 .../compiler/1.30/define.vert  |  18 --
 .../compiler/1.40/define.frag  |  18 --
 .../compiler/1.40/define.vert  |  18 --
 .../compiler/1.50/define.frag  |  18 --
 .../compiler/1.50/define.geom  |  18 --
 .../compiler/1.50/define.vert  |  18 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../compiler/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../arb_shader_subroutine/preprocessor/define.vert |  19 --
 .../arb_tessellation_shader/compiler/define.tesc   |  19 --
 .../arb_tessellation_shader/compiler/define.tese   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../glsl-1.10/preprocessor/define.frag |  19 --
 .../glsl-1.10/preprocessor/define.vert |  19 --
 .../glsl-1.50/preprocessor/define.geom |  18 --
 .../glsl-es-3.10/preprocessor/define.frag  |  19 --
 .../glsl-es-3.10/preprocessor/define.vert  |  19 --
 62 files changed, 320 insertions(+), 1102 deletions(-)
 create mode 100644 generated_tests/gen_extensions_defined.py
 create mode 100644 
generated_tests/templates/gen_extensions_defined/disabled.glsl.mako
 create mode 100644 
generated_tests/templates/gen_

[Piglit] [PATCH v3 1/4] CMakeLists.txt: install compute shaders in generated_tests

2016-04-12 Thread Dylan Baker
Files ending in '.comp', which is used for compute shader extensions of
GLSLparsertests were not installed. This is obviously problematic.

Signed-off-by: Dylan Baker 
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b9f5f3..8e2abba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -518,7 +518,7 @@ install (
 install (
DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX 
".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|cl|txt)$"
+   FILES_MATCHING REGEX 
".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|comp|cl|txt)$"
REGEX "CMakeFiles|CMakeLists" EXCLUDE
 )
 
-- 
2.8.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v3 3/4] generators: Add a minimum version helper.

2016-04-12 Thread Dylan Baker
This adds another GLSL related helper, a factory for getting minimum
versions based on stages. This is able to sort all of the stages for
both OpenGL and OpenGL ES.

Signed-off-by: Dylan Baker 
---
 generated_tests/modules/glsl.py   | 126 +++
 unittests/generators/test_glsl.py | 174 ++
 2 files changed, 300 insertions(+)

diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py
index 85de920..f42bec4 100644
--- a/generated_tests/modules/glsl.py
+++ b/generated_tests/modules/glsl.py
@@ -209,3 +209,129 @@ class GLSLESVersion(object):
 return '{:.2f}'.format(float(self))
 else:
 return '{:.2f} es'.format(float(self))
+
+
+class _MinVersion(object):
+"""A factory class for sorting GLSL and GLSLES versions.
+
+This stores the minimum version required for various operations (currently
+only for_stage and for_stage_with_ext).
+
+This class is not meant to be reinitialized, instead use the provided
+MinVersion constant.
+
+"""
+__gl_stage_min = {
+'frag': Version('110'),
+'vert': Version('110'),
+'geom': Version('150'),
+'tesc': Version('400'),
+'tese': Version('400'),
+'comp': Version('430'),
+}
+# Only versions that actaly change are here, the function will return the
+# values from __gl_stage_min if they're not here
+__gl_stage_min_ext = {
+# geometry_shader4 is not included here intentionally. It is
+# significantly different than the geometry shaders in OpenGL 3.2
+'tesc': (Version('140'), 'GL_ARB_tesselation_shader'),
+'tese': (Version('140'), 'GL_ARB_tesselation_shader'),
+'comp': (Version('140'), 'GL_ARB_compute_shader'),
+}
+__gles_stage_min = {
+'frag': Version('100'),
+'vert': Version('100'),
+'comp': Version('310 es'),
+'geom': Version('320 es'),
+'tesc': Version('320 es'),
+'tese': Version('320 es'),
+}
+# Only versions that actaly change are here, the function will return the
+# values from __gles_stage_min if they're not here
+__gles_stage_min_ext = {
+'geom': (Version('310 es'), 'GL_OES_geometry_shader'),
+'tesc': (Version('310 es'), 'GL_OES_tesselation_shader'),
+'tese': (Version('310 es'), 'GL_OES_tesselation_shader'),
+}
+
+def for_stage(self, stage, version):
+"""Return max(stage minimum version, requested version).
+
+When provided a stage and a version, it will return the greater of the
+provided version and the minimum version of that stage without an
+extension. For example, in OpenGL teselation is available in GLSL
+4.00+, or in 1.40+ with ARB_tesselation_shader. Given Version('150')
+and 'tesc' this method returns Version('400').
+
+Arguments:
+stage -- A stage named by the extensions glslparsertest uses (frag,
+ vert, geom, tesc, tese, comp)
+version -- A version as returned by the Version function.
+
+>>> m = _MinVersion()
+>>> m.for_stage('geom', Version('300 es'))
+Version('320 es')
+>>> m.for_stage('frag', Version('130'))
+Version('130')
+
+"""
+assert isinstance(version, (GLSLVersion, GLSLESVersion))
+if isinstance(version, GLSLVersion):
+_stage = self.__gl_stage_min[stage]
+elif isinstance(version, GLSLESVersion):
+_stage = self.__gles_stage_min[stage]
+
+return _stage if _stage > version else version
+
+def for_stage_with_ext(self, stage, version):
+"""Return the earliest GLSL version that a stage is supported in with
+an extension.
+
+When provided a stage and a version, it will return the greater of the
+provided version and the minimum version of that stage with an
+extension, and if necissary the extension as a string. For example, in
+OpenGL teselation is available in GLSL 4.00+, or in 1.40+ with
+ARB_tesselation_shader. Given Version('150') and 'tesc' this method
+returns (Version('150'), 'GL_ARB_tesselation_shader'); but given
+Version('400') and 'tesc' it returns (Version('400'), None)
+
+If there is no extension (like with fragment and vertex) then None will
+be returned as the secon value. It is up to the caller to handle this
+appropriately. It will also return None for the extension when the GLSL
+version is high enough to not require an extension.
+
+Takes the same arguments as for_stage.
+
+>>> m = _MinVersion()
+>>> m.for_stage_with_ext('geom', Version('300 es'))
+(Version('310 es'), 'GL_OES_geometry_shader')
+>>> m.for_stage_with_ext('frag', Version('130'))
+(Version('130'), None)
+
+"""
+assert isinstance(version, (GLSLVersion, GLSLESVersion))
+if isinstan

[Piglit] [PATCH v3 2/4] generators: Add helper classes for GLSL version numbers

2016-04-12 Thread Dylan Baker
This adds a new module in the generated_tests/modules directory, which
contains three classes, GLSLVersion, GLSLESVersion, and Version. Version
is a factory that caches other versions and makes GLSLVersion and
GLSLESVersion instances on demand.

The goal of these classes is to provide a simple, unified method for
dealing with GLSL version numbers, which is something that a lot of
generators need to do. To that end it provides rich comparisons against
each other and against ints and floats. The hope is that other generator
writers could leverage this work in their generators to simplify things.

Signed-off-by: Dylan Baker 
---
 generated_tests/modules/__init__.py|   8 +
 generated_tests/modules/glsl.py| 211 +++
 tox.ini|   4 +-
 .../modules => unittests/generators}/__init__.py   |   0
 unittests/generators/test_glsl.py  | 299 +
 5 files changed, 520 insertions(+), 2 deletions(-)
 create mode 100644 generated_tests/modules/glsl.py
 copy {generated_tests/modules => unittests/generators}/__init__.py (100%)
 create mode 100644 unittests/generators/test_glsl.py

diff --git a/generated_tests/modules/__init__.py 
b/generated_tests/modules/__init__.py
index e69de29..11e926b 100644
--- a/generated_tests/modules/__init__.py
+++ b/generated_tests/modules/__init__.py
@@ -0,0 +1,8 @@
+import importlib
+import os
+import sys
+
+sys.path.insert(0, os.path.abspath(
+os.path.join(os.path.dirname(__file__), '..', '..', 'framework')))
+
+importlib.import_module('compat')
diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py
new file mode 100644
index 000..85de920
--- /dev/null
+++ b/generated_tests/modules/glsl.py
@@ -0,0 +1,211 @@
+# encoding=utf-8
+# Copyright © 2016 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Provides helper classes for representing glsl data."""
+
+from __future__ import (
+absolute_import, division, print_function, unicode_literals
+)
+import functools
+
+import six
+
+import compat
+
+__all__ = [
+'GLSLESVersion',
+'GLSLVersion',
+'Version',
+]
+
+
+class _Version(object):
+"""Factory class for glsl versions.
+
+provides an object cache to reduce duplication of objects. This object
+should not be initialized more than once, to avoid that use the Version
+constant provided by the module.
+
+It would provide either a GLSLVersion or a GLSLESVersion.
+
+"""
+_es_versions = [
+'100',
+'300 es',
+'310 es',
+'320 es',
+]
+
+_versions = [
+'110',
+'120',
+'130',
+'140',
+'150',
+'330',
+'400',
+'410',
+'420',
+'430',
+'440',
+'450',
+]
+
+def __init__(self):
+self.__cache = {}
+
+def __call__(self, ver):
+"""Make a Version object, or provide one from the cache."""
+assert isinstance(ver, six.text_type)
+
+# Try to get an object from the cache, if that fails create a new one
+# and add it to the cache before returning it.
+try:
+return self.__cache[ver]
+except KeyError:
+if ver in self._es_versions:
+obj = GLSLESVersion(ver)
+elif ver in self._versions:
+obj = GLSLVersion(ver)
+else:
+raise Exception('Undefined version {}'.format(ver))
+
+self.__cache[ver] = obj
+return obj
+
+
+Version = _Version()  # pylint: disable=invalid-name
+
+
+@compat.python_2_unicode_compatible  # pylint: disable=no-member
+@functools.total_ordering
+class GLSLVersion(object):
+"""A Representation of an OpenGL Shading Language version.
+
+This object provides a bunch of the niceties that one would want. It's
+orderable (can be sorted, and can be compared with the standard 

[Piglit] [PATCH] gl-1.1: Add a new test for large vertex counts.

2016-04-12 Thread Eric Anholt
There's a limitation on VC4 where it can only handle 65536 verts at a
time in a glDrawArrays(), so the driver needs to split up the calls.
This tests that path for all the primitive types.
---
 tests/all.py|   5 +
 tests/spec/gl-1.1/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.1/drawarrays-vertex-count.c | 457 
 3 files changed, 463 insertions(+)
 create mode 100644 tests/spec/gl-1.1/drawarrays-vertex-count.c

diff --git a/tests/all.py b/tests/all.py
index 2f55b37fd1e3..418a0092050e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -950,6 +950,11 @@ with profile.group_manager(
 g(['getteximage-targets', '1D'])
 g(['getteximage-targets', '2D'])
 g(['teximage-scale-bias'])
+for prim in ['GL_POINTS', 'GL_LINE_LOOP', 'GL_LINE_STRIP', 'GL_LINES',
+ 'GL_TRIANGLES', 'GL_TRIANGLE_STRIP', 'GL_TRIANGLE_FAN',
+ 'GL_QUADS', 'GL_QUAD_STRIP', 'GL_POLYGON']:
+for mode in ['varray', 'vbo']:
+g(['gl-1.1-drawarrays-vertex-count', '10', mode, prim])
 add_msaa_visual_plain_tests(g, ['draw-pixels'], run_concurrent=False)
 add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
 add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
diff --git a/tests/spec/gl-1.1/CMakeLists.gl.txt 
b/tests/spec/gl-1.1/CMakeLists.gl.txt
index 300e6fd9b3db..35d97ee7c469 100644
--- a/tests/spec/gl-1.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.1/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (gl-1.1-drawarrays-vertex-count 
drawarrays-vertex-count.c)
 piglit_add_executable (gl-1.1-xor xor.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.1/drawarrays-vertex-count.c 
b/tests/spec/gl-1.1/drawarrays-vertex-count.c
new file mode 100644
index ..cce53820ddd8
--- /dev/null
+++ b/tests/spec/gl-1.1/drawarrays-vertex-count.c
@@ -0,0 +1,457 @@
+/*
+ * Copyright © 2016 Broadcom Limited
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+
+/** @file drawarrays-vertex-count.c
+ *
+ * Tests glDrawArrays with large vertex counts and a start vertex
+ * offset.  Catches a limitation of the vc4 hardware where
+ * glDrawArrays() with a large count ends up truncating the high 16
+ * bits of vertex indices.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLenum primtype;
+static unsigned int count;
+static bool use_vbo;
+
+static const float green[4] = {0.0, 1.0, 0.0, 0.0};
+static const float black[4] = {0.0, 0.0, 0.0, 0.0};
+static const float red[4] =   {1.0, 0.0, 0.0, 0.0};
+
+static int v_from_end(int count, int prims, int primsize)
+{
+   int v = count - prims * primsize;
+   return v - v % primsize;
+}
+
+/* Probes for a green filled rectangle in the screen, surrounded by black. */
+static bool
+probe_rect(int x, int y, int w, int h)
+{
+   return (piglit_probe_rect_rgba(x, y, w, h, green) &&
+   piglit_probe_rect_rgba(0, 0, piglit_width, y, black) &&
+   piglit_probe_rect_rgba(0, y, x, h, black) &&
+   piglit_probe_rect_rgba(x + w, y,
+  piglit_width - (x + w), h, black) &&
+   piglit_probe_rect_rgba(0, y + h,
+  piglit_width, piglit_height - (y + h),
+  black));
+}
+
+/* Probes for a green outlined rectangle in the screen, surrounded by black. */
+static bool
+probe_line_rect(int x1, int y1, int x2, int y2)
+{
+   int probe_w = x2 - x1 - 2;
+   int probe_h = y2 - y1 - 2;
+
+   /* Note that GL line rasterization may not include the endpoints.  */
+   return (/* rect */
+   piglit_pro

Re: [Piglit] [PATCH 4/4 v2] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 6:15 PM, Dylan Baker  wrote:
> Quoting Ilia Mirkin (2016-04-12 13:37:12)
>> On Tue, Apr 12, 2016 at 4:25 PM, Dylan Baker  wrote:
>> > This replaces a large number of handrolled tests (and adds many new
>> > ones) for testing that preprocessor defines are exposed correctly
>> > (either exposed if the extension is enabled, or not if it's disabled)
>> > across all shader stages. It tests for support in legacy (non
>> > core/compat) mode and in profile mode, unless the extension itself
>> > requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
>> > and cs), and both GLES and GL.
>> >
>> > It drives all of this from a simple, easily extended list in the
>> > generator, and replaces over 1000 lines of code with about 300,
>> > including the template files, and generates nearly 2000 tests currently.
>> > These are GLSL parser tests and don't take more than a few seconds to
>> > run.
>> >
>> > The only known issue is that an extension can not currently be tested in
>> > both GLES and OpenGL.
>> >
>> > Signed-off-by: Dylan Baker 
>> > ---
>> >
>> > v2: - add a template for testing that when an extension isn't available
>> >   it cannot be included. (Ilia)
>> >
>> > +from __future__ import (
>> > +absolute_import, division, print_function, unicode_literals
>> > +)
>> > +import os
>> > +
>> > +from templates import template_dir
>> > +from modules import utils, glsl
>> > +
>> > +_TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
>> > +ENABLED_TEMPLATE = _TEMPLATES.get_template('enabled.glsl.mako')
>> > +DISABLED_TEMPLATE = _TEMPLATES.get_template('disabled.glsl.mako')
>> > +UNDEFINED_TEMPLATE = 
>> > _TEMPLATES.get_template('undefined-require.glsl.mako')
>> > +
>> > +# A list of tuples with the full preprocess defined name, and the minimum
>> > +# supported version of that extension.
>> > +EXTENSIONS = [
>> > +("GL_ARB_draw_instanced", "110"),
>> > +("GL_ARB_draw_buffers", "110"),
>> > +("GL_ARB_enhanced_layouts", "140"),
>> > +("GL_ARB_separate_shader_objects", "110"),
>> > +("GL_ARB_texture_rectangle", "110"),
>> > +("GL_AMD_shader_trinary_minmax", "110"),
>> > +("GL_EXT_texture_array", "110"),
>> > +("GL_ARB_ES3_1_compatibility", "110"),
>> > +("GL_ARB_arrays_of_arrays", "110"),
>> > +("GL_ARB_fragment_coord_conventions", "110"),
>> > +("GL_ARB_fragment_layer_viewport", "110"),
>> > +("GL_ARB_explicit_attrib_location", "110"),
>> > +("GL_ARB_explicit_uniform_location", "110"),
>> > +("GL_ARB_shader_texture_lod", "110"),
>> > +("GL_AMD_conservative_depth", "110"),
>> > +("GL_ARB_conservative_depth", "110"),
>> > +("GL_ARB_shader_bit_encodign", "110"),
>> > +("GL_ARB_shader_clock", "110"),
>> > +("GL_ARB_uniform_buffer_object", "110"),
>> > +("GL_ARB_texture_cube_map_array", "110"),
>> > +("GL_ARB_shading_language_packing", "110"),
>> > +("GL_ARB_texture_multisample", "110"),
>> > +("GL_ARB_texture_query_levels", "110"),
>> > +("GL_ARB_texture_query_lod", "110"),
>> > +("GL_ARB_gpu_shader5", "110"),
>> > +("GL_ARB_gpu_shader_fp64", "150"),
>> > +("GL_ARB_vertex_attrib_64bit", "150"),
>> > +("GL_AMD_vertex_shader_layer", "110"),
>> > +("GL_AMD_vertex_shader_viewport_index", "110"),
>> > +("GL_ARB_shading_language_420pack", "110"),
>> > +("GL_ARB_sample_shading", "110"),
>> > +("GL_ARB_texture_gather", "110"),
>> > +("GL_ARB_shader_atomic_counters", "110"),
>> > +("GL_ARB_shader_atomic_counter_ops", "140"),
>> > +("GL_ARB_viewport_array", "110"),
>> > +("GL_ARB_compute_shader", "110"),
>> > +("GL_ARB_shader_image_load_store", "110"),
>> > +("GL_ARB_shader_image_size", "110"),
>> > +("GL_ARB_shader_texture_image_samples", "110"),
>> > +# That is what the original hand written test required.
>> > +("GL_ARB_derivative_control", "150"),
>> > +("GL_ARB_shader_precision", "110"),
>> > +("GL_ARB_shader_storage_buffer_object", "110"),
>> > +("GL_ARB_tessellation_shader", "150"),
>> > +("GL_ARB_shader_subroutine", "150"),
>> > +("GL_ARB_shader_draw_parameters", "140"),
>> > +("GL_EXT_separate_shader_objects", "100"),
>> > +("GL_EXT_draw_buffers", "100"),
>> > +("GL_AMD_shader_stencil_export", "120"),
>> > +("GL_ARB_shader_stencil_export", "120"),
>> > +("GL_ARB_geometry_shader4", "110"),
>> > +("GL_OES_EGL_image_external", "100"),
>> > +("GL_EXT_shader_samples_identical", "110"),
>> > +("GL_EXT_shader_samples_identical", "310 es"),
>> > +("GL_OES_sample_variables", "300 es"),
>> > +("GL_OES_multisample_interpolation", "300 es"),
>> > +("GL_OES_standard_derivatives", "100"),
>> > +("GL_OES_texture_storage_multisample_2d_array", "300 es"),
>> > +("GL_OES_blend_func_extended", "100"),
>> > +("GL_OES_shader_image_atomic", "310 es"),
>> > +("GL_OES_geometry_shader", "310 es"),
>> > +("GL_OES_geometry_point_size", "310

Re: [Piglit] [PATCH 4/4 v2] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
Quoting Ilia Mirkin (2016-04-12 13:37:12)
> On Tue, Apr 12, 2016 at 4:25 PM, Dylan Baker  wrote:
> > This replaces a large number of handrolled tests (and adds many new
> > ones) for testing that preprocessor defines are exposed correctly
> > (either exposed if the extension is enabled, or not if it's disabled)
> > across all shader stages. It tests for support in legacy (non
> > core/compat) mode and in profile mode, unless the extension itself
> > requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
> > and cs), and both GLES and GL.
> >
> > It drives all of this from a simple, easily extended list in the
> > generator, and replaces over 1000 lines of code with about 300,
> > including the template files, and generates nearly 2000 tests currently.
> > These are GLSL parser tests and don't take more than a few seconds to
> > run.
> >
> > The only known issue is that an extension can not currently be tested in
> > both GLES and OpenGL.
> >
> > Signed-off-by: Dylan Baker 
> > ---
> >
> > v2: - add a template for testing that when an extension isn't available
> >   it cannot be included. (Ilia)
> >
> > +from __future__ import (
> > +absolute_import, division, print_function, unicode_literals
> > +)
> > +import os
> > +
> > +from templates import template_dir
> > +from modules import utils, glsl
> > +
> > +_TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
> > +ENABLED_TEMPLATE = _TEMPLATES.get_template('enabled.glsl.mako')
> > +DISABLED_TEMPLATE = _TEMPLATES.get_template('disabled.glsl.mako')
> > +UNDEFINED_TEMPLATE = _TEMPLATES.get_template('undefined-require.glsl.mako')
> > +
> > +# A list of tuples with the full preprocess defined name, and the minimum
> > +# supported version of that extension.
> > +EXTENSIONS = [
> > +("GL_ARB_draw_instanced", "110"),
> > +("GL_ARB_draw_buffers", "110"),
> > +("GL_ARB_enhanced_layouts", "140"),
> > +("GL_ARB_separate_shader_objects", "110"),
> > +("GL_ARB_texture_rectangle", "110"),
> > +("GL_AMD_shader_trinary_minmax", "110"),
> > +("GL_EXT_texture_array", "110"),
> > +("GL_ARB_ES3_1_compatibility", "110"),
> > +("GL_ARB_arrays_of_arrays", "110"),
> > +("GL_ARB_fragment_coord_conventions", "110"),
> > +("GL_ARB_fragment_layer_viewport", "110"),
> > +("GL_ARB_explicit_attrib_location", "110"),
> > +("GL_ARB_explicit_uniform_location", "110"),
> > +("GL_ARB_shader_texture_lod", "110"),
> > +("GL_AMD_conservative_depth", "110"),
> > +("GL_ARB_conservative_depth", "110"),
> > +("GL_ARB_shader_bit_encodign", "110"),
> > +("GL_ARB_shader_clock", "110"),
> > +("GL_ARB_uniform_buffer_object", "110"),
> > +("GL_ARB_texture_cube_map_array", "110"),
> > +("GL_ARB_shading_language_packing", "110"),
> > +("GL_ARB_texture_multisample", "110"),
> > +("GL_ARB_texture_query_levels", "110"),
> > +("GL_ARB_texture_query_lod", "110"),
> > +("GL_ARB_gpu_shader5", "110"),
> > +("GL_ARB_gpu_shader_fp64", "150"),
> > +("GL_ARB_vertex_attrib_64bit", "150"),
> > +("GL_AMD_vertex_shader_layer", "110"),
> > +("GL_AMD_vertex_shader_viewport_index", "110"),
> > +("GL_ARB_shading_language_420pack", "110"),
> > +("GL_ARB_sample_shading", "110"),
> > +("GL_ARB_texture_gather", "110"),
> > +("GL_ARB_shader_atomic_counters", "110"),
> > +("GL_ARB_shader_atomic_counter_ops", "140"),
> > +("GL_ARB_viewport_array", "110"),
> > +("GL_ARB_compute_shader", "110"),
> > +("GL_ARB_shader_image_load_store", "110"),
> > +("GL_ARB_shader_image_size", "110"),
> > +("GL_ARB_shader_texture_image_samples", "110"),
> > +# That is what the original hand written test required.
> > +("GL_ARB_derivative_control", "150"),
> > +("GL_ARB_shader_precision", "110"),
> > +("GL_ARB_shader_storage_buffer_object", "110"),
> > +("GL_ARB_tessellation_shader", "150"),
> > +("GL_ARB_shader_subroutine", "150"),
> > +("GL_ARB_shader_draw_parameters", "140"),
> > +("GL_EXT_separate_shader_objects", "100"),
> > +("GL_EXT_draw_buffers", "100"),
> > +("GL_AMD_shader_stencil_export", "120"),
> > +("GL_ARB_shader_stencil_export", "120"),
> > +("GL_ARB_geometry_shader4", "110"),
> > +("GL_OES_EGL_image_external", "100"),
> > +("GL_EXT_shader_samples_identical", "110"),
> > +("GL_EXT_shader_samples_identical", "310 es"),
> > +("GL_OES_sample_variables", "300 es"),
> > +("GL_OES_multisample_interpolation", "300 es"),
> > +("GL_OES_standard_derivatives", "100"),
> > +("GL_OES_texture_storage_multisample_2d_array", "300 es"),
> > +("GL_OES_blend_func_extended", "100"),
> > +("GL_OES_shader_image_atomic", "310 es"),
> > +("GL_OES_geometry_shader", "310 es"),
> > +("GL_OES_geometry_point_size", "310 es"),
> > +("GL_EXT_gpu_shader5", "310 es"),
> > +("GL_OES_gpu_shader5", "310 es"),
> > +("GL_EXT_texture_buffer", "310 es"),
> > +("GL_OES_textur

Re: [Piglit] [PATCH 4/4 v2] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 4:25 PM, Dylan Baker  wrote:
> This replaces a large number of handrolled tests (and adds many new
> ones) for testing that preprocessor defines are exposed correctly
> (either exposed if the extension is enabled, or not if it's disabled)
> across all shader stages. It tests for support in legacy (non
> core/compat) mode and in profile mode, unless the extension itself
> requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
> and cs), and both GLES and GL.
>
> It drives all of this from a simple, easily extended list in the
> generator, and replaces over 1000 lines of code with about 300,
> including the template files, and generates nearly 2000 tests currently.
> These are GLSL parser tests and don't take more than a few seconds to
> run.
>
> The only known issue is that an extension can not currently be tested in
> both GLES and OpenGL.
>
> Signed-off-by: Dylan Baker 
> ---
>
> v2: - add a template for testing that when an extension isn't available
>   it cannot be included. (Ilia)
>
> +from __future__ import (
> +absolute_import, division, print_function, unicode_literals
> +)
> +import os
> +
> +from templates import template_dir
> +from modules import utils, glsl
> +
> +_TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
> +ENABLED_TEMPLATE = _TEMPLATES.get_template('enabled.glsl.mako')
> +DISABLED_TEMPLATE = _TEMPLATES.get_template('disabled.glsl.mako')
> +UNDEFINED_TEMPLATE = _TEMPLATES.get_template('undefined-require.glsl.mako')
> +
> +# A list of tuples with the full preprocess defined name, and the minimum
> +# supported version of that extension.
> +EXTENSIONS = [
> +("GL_ARB_draw_instanced", "110"),
> +("GL_ARB_draw_buffers", "110"),
> +("GL_ARB_enhanced_layouts", "140"),
> +("GL_ARB_separate_shader_objects", "110"),
> +("GL_ARB_texture_rectangle", "110"),
> +("GL_AMD_shader_trinary_minmax", "110"),
> +("GL_EXT_texture_array", "110"),
> +("GL_ARB_ES3_1_compatibility", "110"),
> +("GL_ARB_arrays_of_arrays", "110"),
> +("GL_ARB_fragment_coord_conventions", "110"),
> +("GL_ARB_fragment_layer_viewport", "110"),
> +("GL_ARB_explicit_attrib_location", "110"),
> +("GL_ARB_explicit_uniform_location", "110"),
> +("GL_ARB_shader_texture_lod", "110"),
> +("GL_AMD_conservative_depth", "110"),
> +("GL_ARB_conservative_depth", "110"),
> +("GL_ARB_shader_bit_encodign", "110"),
> +("GL_ARB_shader_clock", "110"),
> +("GL_ARB_uniform_buffer_object", "110"),
> +("GL_ARB_texture_cube_map_array", "110"),
> +("GL_ARB_shading_language_packing", "110"),
> +("GL_ARB_texture_multisample", "110"),
> +("GL_ARB_texture_query_levels", "110"),
> +("GL_ARB_texture_query_lod", "110"),
> +("GL_ARB_gpu_shader5", "110"),
> +("GL_ARB_gpu_shader_fp64", "150"),
> +("GL_ARB_vertex_attrib_64bit", "150"),
> +("GL_AMD_vertex_shader_layer", "110"),
> +("GL_AMD_vertex_shader_viewport_index", "110"),
> +("GL_ARB_shading_language_420pack", "110"),
> +("GL_ARB_sample_shading", "110"),
> +("GL_ARB_texture_gather", "110"),
> +("GL_ARB_shader_atomic_counters", "110"),
> +("GL_ARB_shader_atomic_counter_ops", "140"),
> +("GL_ARB_viewport_array", "110"),
> +("GL_ARB_compute_shader", "110"),
> +("GL_ARB_shader_image_load_store", "110"),
> +("GL_ARB_shader_image_size", "110"),
> +("GL_ARB_shader_texture_image_samples", "110"),
> +# That is what the original hand written test required.
> +("GL_ARB_derivative_control", "150"),
> +("GL_ARB_shader_precision", "110"),
> +("GL_ARB_shader_storage_buffer_object", "110"),
> +("GL_ARB_tessellation_shader", "150"),
> +("GL_ARB_shader_subroutine", "150"),
> +("GL_ARB_shader_draw_parameters", "140"),
> +("GL_EXT_separate_shader_objects", "100"),
> +("GL_EXT_draw_buffers", "100"),
> +("GL_AMD_shader_stencil_export", "120"),
> +("GL_ARB_shader_stencil_export", "120"),
> +("GL_ARB_geometry_shader4", "110"),
> +("GL_OES_EGL_image_external", "100"),
> +("GL_EXT_shader_samples_identical", "110"),
> +("GL_EXT_shader_samples_identical", "310 es"),
> +("GL_OES_sample_variables", "300 es"),
> +("GL_OES_multisample_interpolation", "300 es"),
> +("GL_OES_standard_derivatives", "100"),
> +("GL_OES_texture_storage_multisample_2d_array", "300 es"),
> +("GL_OES_blend_func_extended", "100"),
> +("GL_OES_shader_image_atomic", "310 es"),
> +("GL_OES_geometry_shader", "310 es"),
> +("GL_OES_geometry_point_size", "310 es"),
> +("GL_EXT_gpu_shader5", "310 es"),
> +("GL_OES_gpu_shader5", "310 es"),
> +("GL_EXT_texture_buffer", "310 es"),
> +("GL_OES_texture_buffer", "310 es"),
> +]
> +EXTENSIONS = [(n, glsl.Version(v)) for n, v in EXTENSIONS]
> +
> +_EXTRA_REQUIRES = {
> +'tesc': ['GL_ARB_tessellation_shader'],
> +'tese': ['GL_ARB_tessellation_shader'],
> +'comp': ['GL_ARB_compute_shader'],
> 

[Piglit] [PATCH 4/4 v2] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
This replaces a large number of handrolled tests (and adds many new
ones) for testing that preprocessor defines are exposed correctly
(either exposed if the extension is enabled, or not if it's disabled)
across all shader stages. It tests for support in legacy (non
core/compat) mode and in profile mode, unless the extension itself
requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
and cs), and both GLES and GL.

It drives all of this from a simple, easily extended list in the
generator, and replaces over 1000 lines of code with about 300,
including the template files, and generates nearly 2000 tests currently.
These are GLSL parser tests and don't take more than a few seconds to
run.

The only known issue is that an extension can not currently be tested in
both GLES and OpenGL.

Signed-off-by: Dylan Baker 
---

v2: - add a template for testing that when an extension isn't available
  it cannot be included. (Ilia)

 generated_tests/CMakeLists.txt |   8 +
 generated_tests/gen_extensions_defined.py  | 188 +
 .../gen_extensions_defined/disabled.glsl.mako  |  40 +
 .../gen_extensions_defined/enabled.glsl.mako   |  43 +
 .../undefined-require.glsl.mako|  17 ++
 tests/all.py   |   1 -
 tests/shaders/CMakeLists.gl.txt|   1 -
 .../glsl-arb-fragment-coord-conventions-define.c   |  83 -
 ...glsl-arb-fragment-coord-conventions-define.frag |  10 --
 .../amd_shader_trinary_minmax/compiler/define.frag |  19 ---
 .../amd_shader_trinary_minmax/compiler/define.vert |  19 ---
 .../arb_derivative_control/compiler/define.frag|  29 
 .../compiler/instanceidarb-disabled.frag   |  25 ---
 .../compiler/instanceidarb-disabled.vert   |  25 ---
 .../compiler/instanceidarb-enabled.frag|  24 ---
 .../compiler/instanceidarb-enabled.vert|  24 ---
 .../preprocessor/feature-macro-disabled.frag   |  12 --
 .../preprocessor/feature-macro-disabled.vert   |  12 --
 .../preprocessor/feature-macro-enabled.frag|  15 --
 .../preprocessor/feature-macro-enabled.vert|  15 --
 .../spec/arb_enhanced_layouts/compiler/define.frag |  19 ---
 .../spec/arb_enhanced_layouts/compiler/define.vert |  19 ---
 .../1.10/preprocessor/define.frag  |  19 ---
 .../1.10/preprocessor/define.vert  |  19 ---
 .../1.20/preprocessor/define.frag  |  19 ---
 .../1.20/preprocessor/define.vert  |  19 ---
 .../1.30/preprocessor/define-130.frag  |  19 ---
 .../1.30/preprocessor/define-130.vert  |  19 ---
 .../preprocessor/define.frag   |  20 ---
 .../preprocessor/define.vert   |  20 ---
 .../arb_gpu_shader_fp64/preprocessor/define.frag   |  19 ---
 .../arb_gpu_shader_fp64/preprocessor/define.vert   |  19 ---
 .../compiler/1.10/define.frag  |  18 --
 .../compiler/1.10/define.vert  |  18 --
 .../compiler/1.20/define.frag  |  18 --
 .../compiler/1.20/define.vert  |  18 --
 .../compiler/1.30/define.frag  |  18 --
 .../compiler/1.30/define.vert  |  18 --
 .../compiler/1.40/define.frag  |  18 --
 .../compiler/1.40/define.vert  |  18 --
 .../compiler/1.50/define.frag  |  18 --
 .../compiler/1.50/define.geom  |  18 --
 .../compiler/1.50/define.vert  |  18 --
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../compiler/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../arb_shader_subroutine/preprocessor/define.vert |  19 ---
 .../arb_tessellation_shader/compiler/define.tesc   |  19 ---
 .../arb_tessellation_shader/compiler/define.tese   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../glsl-1.10/preprocessor/define.frag |  19 ---
 .../glsl-1.10/preprocessor/define.vert |  19 ---
 .../glsl-1.50/preprocessor/define.geom |  18 --
 .../glsl-es-3.10/preprocessor/define.frag  |  19 ---
 .../glsl-es-3.10/preprocessor/define.vert  |  19 ---
 62 files changed, 296 insertions(+), 1102 deletions(-)
 create mode 100644 generated_tests/gen_extensions_defined.py
 create mode 100644 
generated_tests/templates/gen_extensions_defined/disabled.g

Re: [Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
Quoting Ilia Mirkin (2016-04-12 12:09:41)
> On Tue, Apr 12, 2016 at 3:07 PM, Dylan Baker  wrote:
> > Quoting Ilia Mirkin (2016-04-12 08:08:46)
> >> On Tue, Apr 12, 2016 at 3:49 AM, Dylan Baker  
> >> wrote:
> >> > +/* This is a generated test, do not edit
> >> > + * Generated by gen_extensions_defined.py
> >> > + *
> >> > + * [config]
> >> > + * expect_result: pass
> >> > + * glsl_version: ${version.print_float()}
> >> > + * require_extensions: !${extension} ${' '.join(extra_extensions)}
> >> > + * [end config]
> >> > + */
> >> > +
> >> > +#version ${str(version)}
> >> > +% for ext in extra_extensions:
> >> > +  #extension ${ext} : require
> >> > +% endfor
> >> > +
> >> > +#if defined ${extension}
> >> > +#error ${extension} is defined, but should not be
> >> > +#endif
> >> > +
> >> > +float foo() { return 0.0; }
> >>
> >> [Let's try again, with trimming... stupid phone.]
> >>
> >> This only tests for the extension being not defined. It doesn't test
> >> for one still being able to enable the functionality with
> >>
> >> #extension foo: require
> >
> > I'm going to ask a noob question here because I'm still trying to get my
> > head around all of this preprocessor stuff. That template should look
> > something like:
> >
> > // [config]
> > // expect_result: fail
> > // glsl_version ${version.print_float()}
> > // require_extensions: !${extension} ${' '.join(extra_extensions)}
> > // [end config]
> >
> > #version ${str(version)}
> > % for ext in extra_extensions:
> >   #extension ${ext} : require
> > % endfor
> > #extension ${extension} : require
> >
> > float foo() { return 0.0; }
> 
> That appears fine to me. Could be worth a test though :)
> 
> I'm not 100% sure under what situation you'd ever set the
> extra_extensions TBH, but... wtvr.

tesselation


signature.asc
Description: signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 3:07 PM, Dylan Baker  wrote:
> Quoting Ilia Mirkin (2016-04-12 08:08:46)
>> On Tue, Apr 12, 2016 at 3:49 AM, Dylan Baker  wrote:
>> > +/* This is a generated test, do not edit
>> > + * Generated by gen_extensions_defined.py
>> > + *
>> > + * [config]
>> > + * expect_result: pass
>> > + * glsl_version: ${version.print_float()}
>> > + * require_extensions: !${extension} ${' '.join(extra_extensions)}
>> > + * [end config]
>> > + */
>> > +
>> > +#version ${str(version)}
>> > +% for ext in extra_extensions:
>> > +  #extension ${ext} : require
>> > +% endfor
>> > +
>> > +#if defined ${extension}
>> > +#error ${extension} is defined, but should not be
>> > +#endif
>> > +
>> > +float foo() { return 0.0; }
>>
>> [Let's try again, with trimming... stupid phone.]
>>
>> This only tests for the extension being not defined. It doesn't test
>> for one still being able to enable the functionality with
>>
>> #extension foo: require
>
> I'm going to ask a noob question here because I'm still trying to get my
> head around all of this preprocessor stuff. That template should look
> something like:
>
> // [config]
> // expect_result: fail
> // glsl_version ${version.print_float()}
> // require_extensions: !${extension} ${' '.join(extra_extensions)}
> // [end config]
>
> #version ${str(version)}
> % for ext in extra_extensions:
>   #extension ${ext} : require
> % endfor
> #extension ${extension} : require
>
> float foo() { return 0.0; }

That appears fine to me. Could be worth a test though :)

I'm not 100% sure under what situation you'd ever set the
extra_extensions TBH, but... wtvr.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] arb_compute_shader: Test spilling with large block sizes.

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 2:59 PM, Dylan Baker  wrote:
> Quoting Bas Nieuwenhuizen (2016-04-12 01:14:51)
>> On Tue, Apr 12, 2016 at 9:34 AM, Dylan Baker  wrote:
>> > Quoting Bas Nieuwenhuizen (2016-04-11 06:45:29)
> [snip]
>> >> +   data = (int*)glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
>> >> +   for (i = 0; i < 1024; ++i)
>> >> +   if (data[i] != 2967)
>> >> +   result = false;
>> >
>> > Shouldn't you break here?
>>
>> Both should be okay: testing a few more elements after a failing
>> comparison still results in a fail.I can add the break if preferred
>> though.
>>
>> - Bas
>
> I'm thinking about piglit total runtime, stopping as soon as we know we
> failed should save a little bit of time, right?

Assuming the common case is that you *don't* fail, it won't make a
difference. Seeing all the failures can be quite convenient when
debugging.

  -ilia
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
Quoting Ilia Mirkin (2016-04-12 08:08:46)
> On Tue, Apr 12, 2016 at 3:49 AM, Dylan Baker  wrote:
> > +/* This is a generated test, do not edit
> > + * Generated by gen_extensions_defined.py
> > + *
> > + * [config]
> > + * expect_result: pass
> > + * glsl_version: ${version.print_float()}
> > + * require_extensions: !${extension} ${' '.join(extra_extensions)}
> > + * [end config]
> > + */
> > +
> > +#version ${str(version)}
> > +% for ext in extra_extensions:
> > +  #extension ${ext} : require
> > +% endfor
> > +
> > +#if defined ${extension}
> > +#error ${extension} is defined, but should not be
> > +#endif
> > +
> > +float foo() { return 0.0; }
> 
> [Let's try again, with trimming... stupid phone.]
> 
> This only tests for the extension being not defined. It doesn't test
> for one still being able to enable the functionality with
> 
> #extension foo: require

I'm going to ask a noob question here because I'm still trying to get my
head around all of this preprocessor stuff. That template should look
something like:

// [config]
// expect_result: fail
// glsl_version ${version.print_float()}
// require_extensions: !${extension} ${' '.join(extra_extensions)}
// [end config]

#version ${str(version)}
% for ext in extra_extensions:
  #extension ${ext} : require
% endfor
#extension ${extension} : require

float foo() { return 0.0; }

> 
> You should add a second disabled test which verifies that this errors
> out. (:enable and :warn will not error out if the ext isn't there).
> 
> Furthermore, if you want to be _really_ correct, various extensions
> have various version requirements. One should ensure that they go away
> when the #version goes too low. That may be excessive though.

That wouldn't be too hard to add, but it does seem a little excessive.
I'll spin a v2 with the extra test.

> 
>   -ilia


signature.asc
Description: signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] arb_compute_shader: Test spilling with large block sizes.

2016-04-12 Thread Dylan Baker
Quoting Bas Nieuwenhuizen (2016-04-12 01:14:51)
> On Tue, Apr 12, 2016 at 9:34 AM, Dylan Baker  wrote:
> > Quoting Bas Nieuwenhuizen (2016-04-11 06:45:29)
[snip]
> >> +   data = (int*)glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
> >> +   for (i = 0; i < 1024; ++i)
> >> +   if (data[i] != 2967)
> >> +   result = false;
> >
> > Shouldn't you break here?
> 
> Both should be okay: testing a few more elements after a failing
> comparison still results in a fail.I can add the break if preferred
> though.
> 
> - Bas

I'm thinking about piglit total runtime, stopping as soon as we know we
failed should save a little bit of time, right?

Dylan

> >> +
> >> +   glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
> >> +
> >> +   glDeleteProgram(prog);
> >> +   glDeleteBuffers(1, &buffer);
> >> +
> >> +   piglit_report_result(result ? PIGLIT_PASS : PIGLIT_FAIL);
> >> +}
> >> --
> >> 2.8.0
> >>
> >> ___
> >> Piglit mailing list
> >> Piglit@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/piglit


signature.asc
Description: signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Ilia Mirkin
On Tue, Apr 12, 2016 at 3:49 AM, Dylan Baker  wrote:
> +/* This is a generated test, do not edit
> + * Generated by gen_extensions_defined.py
> + *
> + * [config]
> + * expect_result: pass
> + * glsl_version: ${version.print_float()}
> + * require_extensions: !${extension} ${' '.join(extra_extensions)}
> + * [end config]
> + */
> +
> +#version ${str(version)}
> +% for ext in extra_extensions:
> +  #extension ${ext} : require
> +% endfor
> +
> +#if defined ${extension}
> +#error ${extension} is defined, but should not be
> +#endif
> +
> +float foo() { return 0.0; }

[Let's try again, with trimming... stupid phone.]

This only tests for the extension being not defined. It doesn't test
for one still being able to enable the functionality with

#extension foo: require

You should add a second disabled test which verifies that this errors
out. (:enable and :warn will not error out if the ext isn't there).

Furthermore, if you want to be _really_ correct, various extensions
have various version requirements. One should ensure that they go away
when the #version goes too low. That may be excessive though.

  -ilia
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/3] arb_compute_shader: Test compute shader synchronization.

2016-04-12 Thread Nicolai Hähnle

From a quick skim, the tests look good to me.

However, for the synchronization/barrier one, I'd appreciate if you'd 
add a "sanity check" mode similar to the barrier tests for shader 
images. That is, a mode in which the barriers *aren't* emitted, so that 
one can easily see whether/how the tests really do require the barriers.


Cheers,
Nicolai

On 11.04.2016 08:45, Bas Nieuwenhuizen wrote:

Signed-off-by: Bas Nieuwenhuizen 
---
  tests/all.py|   1 +
  tests/spec/arb_compute_shader/CMakeLists.gl.txt |   1 +
  tests/spec/arb_compute_shader/synchronization.c | 658 
  3 files changed, 660 insertions(+)
  create mode 100644 tests/spec/arb_compute_shader/synchronization.c

diff --git a/tests/all.py b/tests/all.py
index 72c540c..ca1f319 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4256,6 +4256,7 @@ with profile.group_manager(
  g(['arb_compute_shader-zero-dispatch-size'], 'zero-dispatch-size')
  g(['arb_compute_shader-conditional-dispatch'], 'conditional-dispatch')
  g(['arb_compute_shader-large-block-size'], 'large-block-size')
+g(['arb_compute_shader-synchronization'], 'synchronization')

  with profile.group_manager(
  PiglitGLTest,
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index a264626..8932941 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -20,5 +20,6 @@ piglit_add_executable (arb_compute_shader-render-and-compute 
render-and-compute.
  piglit_add_executable (arb_compute_shader-zero-dispatch-size 
zero-dispatch-size.c ${depends})
  piglit_add_executable (arb_compute_shader-conditional-dispatch 
conditional-dispatch.c)
  piglit_add_executable (arb_compute_shader-large-block-size large-block-size.c)
+piglit_add_executable (arb_compute_shader-synchronization synchronization.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/synchronization.c 
b/tests/spec/arb_compute_shader/synchronization.c
new file mode 100644
index 000..43dda95
--- /dev/null
+++ b/tests/spec/arb_compute_shader/synchronization.c
@@ -0,0 +1,658 @@
+/*
+ * Copyright 2016 Bas Nieuwenhuizen
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/*
+ * Tests whether reads and writes are synchronized properly for compute 
shaders.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_version = 42;
+
+   config.window_width = 320;
+   config.window_height = 320;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+const char *compute_ssbo_write_source =
+   "#version 420\n"
+   "#extension GL_ARB_compute_shader : require\n"
+   "#extension GL_ARB_shader_storage_buffer_object : require\n"
+   "layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;\n"
+   "layout(binding = 1, std430) buffer Out {\n"
+   "  int out_arr[];\n"
+   "};\n"
+   "uniform int value;\n"
+   "void main() {\n"
+   "  out_arr[gl_GlobalInvocationID.x] = value;\n"
+   "}\n";
+
+const char *compute_ssbo_copy_source =
+   "#version 420\n"
+   "#extension GL_ARB_compute_shader : require\n"
+   "#extension GL_ARB_shader_storage_buffer_object : require\n"
+   "layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;\n"
+   "layout(binding = 0, std430) buffer In {\n"
+   "  int in_arr[];\n"
+   "};\n"
+   "layout(binding = 1, std430) buffer Out {\n"
+   "  int out_arr[];\n"
+   "};\n"
+   "void main() {\n"
+   "  out_arr[gl_GlobalInvocationID.x] =\n"
+   "  in_arr[gl_GlobalInvocationID.x];\n"
+   "}\n";
+
+const char *compute_image_write_source =
+   "#version 420\n"
+   "#extension GL_ARB_compute_shader : require\n"
+   "layout (local_size_x = 16, loc

Re: [Piglit] [PATCH 2/3] arb_compute_shader: Test spilling with large block sizes.

2016-04-12 Thread Bas Nieuwenhuizen
On Tue, Apr 12, 2016 at 9:34 AM, Dylan Baker  wrote:
> Quoting Bas Nieuwenhuizen (2016-04-11 06:45:29)
>> Signed-off-by: Bas Nieuwenhuizen 
>> ---
>>  tests/all.py |   1 +
>>  tests/spec/arb_compute_shader/CMakeLists.gl.txt  |   1 +
>>  tests/spec/arb_compute_shader/large-block-size.c | 106 
>> +++
>>  3 files changed, 108 insertions(+)
>>  create mode 100644 tests/spec/arb_compute_shader/large-block-size.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index da1c257..72c540c 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -4255,6 +4255,7 @@ with profile.group_manager(
>>  g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
>>  g(['arb_compute_shader-zero-dispatch-size'], 'zero-dispatch-size')
>>  g(['arb_compute_shader-conditional-dispatch'], 'conditional-dispatch')
>> +g(['arb_compute_shader-large-block-size'], 'large-block-size')
>>
>>  with profile.group_manager(
>>  PiglitGLTest,
>> diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
>> b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
>> index 02ede80..a264626 100644
>> --- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
>> @@ -19,5 +19,6 @@ piglit_add_executable (arb_compute_shader-local-id 
>> local-id.c ${depends})
>>  piglit_add_executable (arb_compute_shader-render-and-compute 
>> render-and-compute.c ${depends})
>>  piglit_add_executable (arb_compute_shader-zero-dispatch-size 
>> zero-dispatch-size.c ${depends})
>>  piglit_add_executable (arb_compute_shader-conditional-dispatch 
>> conditional-dispatch.c)
>> +piglit_add_executable (arb_compute_shader-large-block-size 
>> large-block-size.c)
>>
>>  # vim: ft=cmake:
>> diff --git a/tests/spec/arb_compute_shader/large-block-size.c 
>> b/tests/spec/arb_compute_shader/large-block-size.c
>> new file mode 100644
>> index 000..e34c440
>> --- /dev/null
>> +++ b/tests/spec/arb_compute_shader/large-block-size.c
>> @@ -0,0 +1,106 @@
>> +/*
>> + * Copyright 2016 Bas Nieuwenhuizen
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the 
>> "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
>> OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
>> OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
>> DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +/*
>> + * Tests that shaders with large numbers of variables can still be used with
>> + * large blocks. The result has two parts: it should not hang / show VM 
>> faults
>> + * and it should give the right solution.
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +   config.supports_gl_core_version = 42;
>> +
>> +   config.window_width = 320;
>> +   config.window_height = 320;
>> +   config.window_visual = PIGLIT_GL_VISUAL_RGB;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +const char *cs_source =
>> +   "#version 420\n"
>> +   "#extension GL_ARB_compute_shader : require\n"
>> +   "#extension GL_ARB_shader_storage_buffer_object : require\n"
>> +   "layout (local_size_x = 1024, local_size_y = 1, local_size_z = 1) 
>> in;\n"
>> +   "layout(binding = 0, std430) buffer Result {\n"
>> +   "   int result[1024];\n"
>> +   "};\n"
>> +   "uniform int a, b, c;\n"
>> +   "void main() {\n"
>> +   "   int arr[65];\n"
>> +   "   arr[0] = a;\n"
>> +   "   for(int i = 1; i < 65; ++i)\n"
>> +   "   arr[i] = (arr[i - 1] * a + b) % c;\n"
>> +   "   for(int i = 63; i >= 0; --i)\n"
>> +   "   arr[i] = (arr[i + 1] * a + b) % c;\n"
>> +   "   result[gl_GlobalInvocationID.x] = arr[0];\n"
>> +   "}\n";
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +   return PIGLIT_FAIL;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +   unsigned shader, prog, buffer;
>> +   int *data;
>> +   int i;
>> +   bool result = true;
>> +
>> +   piglit_require_gl_version(42);
>> +

[Piglit] [PATCH 2/4] generators: Add helper classes for GLSL version numbers

2016-04-12 Thread Dylan Baker
This adds a new module in the generated_tests/modules directory, which
contains three classes, GLSLVersion, GLSLESVersion, and Version. Version
is a factory that caches other versions and makes GLSLVersion and
GLSLESVersion instances on demand.

The goal of these classes is to provide a simple, unified method for
dealing with GLSL version numbers, which is something that a lot of
generators need to do. To that end it provides rich comparisons against
each other and against ints and floats. The hope is that other generator
writers could leverage this work in their generators to simplify things.

Signed-off-by: Dylan Baker 
---
 generated_tests/modules/__init__.py|   8 +
 generated_tests/modules/glsl.py| 211 +++
 tox.ini|   4 +-
 .../modules => unittests/generators}/__init__.py   |   0
 unittests/generators/test_glsl.py  | 299 +
 5 files changed, 520 insertions(+), 2 deletions(-)
 create mode 100644 generated_tests/modules/glsl.py
 copy {generated_tests/modules => unittests/generators}/__init__.py (100%)
 create mode 100644 unittests/generators/test_glsl.py

diff --git a/generated_tests/modules/__init__.py 
b/generated_tests/modules/__init__.py
index e69de29..11e926b 100644
--- a/generated_tests/modules/__init__.py
+++ b/generated_tests/modules/__init__.py
@@ -0,0 +1,8 @@
+import importlib
+import os
+import sys
+
+sys.path.insert(0, os.path.abspath(
+os.path.join(os.path.dirname(__file__), '..', '..', 'framework')))
+
+importlib.import_module('compat')
diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py
new file mode 100644
index 000..251537a
--- /dev/null
+++ b/generated_tests/modules/glsl.py
@@ -0,0 +1,211 @@
+# encoding=utf-8
+# Copyright © 2016 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Provides helper classes for representing glsl data."""
+
+from __future__ import (
+absolute_import, division, print_function, unicode_literals
+)
+import functools
+
+import six
+
+import compat
+
+__all__ = [
+'GLSLESVersion',
+'GLSLVersion',
+'Version',
+]
+
+
+class _Version(object):
+"""Factory class for glsl versions.
+
+provides an object cache to reduce duplication of objects. This object
+should not be initialized more than once, to avoid that use the Version
+constant provided by the module.
+
+It would provide either a GLSLVersion or a GLSLESVersion.
+
+"""
+_es_versions = [
+'100',
+'300 es',
+'310 es',
+'320 es',
+]
+
+_versions = [
+'110',
+'120',
+'130',
+'140',
+'150',
+'330',
+'400',
+'410',
+'420',
+'430',
+'440',
+'450',
+]
+
+def __init__(self):
+self.__cache = {}
+
+def __call__(self, ver):
+"""Make a Version object, or provide one from the cache."""
+assert isinstance(ver, six.text_type)
+
+# Try to get an object from the cache, if that fails create a new one
+# and add it to the cache before returning it.
+try:
+return self.__cache[ver]
+except KeyError:
+if ver in self._es_versions:
+obj = GLSLESVersion(ver)
+elif ver in self._versions:
+obj = GLSLVersion(ver)
+else:
+raise Exception('Undefined version {}'.format(ver))
+
+self.__cache[ver] = obj
+return obj
+
+
+Version = _Version()  # pylint: disable=invalid-name
+
+
+@compat.python_2_unicode_compatible
+@functools.total_ordering
+class GLSLVersion(object):
+"""A Representation of an OpenGL Shading Language version.
+
+This object provides a bunch of the niceties that one would want. It's
+orderable (can be sorted, and can be compared with the standard ==, !=, <,
+etc), can be 

[Piglit] [PATCH 0/4] Add a generator for testing GLSL defines

2016-04-12 Thread Dylan Baker
This series adds a generator for testing preprocessor defines in GLSL.
IT generates both tests for defines that should be available, and those
that should not. If the driver implements an extension the 'enabled'
tests will run and the 'disabled' will skip, if the driver does not
implement an extension then the opposite will happen.

The first patch is a bug fix for the installer, the seoncd two patches
add some generic framework to help make writing generators easier. the
final patch adds the generator, and deletes tests that it replaces.

Patches 2 and 3 are quite large, but they include a pretty extensive set
of unit tests for the framework bits, since it's hoped that they're
generic enough that other generators could use them.

This series exposes a bug in mesa, it can be seen by the fact that in a
couple of cases the vert and frag disabled tests fail, and the other
stages pass in the enabled tests.

Dylan Baker (4):
  CMakeLists.txt: install compute shaders in generated_tests
  generators: Add helper classes for GLSL version numbers
  generators: Add a minimum version helper.
  generators: Add a simple generator for enabled and disabled defines

 CMakeLists.txt |   2 +-
 generated_tests/CMakeLists.txt |   7 +
 generated_tests/gen_extensions_defined.py  | 183 ++
 generated_tests/modules/__init__.py|   8 +
 generated_tests/modules/glsl.py| 259 ++
 .../gen_extensions_defined/disabled.glsl.mako  |  40 +++
 .../gen_extensions_defined/enabled.glsl.mako   |  43 +++
 tests/all.py   |   1 -
 tests/shaders/CMakeLists.gl.txt|   1 -
 .../glsl-arb-fragment-coord-conventions-define.c   |  83 -
 ...glsl-arb-fragment-coord-conventions-define.frag |  10 -
 .../amd_shader_trinary_minmax/compiler/define.frag |  19 --
 .../amd_shader_trinary_minmax/compiler/define.vert |  19 --
 .../compiler/instanceidarb-disabled.frag   |  25 --
 .../compiler/instanceidarb-disabled.vert   |  25 --
 .../compiler/instanceidarb-enabled.frag|  24 --
 .../compiler/instanceidarb-enabled.vert|  24 --
 .../preprocessor/feature-macro-disabled.frag   |  12 -
 .../preprocessor/feature-macro-disabled.vert   |  12 -
 .../preprocessor/feature-macro-enabled.frag|  15 -
 .../preprocessor/feature-macro-enabled.vert|  15 -
 .../spec/arb_enhanced_layouts/compiler/define.frag |  19 --
 .../spec/arb_enhanced_layouts/compiler/define.vert |  19 --
 .../1.10/preprocessor/define.frag  |  19 --
 .../1.10/preprocessor/define.vert  |  19 --
 .../1.20/preprocessor/define.frag  |  19 --
 .../1.20/preprocessor/define.vert  |  19 --
 .../1.30/preprocessor/define-130.frag  |  19 --
 .../1.30/preprocessor/define-130.vert  |  19 --
 .../preprocessor/define.frag   |  20 --
 .../preprocessor/define.vert   |  20 --
 .../arb_gpu_shader_fp64/preprocessor/define.frag   |  19 --
 .../arb_gpu_shader_fp64/preprocessor/define.vert   |  19 --
 .../compiler/1.10/define.frag  |  18 -
 .../compiler/1.10/define.vert  |  18 -
 .../compiler/1.20/define.frag  |  18 -
 .../compiler/1.20/define.vert  |  18 -
 .../compiler/1.30/define.frag  |  18 -
 .../compiler/1.30/define.vert  |  18 -
 .../compiler/1.40/define.frag  |  18 -
 .../compiler/1.40/define.vert  |  18 -
 .../compiler/1.50/define.frag  |  18 -
 .../compiler/1.50/define.geom  |  18 -
 .../compiler/1.50/define.vert  |  18 -
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../compiler/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../arb_shader_subroutine/preprocessor/define.vert |  19 --
 .../arb_tessellation_shader/compiler/define.tesc   |  19 --
 .../arb_tessellation_shader/compiler/define.tese   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../preprocessor/define.frag   |  19 --
 .../preprocessor/define.vert   |  19 --
 .../glsl-1.10/preprocessor/define.frag |  19 --
 .../glsl-1.10/preprocessor/define.vert |  19 --
 .../glsl-1.50/preprocessor/define.geom |  18 -
 .../glsl-es-3.10/preprocessor/define.frag  |  19 --
 .../glsl-es-3.10/preprocessor/define.vert   

[Piglit] [PATCH 3/4] generators: Add a minimum version helper.

2016-04-12 Thread Dylan Baker
This adds another GLSL related helper, a factory for getting minimum
versions based on stages. This is able to sort all of the stages for
both OpenGL and OpenGL ES.

Signed-off-by: Dylan Baker 
---
 generated_tests/modules/glsl.py   | 48 
 unittests/generators/test_glsl.py | 78 +++
 2 files changed, 126 insertions(+)

diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py
index 251537a..458dc47 100644
--- a/generated_tests/modules/glsl.py
+++ b/generated_tests/modules/glsl.py
@@ -209,3 +209,51 @@ class GLSLESVersion(object):
 return '{:.2f}'.format(float(self))
 else:
 return '{:.2f} es'.format(float(self))
+
+
+class _MinVersion(object):
+"""A factory class for sorting GLSL and GLSLES versions.
+
+This stores the minimum version required for various operations (currently
+only for_stage), and will take the version, and the any additional 
features,
+and return the minimum supported version. It returns a GLSLVersion or a
+GLSLESVersion.
+
+This class is not meant to be reinitialized, instead use the provided
+MinVersion constant.
+
+"""
+__gl_stage_min = {
+'frag': Version('110'),
+'vert': Version('110'),
+'geom': Version('150'),
+'tesc': Version('140'),
+'tese': Version('140'),
+'comp': Version('140'),
+}
+__gles_stage_min = {
+'frag': Version('100'),
+'vert': Version('100'),
+'comp': Version('310 es'),
+'geom': Version('320 es'),
+'tesc': Version('320 es'),
+'tese': Version('320 es'),
+}
+
+def for_stage(self, stage, version):
+"""Return max(stage minimum version, requested version).
+
+When provided a stage and version provides the minimum version
+supported for that stage.
+
+"""
+assert isinstance(version, (GLSLVersion, GLSLESVersion))
+if isinstance(version, GLSLVersion):
+_stage = self.__gl_stage_min[stage]
+elif isinstance(version, GLSLESVersion):
+_stage = self.__gles_stage_min[stage]
+
+return _stage if _stage > version else version
+
+
+MinVersion = _MinVersion()  # pylint: disable=invalid-name
diff --git a/unittests/generators/test_glsl.py 
b/unittests/generators/test_glsl.py
index eabb600..0072db5 100644
--- a/unittests/generators/test_glsl.py
+++ b/unittests/generators/test_glsl.py
@@ -297,3 +297,81 @@ def test_GLSLESVersion_print_float():
 def test_GLSLESVersion_print_float_es():
 """generated_tests.modules.glsl.GLSLESVersion: print_float() (es 
version)"""
 nt.eq_(glsl.Version('300 es').print_float(), '3.00 es')
+
+
+class TestMinVersion_for_stage(object):
+"""Tests for generated_tests.modules.glsl.MinVersion.for_stage.
+
+Each test covers the requested < required and requested == required. If
+it's possible it also covers requested > required.
+
+"""
+def _test(self, stage, version, expected):
+nt.eq_(glsl.MinVersion.for_stage(stage, version), expected,
+   msg='(actual) {} != (expected) {}'.format(
+   str(version), str(expected)))
+
+def test_opengl_frag(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: FS (OpenGL)"""
+self._test('frag', glsl.Version('150'), glsl.Version('150'))
+self._test('frag', glsl.Version('110'), glsl.Version('110'))
+
+def test_opengl_vert(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: VS (OpenGL)"""
+self._test('vert', glsl.Version('150'), glsl.Version('150'))
+self._test('vert', glsl.Version('110'), glsl.Version('110'))
+
+def test_opengl_geom(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: GS (OpenGL)"""
+self._test('geom', glsl.Version('330'), glsl.Version('330'))
+self._test('geom', glsl.Version('110'), glsl.Version('150'))
+self._test('geom', glsl.Version('150'), glsl.Version('150'))
+
+def test_opengl_tesc(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: TCS (OpenGL)"""
+self._test('tesc', glsl.Version('330'), glsl.Version('330'))
+self._test('tesc', glsl.Version('110'), glsl.Version('140'))
+self._test('tesc', glsl.Version('140'), glsl.Version('140'))
+
+def test_opengl_tese(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: TES (OpenGL)"""
+self._test('tese', glsl.Version('330'), glsl.Version('330'))
+self._test('tese', glsl.Version('110'), glsl.Version('140'))
+self._test('tese', glsl.Version('140'), glsl.Version('140'))
+
+def test_opengl_comp(self):
+"""generated_tests.modules.glsl.MinVersion.for_stage: TES (OpenGL)"""
+self._test('comp', glsl.Version('330'), glsl.Version('330'))
+self._test('comp', glsl.Version('110'), glsl.Version('140'))
+self._test('comp', glsl.Version('140'), gls

[Piglit] [PATCH 1/4] CMakeLists.txt: install compute shaders in generated_tests

2016-04-12 Thread Dylan Baker
Files ending in '.comp', which is used for compute shader extensions of
GLSLparsertests were not installed. This is obviously problematic.

Signed-off-by: Dylan Baker 
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b9f5f3..8e2abba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -518,7 +518,7 @@ install (
 install (
DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX 
".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|cl|txt)$"
+   FILES_MATCHING REGEX 
".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|comp|cl|txt)$"
REGEX "CMakeFiles|CMakeLists" EXCLUDE
 )
 
-- 
2.8.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

2016-04-12 Thread Dylan Baker
This replaces a large number of handrolled tests (and adds many new
ones) for testing that preprocessor defines are exposed correctly
(either exposed if the extension is enabled, or not if it's disabled)
across all shader stages. It tests for support in legacy (non
core/compat) mode and in profile mode, unless the extension itself
requires GLSL >= 140. It also covers all stages (fs, vs, gs, tcs, tes,
and cs), and both GLES and GL.

It drives all of this from a simple, easily extended list in the
generator, and replaces over 1000 lines of code with about 300,
including the template files, and generates over 1000 tests currently.
These are GLSL parser tests and don't take more than a few seconds to
run.

The only known issue is that an extension can not currently be tested in
both GLES and OpenGL.

Signed-off-by: Dylan Baker 
---
 generated_tests/CMakeLists.txt |   7 +
 generated_tests/gen_extensions_defined.py  | 183 +
 .../gen_extensions_defined/disabled.glsl.mako  |  40 +
 .../gen_extensions_defined/enabled.glsl.mako   |  43 +
 tests/all.py   |   1 -
 tests/shaders/CMakeLists.gl.txt|   1 -
 .../glsl-arb-fragment-coord-conventions-define.c   |  83 --
 ...glsl-arb-fragment-coord-conventions-define.frag |  10 --
 .../amd_shader_trinary_minmax/compiler/define.frag |  19 ---
 .../amd_shader_trinary_minmax/compiler/define.vert |  19 ---
 .../compiler/instanceidarb-disabled.frag   |  25 ---
 .../compiler/instanceidarb-disabled.vert   |  25 ---
 .../compiler/instanceidarb-enabled.frag|  24 ---
 .../compiler/instanceidarb-enabled.vert|  24 ---
 .../preprocessor/feature-macro-disabled.frag   |  12 --
 .../preprocessor/feature-macro-disabled.vert   |  12 --
 .../preprocessor/feature-macro-enabled.frag|  15 --
 .../preprocessor/feature-macro-enabled.vert|  15 --
 .../spec/arb_enhanced_layouts/compiler/define.frag |  19 ---
 .../spec/arb_enhanced_layouts/compiler/define.vert |  19 ---
 .../1.10/preprocessor/define.frag  |  19 ---
 .../1.10/preprocessor/define.vert  |  19 ---
 .../1.20/preprocessor/define.frag  |  19 ---
 .../1.20/preprocessor/define.vert  |  19 ---
 .../1.30/preprocessor/define-130.frag  |  19 ---
 .../1.30/preprocessor/define-130.vert  |  19 ---
 .../preprocessor/define.frag   |  20 ---
 .../preprocessor/define.vert   |  20 ---
 .../arb_gpu_shader_fp64/preprocessor/define.frag   |  19 ---
 .../arb_gpu_shader_fp64/preprocessor/define.vert   |  19 ---
 .../compiler/1.10/define.frag  |  18 --
 .../compiler/1.10/define.vert  |  18 --
 .../compiler/1.20/define.frag  |  18 --
 .../compiler/1.20/define.vert  |  18 --
 .../compiler/1.30/define.frag  |  18 --
 .../compiler/1.30/define.vert  |  18 --
 .../compiler/1.40/define.frag  |  18 --
 .../compiler/1.40/define.vert  |  18 --
 .../compiler/1.50/define.frag  |  18 --
 .../compiler/1.50/define.geom  |  18 --
 .../compiler/1.50/define.vert  |  18 --
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../compiler/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../arb_shader_subroutine/preprocessor/define.vert |  19 ---
 .../arb_tessellation_shader/compiler/define.tesc   |  19 ---
 .../arb_tessellation_shader/compiler/define.tese   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../preprocessor/define.frag   |  19 ---
 .../preprocessor/define.vert   |  19 ---
 .../glsl-1.10/preprocessor/define.frag |  19 ---
 .../glsl-1.10/preprocessor/define.vert |  19 ---
 .../glsl-1.50/preprocessor/define.geom |  18 --
 .../glsl-es-3.10/preprocessor/define.frag  |  19 ---
 .../glsl-es-3.10/preprocessor/define.vert  |  19 ---
 60 files changed, 273 insertions(+), 1073 deletions(-)
 create mode 100644 generated_tests/gen_extensions_defined.py
 create mode 100644 
generated_tests/templates/gen_extensions_defined/disabled.glsl.mako
 create mode 100644 
generated_tests/templates/gen_extensions_defined/enabled.glsl.mako
 delete mode 100644 tests/shaders/glsl-arb-fragment-coord-conventions-define.c
 delete mode 100644 
tests/shaders/glsl-arb-fragment-coord-

Re: [Piglit] [PATCH 2/3] arb_compute_shader: Test spilling with large block sizes.

2016-04-12 Thread Dylan Baker
Quoting Bas Nieuwenhuizen (2016-04-11 06:45:29)
> Signed-off-by: Bas Nieuwenhuizen 
> ---
>  tests/all.py |   1 +
>  tests/spec/arb_compute_shader/CMakeLists.gl.txt  |   1 +
>  tests/spec/arb_compute_shader/large-block-size.c | 106 
> +++
>  3 files changed, 108 insertions(+)
>  create mode 100644 tests/spec/arb_compute_shader/large-block-size.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index da1c257..72c540c 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4255,6 +4255,7 @@ with profile.group_manager(
>  g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
>  g(['arb_compute_shader-zero-dispatch-size'], 'zero-dispatch-size')
>  g(['arb_compute_shader-conditional-dispatch'], 'conditional-dispatch')
> +g(['arb_compute_shader-large-block-size'], 'large-block-size')
>  
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
> b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
> index 02ede80..a264626 100644
> --- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
> +++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
> @@ -19,5 +19,6 @@ piglit_add_executable (arb_compute_shader-local-id 
> local-id.c ${depends})
>  piglit_add_executable (arb_compute_shader-render-and-compute 
> render-and-compute.c ${depends})
>  piglit_add_executable (arb_compute_shader-zero-dispatch-size 
> zero-dispatch-size.c ${depends})
>  piglit_add_executable (arb_compute_shader-conditional-dispatch 
> conditional-dispatch.c)
> +piglit_add_executable (arb_compute_shader-large-block-size 
> large-block-size.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_compute_shader/large-block-size.c 
> b/tests/spec/arb_compute_shader/large-block-size.c
> new file mode 100644
> index 000..e34c440
> --- /dev/null
> +++ b/tests/spec/arb_compute_shader/large-block-size.c
> @@ -0,0 +1,106 @@
> +/*
> + * Copyright 2016 Bas Nieuwenhuizen
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +/*
> + * Tests that shaders with large numbers of variables can still be used with
> + * large blocks. The result has two parts: it should not hang / show VM 
> faults
> + * and it should give the right solution.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_core_version = 42;
> +
> +   config.window_width = 320;
> +   config.window_height = 320;
> +   config.window_visual = PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *cs_source =
> +   "#version 420\n"
> +   "#extension GL_ARB_compute_shader : require\n"
> +   "#extension GL_ARB_shader_storage_buffer_object : require\n"
> +   "layout (local_size_x = 1024, local_size_y = 1, local_size_z = 1) 
> in;\n"
> +   "layout(binding = 0, std430) buffer Result {\n"
> +   "   int result[1024];\n"
> +   "};\n"
> +   "uniform int a, b, c;\n"
> +   "void main() {\n"
> +   "   int arr[65];\n"
> +   "   arr[0] = a;\n"
> +   "   for(int i = 1; i < 65; ++i)\n"
> +   "   arr[i] = (arr[i - 1] * a + b) % c;\n"
> +   "   for(int i = 63; i >= 0; --i)\n"
> +   "   arr[i] = (arr[i + 1] * a + b) % c;\n"
> +   "   result[gl_GlobalInvocationID.x] = arr[0];\n"
> +   "}\n";
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +   return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +   unsigned shader, prog, buffer;
> +   int *data;
> +   int i;
> +   bool result = true;
> +
> +   piglit_require_gl_version(42);
> +   piglit_require_extension("GL_ARB_compute_shader");
> +   piglit_require_extension("GL_ARB_shader_storage_buffer_object");
> +
> +   shader = piglit_compile_shader_text(GL_