[Piglit] [PATCH V3 6/7] tests/spec: ARB_arrays_of_arrays redeclaration and subroutine tests

2014-01-07 Thread Timothy Arceri
Signed-off-by: Timothy Arceri 
---
 .../compiler/redeclaration-initializer.vert| 31 ++
 .../compiler/redeclaration-too-small.vert  | 29 +
 .../compiler/redeclaration-too-small2.vert | 23 ++
 .../compiler/redeclaration.vert| 29 +
 .../compiler/redeclaration2.vert   | 29 +
 .../arb_arrays_of_arrays/compiler/subroutine.vert  | 37 ++
 6 files changed, 178 insertions(+)
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert

diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
new file mode 100644
index 000..8108cd0
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "It is legal to declare an array without a size and then later
+ * re-declare the same name as an array of the same type and specify a
+ * size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[3][2]);
+
+void main()
+{
+  float [][2] an_array;
+
+  an_array[0][1] = 0.0;
+  an_array[1][1] = 1.0;
+  an_array[2][0] = 2.0;
+
+  float [][2] an_array = float[][2](float[2](0.0, 1.0),
+float[2](0.0, 1.0),
+float[2](0.0, 1.0));
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
new file mode 100644
index 000..deebdb3
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "It is legal to declare an array without a size and then later
+ * re-declare the same name as an array of the same type and specify a
+ * size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[2][3]);
+
+void main()
+{
+  float [][3] an_array;
+
+  an_array[0][2] = 0.0;
+  an_array[1][2] = 1.0;
+  an_array[2][2] = 2.0;
+
+  float [2][3] an_array;
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
new file mode 100644
index 000..14a78a2
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
@@ -0,0 +1,23 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float x[][2];
+
+void foo() { x[3][1] = 2.; }
+
+// The left most array must be at least 4 elements because of
+// the previous access to x[3][1].
+float x[][2] = float[][2](float[2](1., 2.),
+  float[2](1., 2.));
+
+void main()
+{
+   foo();
+   gl_Position = vec4(x[0][0]);
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
new file mode 100644
index 000..57bf467
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "It is legal to declare an array without a size and then later
+ * re-declare the same name as an array of the same type and specify a
+ * size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[3][3]);
+
+void main()
+{
+  float [][3] an_array;
+
+  an_array[0][2] = 0.0;
+  an_array[1][2] = 1.0;
+  an_array[2][2] = 2.0;
+
+  float [3][3] an_array;
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert
new file mo

[Piglit] [PATCH V3 1/7] tests/spec: ARB_arrays_of_arrays initializer and constructor tests

2014-01-07 Thread Timothy Arceri
Signed-off-by: Timothy Arceri 
---
 tests/all.tests   |  7 +++
 .../compiler/constructor-array-array-var.vert | 17 +
 .../compiler/constructor-array-var-array.vert | 17 +
 .../compiler/constructor-invalid.vert | 17 +
 .../compiler/constructor-invalid2.vert| 16 
 .../compiler/constructor-var-array-array.vert | 17 +
 .../compiler/initialization-invalid.vert  | 17 +
 .../compiler/initialization-invalid2.vert | 19 +++
 .../compiler/initialization-invalid3.vert | 19 +++
 .../compiler/initialization-invalid4.vert | 19 +++
 .../compiler/initializer-array-array-var.vert | 19 +++
 .../compiler/initializer-array-array-var2.vert| 19 +++
 .../compiler/initializer-array-var-array.vert | 19 +++
 .../compiler/initializer-array-var-array2.vert| 19 +++
 .../compiler/initializer-var-array-array.vert | 19 +++
 .../compiler/initializer-var-array-array2.vert| 19 +++
 16 files changed, 279 insertions(+)
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/constructor-array-array-var.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/constructor-array-var-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/constructor-invalid.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/constructor-invalid2.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/constructor-var-array-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initialization-invalid.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initialization-invalid2.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initialization-invalid3.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initialization-invalid4.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-array-array-var.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-array-array-var2.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-array-var-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-array-var-array2.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-var-array-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/initializer-var-array-array2.vert

diff --git a/tests/all.tests b/tests/all.tests
index edf066b..bc2314b 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1065,6 +1065,13 @@ import_glsl_parser_tests(spec['AMD_conservative_depth'],
 os.path.join(testsDir, 'spec', 
'amd_conservative_depth'),
 [''])
 
+# Group ARB_arrays_of_arrays
+arb_arrays_of_arrays = Group()
+spec['ARB_arrays_of_arrays'] = arb_arrays_of_arrays
+import_glsl_parser_tests(arb_arrays_of_arrays,
+os.path.join(testsDir, 'spec', 'arb_arrays_of_arrays'),
+['compiler'])
+
 # Group ARB_point_sprite
 arb_point_sprite = Group()
 spec['ARB_point_sprite'] = arb_point_sprite
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-array-var.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-array-var.vert
new file mode 100644
index 000..5b88054
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-array-var.vert
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+void main()
+{
+  vec4[3][2] a = vec4[3][2](vec4[2](vec4(0.0), vec4(1.0)),
+vec4[2](vec4(0.0), vec4(1.0)),
+vec4[2](vec4(0.0), vec4(1.0)));
+
+  gl_Position = a[2][1];
+}
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-var-array.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-var-array.vert
new file mode 100644
index 000..03fd090
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/constructor-array-var-array.vert
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+void main()
+{
+  vec4[2] a[3] = vec4[3][2](vec4[2](vec4(0.0), vec4(1.0)),
+vec4[2](vec4(0.0), vec4(1.0)),
+vec4[2](vec4(0.0), vec4(1.0)));
+
+  gl_Position = a[2][1];
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/constructor-invalid.vert 
b/tests/spec/arb_

[Piglit] [PATCH V3 4/7] tests/spec: ARB_arrays_of_arrays interface and struct tests

2014-01-07 Thread Timothy Arceri
Signed-off-by: Timothy Arceri 
---
 .../arrays-of-struct-with-field-arrays.vert| 29 ++
 .../compiler/interface-field-array-array-var.vert  | 18 ++
 .../compiler/interface-field-array-var-array.vert  | 18 ++
 ...ce-field-maxbounds-access-array-array-var .geom | 18 ++
 ...ace-field-maxbounds-access-array-var-array.geom | 18 ++
 ...ace-field-maxbounds-access-var-array-array.geom | 18 ++
 ...e-field-outofbounds-access-array-array-var.geom | 18 ++
 ...e-field-outofbounds-access-array-var-array.geom | 18 ++
 ...e-field-outofbounds-access-var-array-array.geom | 18 ++
 .../compiler/interface-field-var-array-array.vert  | 18 ++
 .../compiler/interface-maxbounds.vert  | 18 ++
 .../compiler/interface-outofbounds.vert| 18 ++
 .../arb_arrays_of_arrays/compiler/interface.vert   | 18 ++
 .../compiler/structure-field-array-array-var.frag  | 19 ++
 .../compiler/structure-field-array-var-array.frag  | 19 ++
 .../compiler/structure-field-var-array-array.frag  | 19 ++
 16 files changed, 302 insertions(+)
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/arrays-of-struct-with-field-arrays.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-array-var.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-var-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-maxbounds-access-array-array-var
 .geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-maxbounds-access-array-var-array.geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-maxbounds-access-var-array-array.geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-outofbounds-access-array-array-var.geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-outofbounds-access-array-var-array.geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-outofbounds-access-var-array-array.geom
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-field-var-array-array.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-maxbounds.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/interface-outofbounds.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/interface.vert
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/structure-field-array-array-var.frag
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/structure-field-array-var-array.frag
 create mode 100644 
tests/spec/arb_arrays_of_arrays/compiler/structure-field-var-array-array.frag

diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/arrays-of-struct-with-field-arrays.vert
 
b/tests/spec/arb_arrays_of_arrays/compiler/arrays-of-struct-with-field-arrays.vert
new file mode 100644
index 000..f04568b
--- /dev/null
+++ 
b/tests/spec/arb_arrays_of_arrays/compiler/arrays-of-struct-with-field-arrays.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 18 (page 24 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "Member declarators can contain arrays.  Such arrays must have a size
+ * specified, and the size must be an integral constant expression that's
+ * greater than zero (see Section 4.3.3 "Constant Expressions")."
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "All basic types and structures can be formed into arrays."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+struct s {
+  float x[3][2];
+  int y;
+};
+
+void main()
+{
+  s a[2][4];
+  gl_Position = vec4(a.length() + a[0][0].x.length());
+}
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-array-var.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-array-var.vert
new file mode 100644
index 000..0ed922c
--- /dev/null
+++ 
b/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-array-var.vert
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+uniform ArraysOfArraysBlock
+{
+  vec4 [3][2]a;
+} i;
+
+void main()
+{
+  gl_Position = vec4(1.0);
+}
diff --git 
a/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-var-array.vert 
b/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-var-array.vert
new file mode 100644
index 000..5001dde
--- /dev/null
+++ 
b/tests/spec/arb_arrays_of_arrays/compiler/interface-field-array-var-array.vert
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_versio

Re: [Piglit] [PATCH 12/12] core.py: rewrie loadTestProfile to remove execfile()

2014-01-07 Thread Daniel Vetter
On Mon, Dec 23, 2013 at 04:51:49PM -0800, Dylan Baker wrote:
> This patch removes execfile, replaceing it with import instead.
> 
> This isn't a prefect solution, but it provides feature parity with the
> execfile() aproach, while being python3 safe.
> ---
>  framework/core.py | 22 --
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/framework/core.py b/framework/core.py
> index cd5c11d..6dacc7c 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -38,6 +38,7 @@ from textwrap import dedent
>  from threads import synchronized_self
>  import threading
>  import multiprocessing
> +import importlib
>  try:
>  import simplejson as json
>  except ImportError:
> @@ -632,13 +633,22 @@ class TestProfile:
>  
>  
>  def loadTestProfile(filename):
> -ns = {'__file__': filename}
> +""" Load a python module and return it's profile attribute
> +
> +All of the python test files provide a profile attribute which is a
> +TestProfile instance. This loads that module and returns it or raises an
> +error.
> +
> +"""
> +mod = importlib.import_module('tests.{0}'.format(
> +os.path.splitext(os.path.basename(filename))[0]))

My python-fu is mediocre, but this piece of magic seems to ensure that
scripts which call piglit with tests/foo.tests still work. And in the
future we can just use foo, which saves some typing ;-) Maybe mention this
somewhere in the docs/commit message?

Otherwise ack on the entire series but no r-b due to lack of python
skills.
-Daniel

> +
>  try:
> -execfile(filename, ns)
> -except:
> -traceback.print_exc()
> -raise Exception('Could not read tests profile')
> -return ns['profile']
> +return mod.profile
> +except AttributeError:
> +print("Error: There is not profile attribute in module {0}."
> +  "Did you specify the right file?".format(filename))
> +sys.exit(1)
>  
>  
>  def merge_test_profiles(profiles):
> -- 
> 1.8.5.2
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Test full framebuffer clear color with mismatched layer count.

2014-01-07 Thread Paul Berry
GL 3.2 allows different framebuffer attachments to have different
layer counts.  Rendering to layers that do not exist in all
attachments is undefined; however, clearing the framebuffer should
still clear all layers of all attachments.
---
 tests/all.tests|   1 +
 .../gl-3.2/layered-rendering/CMakeLists.gl.txt |   1 +
 .../clear-color-mismatched-layer-count.c   | 187 +
 3 files changed, 189 insertions(+)
 create mode 100644 
tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c

diff --git a/tests/all.tests b/tests/all.tests
index edf066b..2dcfb77 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -748,6 +748,7 @@ for texture_type in ['3d', '2d_array', 
'2d_multisample_array', '1d_array',
 texture_type, test_type)
 spec['!OpenGL 3.2/layered-rendering/' + cmdline] = \
 concurrent_test('gl-3.2-layered-rendering-' + cmdline)
+spec['!OpenGL 3.2/layered-rendering/clear-color-mismatched-layer-count'] = 
concurrent_test('gl-3.2-layered-rendering-clear-color-mismatched-layer-count')
 spec['!OpenGL 3.2/layered-rendering/clear-depth'] = 
concurrent_test('gl-3.2-layered-rendering-clear-depth')
 spec['!OpenGL 3.2/layered-rendering/framebuffertexture'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffertexture')
 spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures')
diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt 
b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
index a24ed8f..5d88b81 100644
--- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 piglit_add_executable (gl-3.2-layered-rendering-blit blit.c)
 piglit_add_executable (gl-3.2-layered-rendering-clear-color clear-color.c)
 piglit_add_executable (gl-3.2-layered-rendering-clear-color-all-types 
clear-color-all-types.c)
+piglit_add_executable 
(gl-3.2-layered-rendering-clear-color-mismatched-layer-count 
clear-color-mismatched-layer-count.c)
 piglit_add_executable (gl-3.2-layered-rendering-clear-depth clear-depth.c)
 piglit_add_executable 
(gl-3.2-layered-rendering-framebuffer-layered-attachments 
framebuffer-layered-attachments.c)
 piglit_add_executable 
(gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch 
framebuffer-layer-attachment-mismatch.c)
diff --git 
a/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c 
b/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c
new file mode 100644
index 000..e27ecc7
--- /dev/null
+++ b/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright © 2013 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 (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
+ *
+ * Test that a layered color clear clears all layers of all
+ * framebuffer attachments, even if not all framebuffer attachments
+ * have the same layer count.
+ *
+ * The test operates as follows:
+ *
+ * - Two textures are created, each with a different layer count.
+ *
+ * - Every layer of both textures is individually cleared to red.
+ *
+ * - Every layer of both textures is checked to verify that it has
+ *   been properly cleared to red.
+ *
+ * - Both textures are bound to a single framebuffer in layered
+ *   fashion, and then the entire framebuffer is cleared to green all
+ *   at once.
+ *
+ * - Every layer of both textures is checked to verify that it has
+ *   been cleared to green.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-util.h"
+
+#define TEX_SIZE 128
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VIS

[Piglit] [PATCH] Test that a layered fbo can have attachments with different layer counts.

2014-01-07 Thread Paul Berry
---
 tests/all.tests|   1 +
 .../gl-3.2/layered-rendering/CMakeLists.gl.txt |   1 +
 .../framebuffer-layer-count-mismatch.c | 107 +
 3 files changed, 109 insertions(+)
 create mode 100644 
tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c

diff --git a/tests/all.tests b/tests/all.tests
index edf066b..70ab814 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -755,6 +755,7 @@ spec['!OpenGL 
3.2/layered-rendering/framebuffertexture-defaults'] = concurrent_t
 spec['!OpenGL 3.2/layered-rendering/readpixels'] = 
concurrent_test('gl-3.2-layered-rendering-readpixels')
 spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-attachment-mismatch'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch')
 spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-complete'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-complete')
+spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-count-mismatch'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-count-mismatch')
 spec['!OpenGL 3.2/layered-rendering/framebuffer-layered-attachments'] = 
concurrent_test('gl-3.2-layered-rendering-framebuffer-layered-attachments')
 spec['!OpenGL 3.2/layered-rendering/gl-layer'] = 
concurrent_test('gl-3.2-layered-rendering-gl-layer')
 spec['!OpenGL 3.2/layered-rendering/gl-layer-cube-map'] = 
concurrent_test('gl-3.2-layered-rendering-gl-layer-cube-map')
diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt 
b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
index a24ed8f..496b5a1 100644
--- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt
@@ -16,6 +16,7 @@ piglit_add_executable (gl-3.2-layered-rendering-clear-depth 
clear-depth.c)
 piglit_add_executable 
(gl-3.2-layered-rendering-framebuffer-layered-attachments 
framebuffer-layered-attachments.c)
 piglit_add_executable 
(gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch 
framebuffer-layer-attachment-mismatch.c)
 piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-complete 
framebuffer-layer-complete.c)
+piglit_add_executable 
(gl-3.2-layered-rendering-framebuffer-layer-count-mismatch 
framebuffer-layer-count-mismatch.c)
 piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture 
framebuffertexture.c)
 piglit_add_executable 
(gl-3.2-layered-rendering-framebuffertexture-buffer-textures 
framebuffertexture-buffer-textures.c)
 piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture-defaults 
framebuffertexture-defaults.c)
diff --git 
a/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c 
b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c
new file mode 100644
index 000..05cb8ec
--- /dev/null
+++ b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright © 2013 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 (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
+ *
+ * ARB_geometry_shader4 doesn't permit layered framebuffers to have
+ * mismatched layer counts.  From ARB_geometry_shader4, under the
+ * heading "add to the list of conditions necessary for completeness":
+ *
+ * * If any framebuffer attachment is layered, all attachments
+ *   must have the same layer count.  For three-dimensional
+ *   textures, the layer count is the depth of the attached
+ *   volume.  For cube map textures, the layer count is always
+ *   six.  For one- and two-dimensional array textures, the layer
+ *   count is simply the number of layers in the array texture.
+ *   { FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB }
+ *
+ * However, this restriction was lifted when geometry shaders were
+ * adopted into OpenGL 3.2.  Instead, OpenGL 3.2 states, in section
+ * 4.4.7 (Layered F

[Piglit] [PATCH] tests/util: Link with rt only if librt exists.

2014-01-07 Thread Vinson Lee
This patch fixes the OpenBSD build.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73332
Signed-off-by: Vinson Lee 
---
 tests/util/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index df2ea70..6745a2f 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_definitions(-DSOURCE_DIR="${piglit_SOURCE_DIR}/")
 
-if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
+if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC AND HAVE_LIBRT)
 link_libraries(rt)
 endif()
 
-- 
1.8.1.2

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


Re: [Piglit] [PATCH] tests/util: Link with rt only if librt exists.

2014-01-07 Thread Brian Paul

On 01/07/2014 12:03 PM, Vinson Lee wrote:

This patch fixes the OpenBSD build.

Bugzilla: 
https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D73332&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=KMRRpzcufAqpyuAnMs9eVCBr2o5RXgP9OngInAaPkTc%3D%0A&s=987a6c24f6f6060615b59d4607a7a25a2faf7e3bb03da2196a4c18c9cf1c1d79
Signed-off-by: Vinson Lee 
---
  tests/util/CMakeLists.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index df2ea70..6745a2f 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -1,6 +1,6 @@
  add_definitions(-DSOURCE_DIR="${piglit_SOURCE_DIR}/")

-if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
+if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC AND HAVE_LIBRT)
  link_libraries(rt)
  endif()




Reviewed-by: Brian Paul 

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


[Piglit] [PATCH RESEND 1/1] cl: Add test program-scope-arrays.

2014-01-07 Thread Jan Vesely
Signed-off-by: Jan Vesely 
---

Resending to not be forgotten.

The last two tests fail on my AMD TURKS. All 4 tests pass on nVidia and Intel 
OCL.
This functionality is used in gegl color kernels making at least 3 tests in
their suite to fail.

Jan

 tests/cl/program/execute/program-scope-arrays.cl | 57 
 1 file changed, 57 insertions(+)
 create mode 100644 tests/cl/program/execute/program-scope-arrays.cl

diff --git a/tests/cl/program/execute/program-scope-arrays.cl 
b/tests/cl/program/execute/program-scope-arrays.cl
new file mode 100644
index 000..b9a962c
--- /dev/null
+++ b/tests/cl/program/execute/program-scope-arrays.cl
@@ -0,0 +1,57 @@
+/*!
+[config]
+name: program-scope-arrays
+dimensions: 1
+global_size: 4 0 0
+
+
+[test]
+name: simple-constant
+kernel_name: simple_constant
+arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
+
+[test]
+name: given-constant
+kernel_name: given_constant
+arg_in: 1 int 1
+arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
+
+[test]
+name: simple-gid
+kernel_name: simple_gid
+arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
+
+[test]
+name: indirection
+kernel_name: indirection
+arg_in: 1 buffer uchar[4] 0 1 2 3
+arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
+
+!*/
+
+__constant float arr[] = {
+4.0f,
+3.0f,
+2.0f,
+1.0f,
+};
+
+__kernel void simple_constant(__global float *out) {
+   int i = get_global_id(0);
+   out[i] = arr[1];
+}
+
+__kernel void given_constant(__global float *out, int c) {
+   int i = get_global_id(0);
+   out[i] = arr[c];
+}
+
+__kernel void simple_gid(__global float *out) {
+   int i = get_global_id(0);
+   out[i] = arr[i];
+}
+
+__kernel void indirection(__global float *out, __global uchar *in) {
+   int i = get_global_id(0);
+   out[i] = arr[in[i]];
+}
-- 
1.8.4.2

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


Re: [Piglit] [PATCH 04/12] tests/all.py: load glean glsl, frag, and vert tests internally

2014-01-07 Thread Kenneth Graunke
On 12/23/2013 04:51 PM, Dylan Baker wrote:
> This patch converts the glesn glsl1, fragPrgo1, and vertProg1 tests from
> external files that are called by execfile into lists of arguements, and
> uses a loop to add the tests.
> 
> This removes test files that are not in fact loadable test files, and
> lack a TestProfile instance, which means they will not be importable.
> 
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.tests | 394 
> 
>  tests/glean-fragProg1.tests |  52 --
>  tests/glean-glsl1.tests | 255 
>  tests/glean-vertProg1.tests |  42 -
>  4 files changed, 363 insertions(+), 380 deletions(-)
>  delete mode 100644 tests/glean-fragProg1.tests
>  delete mode 100644 tests/glean-glsl1.tests
>  delete mode 100644 tests/glean-vertProg1.tests
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 38c0f5d..1cd3c79 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -15,21 +15,16 @@ from framework.gleantest import GleanTest
>  from framework.glsl_parser_test import GLSLParserTest, add_glsl_parser_test, 
> import_glsl_parser_tests
>  from framework.shader_test import add_shader_test_dir
>  
> -# Blacklisted tests are removed from the test profile.
> -blacklist = [
> - ]
> -

Blacklisting changes look unrelated.  I'm all for removing it...just saying.

[snip]

> +glean_glsl1_tests = ['Directly set fragment color',

Could just call this glean_glsl_tests if you prefer.  Don't care either way.

[snip]

> +glean_frag_tests = ['ABS test',

Could we please call this glean_fp_tests or glean_fragprog_tests?

[snip]

> +glean_vert_tests = ['ABS test',

Likewise, glean_vp_tests or glean_vertprog_tests...
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 09/12] tests/gpu.py: Don't use execfile

2014-01-07 Thread Kenneth Graunke
On 12/23/2013 04:51 PM, Dylan Baker wrote:
> This uses import rather than exefile. It requires a few additional
> changes since gpu.py uses some hacky behavior to remove shader_tests
> 
> XXX: This isn't ready to be pushed

Isn't it?

> ---
>  framework/core.py |  9 +
>  tests/gpu.py  | 20 ++--
>  2 files changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/framework/core.py b/framework/core.py
> index 28a1ded..cd5c11d 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -605,6 +605,15 @@ class TestProfile:
>  group = group[group_name]
>  del group[l[-1]]
>  
> +def filter(self, function):

I don't like the name of this function.  'filter' is a well understood
standard library function in Python/Haskell/Scheme, which takes a list
and produces a new list without some elements.  The key part is: filter
is non-destructive.  This function /is/ destructive.

I'd probably use 'remove'/'delete' instead, like 'remove_by_predicate'
or some such.  Or just fold it in to the one use...

> +""" Remove tests that return true from function
> +
> +This is a destructive method, and passing an incorrect function could
> +result in undesired behavior.
> +
> +"""
> +self.tests = {k:v for k, v in self.tests.iteritems() if function(v)}

I believe this dictionary syntax is new with Python 2.7, and won't work
on 2.6.  If you want to be compatible, this ought to work:

self.tests = dict((k,v) for k, v in self.tests.iteritems() if function(v))

or

self.tests = dict(p for p in self.tests.iteritems() if function(p[1]))

> +
>  def update(self, *profiles):
>  """ Updates the contents of this TestProfile instance with another
>  
> diff --git a/tests/gpu.py b/tests/gpu.py
> index 99e1614..18a4b66 100644
> --- a/tests/gpu.py
> +++ b/tests/gpu.py
> @@ -2,23 +2,15 @@
>  
>  # quick.tests minus compiler tests.
>  
> -import framework.glsl_parser_test
> -import os.path
> +from tests.all import profile
> +from framework.glsl_parser_test import GLSLParserTest
>  
>  __all__ = ['profile']
>  
> -global profile
> -
> -# Filter out any GLSLParserTest instances, as they're compiler tests.
> -def add_glsl_parser_test(group, filepath, test_name):
> -# Dummy version of framework.glsl_parser_test.add_glsl_parser_test
> -pass
> -
> -# This be done before executing the base test list script
> -framework.glsl_parser_test.add_glsl_parser_test = add_glsl_parser_test
> -
> -
> -execfile(os.path.dirname(__file__) + '/quick.py')
> +# Remove all glsl_parser_tests

Please keep my comment explaining why this profile removes these tests.

> +profile.filter(lambda x: not isinstance(x, GLSLParserTest))
>  
>  # Drop ARB_vertex_program/ARB_fragment_program compiler tests.
> +del profile.tests['spec']['ARB_vertex_program']
> +del profile.tests['spec']['ARB_fragment_program']
>  del profile.tests['asmparsertest']

Other than those nits, this series looks pretty reasonable.  With those
minor things fixed, the series is:
Reviewed-by: Kenneth Graunke 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Simplify piglit threading

2014-01-07 Thread Kenneth Graunke
On 01/03/2014 06:07 AM, Dylan Baker wrote:
> This patch simplifies threading in piglit by removing the hand-rolled
> threadpool, and instead using the Pool class from multiprocessing.dummy.
> This provides a map interface, allowing for very clear succinct code.
> 
> The previous implementation ran all tests out of thread pools, a serial
> pool and a multi-threaded pool. This patch does the same thing for a
> couple of reasons. First, the obvious solution is to use the map()
> builtin for serial tests. However, map in python3 returns an iterator
> instead of a list so calling map(f, x) will not actually run f(x) until
> something tries to use those values. This would require considerable
> restructuring to work around. Second, that could easily be split out
> into another patch, and limits the number of changes in this patch.
> 
> Multiproccessing.dummy is a wrapper around the Threading module,
> providing the multiproccessing API, but with threads instead of
> processes.
> 
> Signed-off-by: Dylan Baker 
> ---
>  framework/core.py   | 47 +-
>  framework/threadpool.py | 67 
> -
>  2 files changed, 23 insertions(+), 91 deletions(-)
>  delete mode 100644 framework/threadpool.py
> 
> diff --git a/framework/core.py b/framework/core.py
> index 8bcda5b..1e06690 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -36,14 +36,13 @@ from log import log
>  from cStringIO import StringIO
>  from textwrap import dedent
>  from threads import synchronized_self
> -import threading
>  import multiprocessing
> +import multiprocessing.dummy
>  try:
>  import simplejson as json
>  except ImportError:
>  import json
>  
> -from threadpool import ThreadPool
>  import status
>  
>  __all__ = ['Environment',
> @@ -566,31 +565,31 @@ class TestProfile:
>  
>  self.prepare_test_list(env)
>  
> -# If concurrency is set to 'all' run all tests out of a concurrent
> -# threadpool, if it's none, then run evey test serially. otherwise 
> mix
> -# and match them
> +def run(pair):
> +""" Function to call test.execute from .map
> +
> +adds env and json_writer which are needed by Test.execute()
> +
> +"""
> +name, test = pair
> +test.execute(env, name, json_writer)

You just defined a function called run()...IN a function called run().

*mind blown*

probably shouldn't do that.  That's even worse than doRun() and
doRunRun() or whatever we used to have.

Would love to see a v2 with this fixed.

> +
> +# Multiprocessing.dummy is a wrapper around Threading that provides a
> +# multiprocessing compatible API
> +single = multiprocessing.dummy.Pool(1)
> +multi = multiprocessing.dummy.Pool(multiprocessing.cpu_count())

You don't need multiprocessing.cpu_count() - that's the default.  So you
can just do:

multi = multiprocessing.dummy.Pool()

> +
>  if env.concurrent == "all":
> -pool = ThreadPool(multiprocessing.cpu_count())
> -for (path, test) in self.test_list.items():
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +multi.map(run, self.test_list.iteritems())

I'm unclear whether we want map, imap, or imap_unordered here.  I guess
it seems to work.  Still, thoughts?

>  elif env.concurrent == "none":
> -pool = ThreadPool(1)
> -for (path, test) in self.test_list.items():
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +single.map(run, self.test_list.iteritems())
>  else:
> -pool = ThreadPool(multiprocessing.cpu_count())
> -for (path, test) in self.test_list.items():
> -if test.runConcurrent:
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> -
> -pool = ThreadPool(1)
> -for (path, test) in self.test_list.items():
> -if not test.runConcurrent:
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +# Filter and return only thread safe tests to the threaded pool
> +multi.map(run, (x for x in self.test_list.iteritems() if
> +x[1].runConcurrent))
> +# Filter and return the non thread safe tests to the single pool
> +single.map(run, (x for x in self.test_list.iteritems() if not
> + x[1].runConcurrent))
>  
>  def remove_test(self, test_path):
>  """Remove a fully qualified test from the profile.
> diff --git a/framework/threadpool.py b/framework/threadpool.py
> deleted file mode 100644
> index 5d1fc56..000
> --- a/framework/threadpool.py
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -# Copyright (c) 2013 Intel Corporation
> -#
> -# Permission is hereb