[Piglit] [PATCH 4/4] arb_tessellation_shader/tes-gs-max-output: new test for TES/GS amplification

2018-09-13 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Test extremes of GS amplification under tessellation.
---
 tests/opengl.py   |   1 +
 .../arb_tessellation_shader/CMakeLists.gl.txt |   1 +
 .../tes-gs-max-output.cpp | 817 ++
 3 files changed, 819 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp

diff --git a/tests/opengl.py b/tests/opengl.py
index 903a95809..3cc25c99c 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1524,20 +1524,21 @@ with profile.test_list.group_manager(
 g(['arb_tessellation_shader-immediate-mode-draw-patches'])
 g(['arb_tessellation_shader-invalid-get-program-params'])
 g(['arb_tessellation_shader-invalid-patch-vertices-range'])
 g(['arb_tessellation_shader-invalid-primitive'])
 g(['built-in-constants',
os.path.join('spec', 'arb_tessellation_shader', 
'minimum-maximums.txt')],
   'built-in-constants',
   override_class=BuiltInConstantsTest)
 g(['arb_tessellation_shader-large-uniforms'])
 g(['arb_tessellation_shader-layout-mismatch'])
+g(['arb_tessellation_shader-tes-gs-max-output', '-small', '-scan', '1', 
'50'])
 
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
 g(['arb_texture_multisample-large-float-texture'], 'large-float-texture',
   run_concurrent=False)
 g(['arb_texture_multisample-large-float-texture', '--array'],
   'large-float-texture-array', run_concurrent=False)
 g(['arb_texture_multisample-large-float-texture', '--fp16'],
   'large-float-texture-fp16', run_concurrent=False)
diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt 
b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
index d70b00f3f..058a1bc49 100644
--- a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
@@ -11,12 +11,13 @@ link_libraries (
 
 piglit_add_executable (arb_tessellation_shader-get-tcs-params get-tcs-params.c)
 piglit_add_executable (arb_tessellation_shader-get-tes-params get-tes-params.c)
 piglit_add_executable (arb_tessellation_shader-immediate-mode-draw-patches 
immediate-mode-draw-patches.c)
 piglit_add_executable (arb_tessellation_shader-invalid-get-program-params 
invalid-get-program-params.c)
 piglit_add_executable (arb_tessellation_shader-invalid-patch-vertices-range 
invalid-patch-vertices-range.c)
 piglit_add_executable (arb_tessellation_shader-invalid-primitive 
invalid-primitive.c)
 piglit_add_executable (arb_tessellation_shader-minmax minmax.c)
 piglit_add_executable (arb_tessellation_shader-large-uniforms large-uniforms.c)
 piglit_add_executable (arb_tessellation_shader-layout-mismatch 
layout-mismatch.c)
+piglit_add_executable (arb_tessellation_shader-tes-gs-max-output 
tes-gs-max-output.cpp)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp 
b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
new file mode 100644
index 0..de0d2daf1
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
@@ -0,0 +1,817 @@
+/*
+ * Copyright (c) 2018 Advanced Micro Devices
+ *
+ * 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 tes-gs-max-output.cpp
+ *
+ * Stress the limits of what tessellation + geometry shaders can output using
+ * generic shaders with points as input and output primitives, allowing
+ * arbitrary:
+ * - number of input instances (instanced draws)
+ * - number of input patches per instance
+ * - (integer) tessellati

[Piglit] [PATCH 3/4] glsl-1.50/gs-max-output: new test for geometry shader amplification

2018-09-13 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Test the extremes of # of GS output vertices / components per GS input
primitive.

Existing tests only cover cases of high # of components per vertex, but
not cases of low # of components per vertex and high # of output vertices.
---
 tests/opengl.py   |   1 +
 .../execution/geometry/CMakeLists.gl.txt  |   1 +
 .../execution/geometry/gs-max-output.cpp  | 549 ++
 3 files changed, 551 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp

diff --git a/tests/opengl.py b/tests/opengl.py
index c599eb180..903a95809 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1398,20 +1398,21 @@ with profile.test_list.group_manager(
os.path.join('spec', 'glsl-1.50', 'minimum-maximums.txt')],
   'built-in constants',
   override_class=BuiltInConstantsTest)
 g(['built-in-constants',
os.path.join('spec', 'glsl-1.50', 'minimum-maximums-compat.txt')],
   'built-in constants compatibility',
   override_class=BuiltInConstantsTest)
 g(['glsl-1.50-gs-emits-too-few-verts'], 'gs-emits-too-few-verts')
 g(['glsl-1.50-geometry-end-primitive-optional-with-points-out'],
   'gs-end-primitive-optional-with-points-out')
+g(['glsl-1.50-gs-max-output', '-scan', '1', '20'], 'gs-max-output')
 g(['glsl-1.50-gs-max-output-components'], 'gs-max-output-components')
 g(['glsl-1.50-getshaderiv-may-return-GS'], 'getshaderiv-may-return-GS')
 g(['glsl-1.50-query-gs-prim-types'], 'query-gs-prim-types')
 g(['glsl-1.50-transform-feedback-type-and-size'],
   'transform-feedback-type-and-size')
 g(['glsl-1.50-transform-feedback-vertex-id'],
   'transform-feedback-vertex-id')
 g(['glsl-1.50-transform-feedback-builtins'], 'transform-feedback-builtins')
 
 for draw in ['', 'indexed']:
diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt 
b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
index 0d76adc06..c6d21f080 100644
--- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
+++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
@@ -13,14 +13,15 @@ piglit_add_executable (glsl-1.50-geometry-end-primitive 
end-primitive.c)
 piglit_add_executable 
(glsl-1.50-geometry-end-primitive-optional-with-points-out 
geometry-end-primitive-optional-with-points-out.c)
 piglit_add_executable (glsl-1.50-geometry-primitive-id-restart 
primitive-id-restart.c)
 piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c)
 piglit_add_executable (glsl-1.50-geometry-tri-strip-ordering-with-prim-restart 
tri-strip-ordering-with-prim-restart.c)
 piglit_add_executable (glsl-1.50-gs-emits-too-few-verts 
gs-emits-too-few-verts.c)
 piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS 
getshaderiv-may-return-GS.c)
 piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c)
 piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c)
 piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers 
gs-input-layout-qualifiers.c)
 piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers 
gs-output-layout-qualifiers.c)
+piglit_add_executable (glsl-1.50-gs-max-output gs-max-output.cpp)
 piglit_add_executable (glsl-1.50-gs-max-output-components 
gs-max-output-components.c)
 piglit_add_executable (glsl-1.50-transform-feedback-type-and-size 
transform-feedback-type-and-size.c)
 piglit_add_executable (glsl-1.50-transform-feedback-vertex-id 
transform-feedback-vertex-id.c)
 piglit_add_executable (glsl-1.50-transform-feedback-builtins 
transform-feedback-builtins.c)
diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp 
b/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp
new file mode 100644
index 0..eb9292655
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp
@@ -0,0 +1,549 @@
+/*
+ * Copyright (c) 2018 Advanced Micro Devices
+ *
+ * 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 W

[Piglit] [PATCH 1/4] fbo-drawbuffers-maxtargets: fix a warning

2018-09-13 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Ensure that the allocated buffer is guaranteed to be big enough.
---
 tests/fbo/fbo-drawbuffers-maxtargets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c 
b/tests/fbo/fbo-drawbuffers-maxtargets.c
index f5e2a48ed..5d5a09f62 100644
--- a/tests/fbo/fbo-drawbuffers-maxtargets.c
+++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
@@ -137,21 +137,21 @@ generate_and_display_drawbuffers(int count)
 
glDrawBuffersARB(count, attachments);
 
/* Clear all to red so we see if the shader rendering happens. */
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
 
/* Build the shader that writes different color to each buffer. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
 
-   fs_count_source = malloc(strlen(fs_source) + 5);
+   fs_count_source = malloc(strlen(fs_source) + 10);
sprintf(fs_count_source, fs_source, count);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_count_source);
free(fs_count_source);
 
prog = piglit_link_simple_program(vs, fs);
glUseProgram(prog);
 
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
 
-- 
2.17.1

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


[Piglit] [PATCH 2/4] glsl-1.20/fs-deref-literal-array-of-structs-with-multiple-members-large-array: Fix it

2018-09-13 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Hard to believe that this was never noticed...
---
 ...f-structs-with-multiple-members-large-array.shader_test | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
 
b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
index ff2b34da7..96cf0bfa6 100644
--- 
a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
+++ 
b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
@@ -12,21 +12,21 @@ GLSL >= 1.20
 [vertex shader]
 void main()
 {
   gl_Position = gl_Vertex;
 }
 
 [fragment shader]
 struct Foo {
   int value;
 
-  /* A second member of a differnt size ensures we calculate member offsets
+  /* A second member of a different size ensures we calculate member offsets
* correctly.
*/
   ivec2 value2;
 };
 
 uniform int i;
 uniform ivec2 expected_value;
 
 void main()
 {
@@ -40,18 +40,17 @@ void main()
 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
 }
 
 [test]
 uniform int i 0
 uniform ivec2 expected_value 200 300
 draw rect -1 -1 1 1
 uniform int i 1
 uniform ivec2 expected_value 500 600
 draw rect 0 -1 1 1
-probe all rgba 0.0 1.0 0.0 1.0
-uniform int i 0
+uniform int i 2
 uniform ivec2 expected_value 800 900
 draw rect -1 0 1 1
-uniform int i 1
+uniform int i 3
 uniform ivec2 expected_value 1100 1200
 draw rect 0 0 1 1
 probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


[Piglit] [PATCH 0/4] Autumn cleaning: misc test case additions and fixes

2018-09-13 Thread Nicolai Hähnle
Hi all,

These are a bunch of patches that I've had locally for a while now,
hopefully cleaned up enough to be useful :)

The big ones are #3 and #4, which add tests for extreme GS and GS+tess
amplification cases.

Please review!
Thanks,
Nicolai


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


Re: [Piglit] [PATCH] arb_compute_variable_group_size: check gl_GlobalInvocationID

2017-10-22 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 21.10.2017 21:21, Ilia Mirkin wrote:

An implementation bug in mesa caused these values to be computed
incorrectly. Make sure that they work as defined.

Signed-off-by: Ilia Mirkin 
---
  .../execution/global-invocation-id.shader_test | 44 ++
  1 file changed, 44 insertions(+)
  create mode 100644 
tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test

diff --git 
a/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
 
b/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
new file mode 100644
index 0..24f2f1d05
--- /dev/null
+++ 
b/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
@@ -0,0 +1,44 @@
+# Simple test that verifies gl_GlobalInvocationID derived values are
+# computed properly.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_compute_variable_group_size
+GL_ARB_shader_storage_buffer_object
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: require
+#extension GL_ARB_compute_variable_group_size: require
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(local_size_variable) in;
+
+layout(std430)
+buffer SSBO {
+   uvec2 id[4];
+};
+
+void main()
+{
+   uint g = gl_GlobalInvocationID.x;
+   uint l = gl_LocalInvocationID.x;
+   uint t = gl_WorkGroupID.x * gl_LocalGroupSizeARB.x + 
gl_LocalInvocationID.x;
+   id[t] = uvec2(g, l);
+}
+
+[test]
+ssbo 0 32
+
+compute group size 2 1 1 2 1 1
+
+probe ssbo uint 0  0 == 0
+probe ssbo uint 0  4 == 0
+probe ssbo uint 0  8 == 1
+probe ssbo uint 0 12 == 1
+probe ssbo uint 0 16 == 2
+probe ssbo uint 0 20 == 0
+probe ssbo uint 0 24 == 3
+probe ssbo uint 0 28 == 1




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 11/11] all.py: run ARB_draw_buffers tests concurrently

2017-10-16 Thread Nicolai Hähnle

For the series:

Reviewed-by: Nicolai Hähnle 

On 14.10.2017 05:33, Brian Paul wrote:

---
  tests/all.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 046c02b..9f37ba2 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4276,9 +4276,9 @@ with profile.test_list.group_manager(
  with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'arb_draw_buffers')) as g:
-g(['arb_draw_buffers-state_change'], run_concurrent=False)
-g(['fbo-mrt-alphatest'], run_concurrent=False)
-g(['fbo-mrt-new-bind'], run_concurrent=False)
+g(['arb_draw_buffers-state_change'])
+g(['fbo-mrt-alphatest'])
+g(['fbo-mrt-new-bind'])
  
  with profile.test_list.group_manager(

  PiglitGLTest,




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] all.py: add missing argument to arb_sample_shading-samplemask test

2017-10-16 Thread Nicolai Hähnle

On 14.10.2017 05:49, Brian Paul wrote:

As it was, argc != 4 caused the test to print usage info and exit
with PIGLIT_FAIL.

Fixes bbc27395cfc93d3f3 "arb_sample_shading: add more extensive
gl_SampleMask(In) tests".


Thanks!

Reviewed-by: Nicolai Hähnle 


---
  tests/all.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index 9f37ba2..684a178 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2384,7 +2384,7 @@ with profile.test_list.group_manager(
  g(['arb_sample_shading-builtin-gl-sample-mask-simple',
 num_samples],
'builtin-gl-sample-mask-simple {}'.format(num_samples))
-g(['arb_sample_shading-samplemask', num_samples, 'all'],
+g(['arb_sample_shading-samplemask', num_samples, 'all', 'all'],
'samplemask {} all'.format(num_samples))
  
  g(['arb_sample_shading-builtin-gl-sample-mask-mrt-alpha'])





--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [RFC 03/10] framework: add Test.name attribute

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

So that we can just pass Test objects around instead of (name, test)
pairs.
---
 framework/backends/abstract.py |  8 
 framework/profile.py   | 26 +++---
 framework/programs/run.py  |  2 +-
 framework/test/base.py | 11 ++-
 tests/all.py   |  2 +-
 tests/cpu.py   |  4 ++--
 tests/glslparser.py|  2 +-
 tests/gpu.py   |  4 ++--
 tests/quick.py |  6 +++---
 tests/shader.py|  2 +-
 tests/xts-render.py|  4 +++-
 11 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index 27dec7e6b..cee7d7bdf 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -184,40 +184,40 @@ class FileBackend(Backend):
 
 @abc.abstractmethod
 def _write(self, f, name, data):
 """Method that writes a TestResult into a result file."""
 
 @abc.abstractproperty
 def _file_extension(self):
 """The file extension of the backend."""
 
 @contextlib.contextmanager
-def write_test(self, name):
+def write_test(self, test):
 """Write a test.
 
 When this context manager is opened it will first write a placeholder
 file with the status incomplete.
 
 When it is called to write the final result it will create a temporary
 file, write to that file, then move that file over the original,
 incomplete status file. This helps to make the operation atomic, as
 long as the filesystem continues running and the result was valid in
 the original file it will be valid at the end
 
 """
 def finish(val):
 tfile = file_ + '.tmp'
 with open(tfile, 'w') as f:
-self._write(f, name, val)
+self._write(f, test.name.lower(), val)
 self.__fsync(f)
 shutil.move(tfile, file_)
 
 file_ = os.path.join(self._dest, 'tests', '{}.{}'.format(
 next(self._counter), self._file_extension))
 
 with open(file_, 'w') as f:
 incomplete = TestResult(result=INCOMPLETE)
-incomplete.root = name
-self._write(f, name, incomplete)
+incomplete.root = test.name
+self._write(f, test.name.lower(), incomplete)
 self.__fsync(f)
 
 yield finish
diff --git a/framework/profile.py b/framework/profile.py
index a19b4d2d2..c95ab9341 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -71,33 +71,33 @@ class RegexFilter(object):
 filters -- a list of regex compiled objects.
 
 Keyword Arguments:
 inverse -- Inverse the sense of the match.
 """
 
 def __init__(self, filters, inverse=False):
 self.filters = [re.compile(f, flags=re.IGNORECASE) for f in filters]
 self.inverse = inverse
 
-def __call__(self, name, _):  # pylint: disable=invalid-name
+def __call__(self, test):
 # This needs to match the signature (name, test), since it doesn't need
 # the test instance use _.
 
 # If self.filters is empty then return True, we don't want to remove
 # any tests from the run.
 if not self.filters:
 return True
 
 if not self.inverse:
-return any(r.search(name) for r in self.filters)
+return any(r.search(test.name) for r in self.filters)
 else:
-return not any(r.search(name) for r in self.filters)
+return not any(r.search(test.name) for r in self.filters)
 
 
 class TestDict(collections.MutableMapping):
 """A special kind of dict for tests.
 
 This mapping lowers the names of keys by default, and enforces that keys be
 strings (not bytes) and that values are Test derived objects. It is also a
 wrapper around collections.OrderedDict.
 
 This class doesn't accept keyword arguments, this is intentional. This is
@@ -130,20 +130,23 @@ class TestDict(collections.MutableMapping):
 # Values should either be more Tests
 if not isinstance(value, Test):
 raise exceptions.PiglitFatalError(
 "TestDict values must be a Test, but was a {}".format(
 type(value)))
 
 # This must be lowered before the following test, or the test can pass
 # in error if the key has capitals in it.
 key = key.lower()
 
+# Store the name of the test in the Test object
+value.name = key
+
 # If there is already a test of that value in the tree it is an error
 if not self.__allow_reassignment and key in self.__container:
 if self.__container[key] != value:
 

[Piglit] [RFC 09/10] framework: allow specifying the number of jobs for concurrency

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

The default remains the same: number of CPUs. But on systems with lots of
cores but comparatively little (V)RAM it can make sense to reduce the
number of jobs to avoid random failures caused by out-of-memory conditions.
---
 framework/options.py  |  1 +
 framework/profile.py  |  7 +--
 framework/programs/run.py | 24 ++--
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/framework/options.py b/framework/options.py
index 211159a45..b6ff2b406 100644
--- a/framework/options.py
+++ b/framework/options.py
@@ -51,20 +51,21 @@ class _Options(object):  # pylint: 
disable=too-many-instance-attributes
 env -- environment variables set for each test before run
 deqp_mustpass -- True to enable the use of the deqp mustpass list feature.
 """
 
 def __init__(self):
 self.execute = True
 self.valgrind = False
 self.sync = False
 self.deqp_mustpass = False
 self.process_isolation = True
+self.jobs = -1
 
 # env is used to set some base environment variables that are not going
 # to change across runs, without sending them to os.environ which is
 # fickle and easy to break
 self.env = {
 'PIGLIT_SOURCE_DIR':
 os.environ.get(
 'PIGLIT_SOURCE_DIR',
 os.path.abspath(os.path.join(os.path.dirname(__file__),
  '..')))
diff --git a/framework/profile.py b/framework/profile.py
index 1fadb39a8..a4f18a456 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -414,40 +414,41 @@ class WorkItemBuilder(object):
 max_tests = runner.max_tests or len(tests)
 for idx in range(0, len(tests), max_tests):
 self._add_workitem(workitems, runner, tests[idx:idx + 
max_tests])
 
 # Run large work items first
 workitems.sort(key=lambda w: len(w.tests), reverse=True)
 return workitems
 
 
 def run(profiles, logger, backend, concurrency='some',
-process_isolation=True, results=None):
+process_isolation=True, results=None, jobs=-1):
 """Runs all tests using Thread pool.
 
 When called this method will flatten out self.tests into self.test_list,
 then will prepare a logger, and begin executing tests through it's Thread
 pools.
 
 Based on the value of concurrency it will either run all the tests
 concurrently, all serially, or first the thread safe tests then the
 serial tests.
 
 Finally it will print a final summary of the tests.
 
 Arguments:
 profiles -- a list of Profile instances.
 logger   -- a log.LogManager instance.
 backend  -- a results.Backend derived instance.
 results  -- list of TestResult instances from a previous interrupted run
 using the same profiles and settings (resulting in the same
 workitems).
+jobs -- maximum number of concurrent jobs. Use os.cpu_count() by 
default
 """
 chunksize = 1
 
 # The logger needs to know how many tests are running. Because of filters
 # there's no way to do that without making a concrete list out of the
 # filters profiles.
 workitem_builder = WorkItemBuilder(process_isolation=process_isolation,
results=results)
 profiles = [(p, workitem_builder(p.itertests())) for p in profiles]
 log = LogManager(logger, sum(len(l) for _, l in profiles))
@@ -496,21 +497,23 @@ def run(profiles, logger, backend, concurrency='some',
 # pool
 run_threads(single, profile, workitems,
 lambda x: not x.run_concurrent)
 profile.teardown()
 
 # Multiprocessing.dummy is a wrapper around Threading that provides a
 # multiprocessing compatible API
 #
 # The default value of pool is the number of virtual processor cores
 single = multiprocessing.dummy.Pool(1)
-multi = multiprocessing.dummy.Pool()
+if not jobs or jobs < 0:
+jobs = os.cpu_count()
+multi = multiprocessing.dummy.Pool(jobs)
 
 try:
 for p in profiles:
 run_profile(*p)
 
 for pool in [single, multi]:
 pool.close()
 pool.join()
 finally:
 log.get().summary()
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 03562cd97..bf8a0e612 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -201,20 +201,28 @@ def _run_parser(input_):
 dest='process_isolation',
 action='store',
 type=booltype,
 default=core.PIGLIT_CONFIG.safe_get(
 'core', '

[Piglit] [RFC 10/10] framework/resume: properly parse the no_retry option

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/programs/run.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index bf8a0e612..ecef3dead 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -380,20 +380,22 @@ def run(input_):
 
 time_elapsed.end = time.time()
 backend.finalize({'time_elapsed': time_elapsed.to_json()})
 
 print('Thank you for running Piglit!\n'
   'Results have been written to ' + args.results_path)
 
 
 @exceptions.handler
 def resume(input_):
+unparsed = parsers.parse_config(input_)[1]
+
 parser = argparse.ArgumentParser()
 parser.add_argument("results_path",
 type=path.realpath,
 metavar="",
 help="Path to results folder")
 parser.add_argument("-f", "--config",
 dest="config_file",
 type=argparse.FileType("r"),
 help="Optionally specify a piglit config file to use. "
  "Default is piglit.conf")
@@ -402,32 +404,31 @@ def resume(input_):
 action="store_true",
 help="Do not retry incomplete tests")
 parser.add_argument('-j', '--jobs',
 dest='jobs',
 action='store',
 type=int,
 default=core.PIGLIT_CONFIG.safe_get(
 'core', 'jobs', '-1'),
 help='Set the maximum number of jobs to run 
concurrently. '
  'By default, the reported number of CPUs is 
used.')
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 _disable_windows_exception_messages()
 
 results = backends.load(args.results_path)
 options.OPTIONS.execute = results.options['execute']
 options.OPTIONS.valgrind = results.options['valgrind']
 options.OPTIONS.sync = results.options['sync']
 options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass']
 options.OPTIONS.process_isolation = results.options['process_isolation']
 options.OPTIONS.jobs = args.jobs
-
-core.get_config(args.config_file)
+options.OPTIONS.no_retry = args.no_retry
 
 options.OPTIONS.env['PIGLIT_PLATFORM'] = results.options['platform']
 
 results.options['env'] = core.collect_system_info()
 results.options['name'] = results.name
 
 # Resume only works with the JSON backend
 backend = backends.get_backend('json')(
 args.results_path,
 file_start_count=len(results.results) + 1)
-- 
2.11.0

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


[Piglit] [RFC 05/10] framework: add various helper functions to TestResult

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/results.py | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/framework/results.py b/framework/results.py
index 26ebbe7a6..c13379b3e 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -202,20 +202,66 @@ class TestResult(object):
 if relative == '':
 if self.subtests:
 raise KeyError(key)
 return self.result
 
 try:
 return self.subtests[relative]
 except KeyError:
 raise KeyError(key)
 
+def set_result(self, key, status):
+"""Set the result status of a (sub-)test covered by this object.
+
+Raises KeyError if the test is not covered.
+"""
+relative = grouptools.relative(self.root, key)
+
+if relative == '':
+if self.subtests:
+raise KeyError(key)
+self.result = status
+return
+
+if relative not in self.subtests:
+raise KeyError(key)
+
+self.subtests[relative] = status
+
+@property
+def tests(self):
+"""Iterator over the names of tests covered by this object."""
+if self.subtests:
+for subtest in six.iterkeys(self.subtests):
+yield grouptools.join(self.root, subtest)
+else:
+yield self.root
+
+def add_test(self, key):
+"""Add a (sub-)test to the tests covered by this object."""
+relative = grouptools.relative(self.root, key)
+
+if relative == '':
+assert not self.subtests
+return # Nothing to be done
+
+self.subtests[relative] = status.NOTRUN
+
+def have_test(self, key):
+"""Whether a given (sub-)test is covered by this object."""
+relative = grouptools.relative(self.root, key)
+
+if relative == '':
+return not self.subtests
+
+return relative in self.subtests
+
 def to_json(self):
 """Return the TestResult as a json serializable object."""
 obj = {
 '__type__': 'TestResult',
 'root': self.root,
 'command': self.command,
 'environment': self.environment,
 'err': self.err,
 'out': self.out,
 'result': self.result,
-- 
2.11.0

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


[Piglit] [RFC 00/10] Running dEQP tests without process isolation

2017-10-11 Thread Nicolai Hähnle
Hi all,

This series allows running dEQP tests (including GL CTS) without process
isolation. I've been using it quite successfully for the last few weeks,
though there are a bunch of loose ends, off the top of my head:

1. One remaining spurious failure in the `gpu` profile
2. Only tested on gpu, deqp_*, cts_gl45, khr_gl45 profiles
3. Unit tests are completely and utterly broken
4. junit backend is untested and likely needs fixes

The reason for all this is that in order to convince Piglit to run dEQP
tests without process isolation, I ended up refactoring a lot of its
internals. Most of this is documented in the commit messages, but a
rough overview:

1. Multiple TestResults can co-exist at the same "root" in the test
   hierarchy. So you can have many TestResults that all have the root
   'deqp-gles31@functional', and subtests spread out across possibly
   overlapping subgroups. This obviously involves a change in the
   on-disk format for storing results.

2. Test cases are no longer grouped in the profile description. Instead,
   there's the concept of a TestWorkItem, which groups a bunch of tests
   that are to be run in one batch by the same TestRunner.

   This means that the test case objects are no longer responsible for
   running themselves; that's the domain of the separate TestRunner
   hierarchy. TestRunners for shader tests and dEQP tests know how to
   run multiple tests in one batch, and how to parse the test process
   outputs into subtest results.

   Theoretically that should also allow running shader tests from different
   directories together, but I haven't done that in this series.

3. TestWorkItems are grouped deterministically in the profile run logic,
   which means that resumed test runs can still have process isolation
   disabled!

You can find the whole series in context with some other stuff at
https://cgit.freedesktop.org/~nh/piglit/log/?h=deqp-run-multi

I probably won't be able to really polish and clean this up any time
soon, so it would be awesome if somebody would volunteer for this admittedly
unthankful task. In the meantime, the code is out there, and I hope other
people will find it useful.

Cheers,
Nicolai

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


[Piglit] [RFC 04/10] framework: fix grouptools.commonprefix when len(args) == 1

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/grouptools.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/grouptools.py b/framework/grouptools.py
index 2ee74ed9f..1a65c0dcd 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -82,21 +82,21 @@ def splitname(group):
 i = group.rfind(SEPARATOR) + 1
 head, tail = group[:i], group[i:]
 head = head.rstrip(SEPARATOR)
 
 return head, tail
 
 
 def commonprefix(args):
 """Given a list of groups, returns the longest common leading component."""
 if len(args) == 1:
-return args
+return args[0]
 elif any(e == '' for e in args):
 return ''
 
 common = []
 
 for elems in zip(*[split(a) for a in args]):
 iter_ = iter(elems)
 first = next(iter_)
 if all(first == r for r in iter_):
 common.append(first)
-- 
2.11.0

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


[Piglit] [RFC 01/10] framework: refactor subtest handling

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

The old design of TestResult and TestrunResult has two related limitations
that prevent us from relaxing process isolation more than what is done for
shader tests:

1. A TestResult can only have subtests one level below its 'root' group.

2. If one TestResult with subtests covers a group, then no other
   TestResult can have tests in the same group.

This patch relaxes both constraints in the following way:

- The conceptual specialness of subtests is reduced. A TestResult is
  simply a container for one or more tests that happen to have been
  tested as part of the same execution (so the tests share pid and
  stdout/stderr).

- TestResult now has a 'root' attribute. Without subtests, this is just
  the name of the test. With subtests, it is the common prefix of all
  subtests. Subtest names are relative to the root, and can be multiple
  levels deep.

- TestrunResult stores a plain list of TestResults in the 'results'
  attribute. For test lookups, the '_tests' dictionary caches the mapping
  of tests to result object.

The users of those classes are adjusted accordingly, especially for
summary generation.

This patch does not yet change the on-disk format of results.

TODO:
- unit tests need to be adjusted
- junit backend needs to be adjusted
---
 framework/grouptools.py |  18 +++
 framework/results.py| 116 
 framework/summary/common.py |   7 +--
 framework/summary/html_.py  |  26 ++
 templates/index.mako|  28 +++
 templates/test_result.mako  |   4 +-
 6 files changed, 130 insertions(+), 69 deletions(-)

diff --git a/framework/grouptools.py b/framework/grouptools.py
index f28241d3c..2ee74ed9f 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -146,20 +146,38 @@ def split(group):
 """Split the group into a list of elements.
 
 If input is '' return an empty list
 
 """
 if group == '':
 return []
 return group.split(SEPARATOR)
 
 
+def relative(root, test):
+"""Return the subgroup/subtest path of test relative to root.
+
+Satisfies join(root, relative(root, test)) == test.
+
+If root == test, return ''.
+
+"""
+assert test.startswith(root), (test, root)
+if test == root:
+return ''
+
+assert test[len(root)] == SEPARATOR
+assert len(test) >= len(root) + 2
+
+return test[len(root) + 1:]
+
+
 def from_path(path):
 """Create a group from a path.
 
 This function takes a path, and creates a group out of it.
 
 This safely handles both Windows and Unix style paths.
 
 """
 assert isinstance(path, six.string_types), 'Type must be string or unicode'
 
diff --git a/framework/results.py b/framework/results.py
index 99dd3735b..a44029f3e 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -141,25 +141,26 @@ class TimeAttribute(object):
 
 if '__type__' in dict_:
 del dict_['__type__']
 return cls(**dict_)
 
 
 class TestResult(object):
 """An object represting the result of a single test."""
 __slots__ = ['returncode', '_err', '_out', 'time', 'command', 'traceback',
  'environment', 'subtests', 'dmesg', '__result', 'images',
- 'exception', 'pid']
+ 'exception', 'pid', 'root']
 err = StringDescriptor('_err')
 out = StringDescriptor('_out')
 
 def __init__(self, result=None):
+self.root = ''
 self.returncode = None
 self.time = TimeAttribute()
 self.command = str()
 self.environment = str()
 self.subtests = Subtests()
 self.dmesg = str()
 self.images = None
 self.traceback = None
 self.exception = None
 self.pid = []
@@ -183,20 +184,38 @@ class TestResult(object):
 return max(six.itervalues(self.subtests))
 return self.__result
 
 @result.setter
 def result(self, new):
 try:
 self.__result = status.status_lookup(new)
 except exceptions.PiglitInternalError as e:
 raise exceptions.PiglitFatalError(str(e))
 
+def get_result(self, key):
+"""Return the result of a (sub-)test covered by this object.
+
+KeyError is raised if the test key is not covered.
+
+"""
+relative = grouptools.relative(self.root, key)
+
+if relative == '':
+if self.subtests:
+raise KeyError(key)
+return self.result
+
+try:
+   

[Piglit] [RFC 02/10] framework: update JSON storage format to version 10

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Reflect the refactoring of TestResult and TestrunResult in the on-disk
storage format.
---
 framework/backends/abstract.py |  6 +++---
 framework/backends/json.py | 39 ++-
 framework/results.py   | 17 +
 framework/test/base.py |  1 +
 4 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index 85abfa52d..27dec7e6b 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -165,22 +165,20 @@ class FileBackend(Backend):
 tests. It is important for resumes that this is not
 overlapping as the Inheriting classes assume they are
 not. Default: 0
 
 """
 def __init__(self, dest, file_start_count=0, **kwargs):
 self._dest = dest
 self._counter = itertools.count(file_start_count)
 self._write_final = write_compressed
 
-__INCOMPLETE = TestResult(result=INCOMPLETE)
-
 def __fsync(self, file_):
 """ Sync the file to disk
 
 If options.OPTIONS.sync is truthy this will sync self._file to disk
 
 """
 file_.flush()
 if options.OPTIONS.sync:
 os.fsync(file_.fileno())
 
@@ -210,14 +208,16 @@ class FileBackend(Backend):
 tfile = file_ + '.tmp'
 with open(tfile, 'w') as f:
 self._write(f, name, val)
 self.__fsync(f)
 shutil.move(tfile, file_)
 
 file_ = os.path.join(self._dest, 'tests', '{}.{}'.format(
 next(self._counter), self._file_extension))
 
 with open(file_, 'w') as f:
-self._write(f, name, self.__INCOMPLETE)
+incomplete = TestResult(result=INCOMPLETE)
+incomplete.root = name
+self._write(f, name, incomplete)
 self.__fsync(f)
 
 yield finish
diff --git a/framework/backends/json.py b/framework/backends/json.py
index 882169e09..80d82d0ab 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -46,21 +46,21 @@ from framework import status, results, exceptions, compat
 from .abstract import FileBackend, write_compressed
 from .register import Registry
 from . import compression
 
 __all__ = [
 'REGISTRY',
 'JSONBackend',
 ]
 
 # The current version of the JSON results
-CURRENT_JSON_VERSION = 9
+CURRENT_JSON_VERSION = 10
 
 # The minimum JSON format supported
 MINIMUM_SUPPORTED_VERSION = 7
 
 # The level to indent a final file
 INDENT = 4
 
 
 def piglit_encoder(obj):
 """ Encoder for piglit that can transform additional classes into json
@@ -139,35 +139,35 @@ class JSONBackend(FileBackend):
 
 # Load the metadata and put it into a dictionary
 with open(os.path.join(self._dest, 'metadata.json'), 'r') as f:
 data.update(json.load(f))
 
 # If there is more metadata add it the dictionary
 if metadata:
 data.update(metadata)
 
 # Add the tests to the dictionary
-data['tests'] = collections.OrderedDict()
+data['results'] = []
 
 for test in file_list:
 test = os.path.join(tests_dir, test)
 if os.path.isfile(test):
 # Try to open the json snippets. If we fail to open a test
 # then throw the whole thing out. This gives us atomic
 # writes, the writing worked and is valid or it didn't
 # work.
 try:
 with open(test, 'r') as f:
-data['tests'].update(json.load(f))
+data['results'].append(json.load(f))
 except ValueError:
 pass
-assert data['tests']
+assert data['results']
 
 data = results.TestrunResult.from_dict(data)
 
 # write out the combined file. Use the compression writer from the
 # FileBackend
 with self._write_final(os.path.join(self._dest, 'results.json')) 
as f:
 json.dump(data, f, default=piglit_encoder, indent=INDENT)
 
 # Otherwise use jsonstreams to write the final dictionary. This uses an
 # external library, but is slightly faster and uses considerably less
@@ -179,40 +179,40 @@ class JSONBackend(FileBackend):
 with jsonstreams.Stream(jsonstreams.Type.object, fd=f, 
indent=4,
 encoder=encoder, pretty=True) as s:
 s.write('__type__', 'TestrunResult')
 

[Piglit] [RFC 06/10] framework: refactor test running to use explicit TestWorkItems and TestRunners

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Factor out the execution of tests into TestRunner objects, to allow
a cleaner approach to running multiple tests without process isolation.

After this patch, which already adapts the shader tests, each individual
test is unaffected by whether process isolation is enabled or not. Instead,
when process isolation is disabled, multiple tests are grouped into work
items that have the same runner. Every work item will result in a single
TestResult object that contains the results for all tests run as part of
that work item.

Additionally, each TestWorkItem has a unique ID which is also stored in
the TestResult object. This is used for resuming test runs: the idea is
that the generation of work items is reproducible, so each work item
can continue working precisely where it left.

This allows resumed test runs to work properly without process isolation.

TODO
- unit tests
- split up: extract some more stand-alone changes e.g. to TestResult
---
 framework/backends/abstract.py |  14 +-
 framework/backends/json.py |  31 ++-
 framework/profile.py   | 101 ++--
 framework/programs/run.py  |  19 +-
 framework/results.py   |   8 +-
 framework/test/base.py | 548 ++---
 framework/test/deqp.py |  44 ++--
 framework/test/gleantest.py|  10 +-
 framework/test/gtest.py|  12 +-
 framework/test/oclconform.py   |   8 +-
 framework/test/piglit_test.py  |  45 +++-
 framework/test/shader_test.py  | 172 ++---
 tests/all.py   |  44 ++--
 tests/deqp_vk.py   |  16 +-
 tests/es3conform.py|   8 +-
 tests/igt.py   |  26 +-
 tests/oglconform.py|  16 +-
 tests/xts.py   |  44 ++--
 18 files changed, 637 insertions(+), 529 deletions(-)

diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index cee7d7bdf..bd44a2ac9 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -184,40 +184,38 @@ class FileBackend(Backend):
 
 @abc.abstractmethod
 def _write(self, f, name, data):
 """Method that writes a TestResult into a result file."""
 
 @abc.abstractproperty
 def _file_extension(self):
 """The file extension of the backend."""
 
 @contextlib.contextmanager
-def write_test(self, test):
-"""Write a test.
+def write_test(self, workitem):
+"""Write a workitem's results.
 
 When this context manager is opened it will first write a placeholder
 file with the status incomplete.
 
 When it is called to write the final result it will create a temporary
 file, write to that file, then move that file over the original,
 incomplete status file. This helps to make the operation atomic, as
 long as the filesystem continues running and the result was valid in
 the original file it will be valid at the end
 
 """
-def finish(val):
+def update():
 tfile = file_ + '.tmp'
 with open(tfile, 'w') as f:
-self._write(f, test.name.lower(), val)
+self._write(f, workitem.results.root, workitem.results)
 self.__fsync(f)
 shutil.move(tfile, file_)
 
 file_ = os.path.join(self._dest, 'tests', '{}.{}'.format(
 next(self._counter), self._file_extension))
 
 with open(file_, 'w') as f:
-incomplete = TestResult(result=INCOMPLETE)
-incomplete.root = test.name
-self._write(f, test.name.lower(), incomplete)
+self._write(f, workitem.results.root, workitem.results)
 self.__fsync(f)
 
-yield finish
+yield update
diff --git a/framework/backends/json.py b/framework/backends/json.py
index 80d82d0ab..1aa14bd1c 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -119,52 +119,62 @@ class JSONBackend(FileBackend):
 pass
 
 def finalize(self, metadata=None):
 """ End json serialization and cleanup
 
 This method is called after all of tests are written, it closes any
 containers that are still open and closes the file
 
 """
 tests_dir = os.path.join(self._dest, 'tests')
+
+# Traverse the files in reverse order, so that later versions of
+# a work item override earlier ones (for resumed test runs).
 file_list = sorted(
 (f for f in os.listdir(tests_dir) if f.endswith('.json')),
-key=lambda p: int(os.path.splitext(p)[0]))
+key=lambda p: int(os.path.splitext(p)[0]),
+reverse=True)
 
 # If jsonstreams is not present then build a complet

[Piglit] [RFC 07/10] framework: add a dEQP runner that can run without process isolation

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/test/deqp.py | 202 ++---
 1 file changed, 141 insertions(+), 61 deletions(-)

diff --git a/framework/test/deqp.py b/framework/test/deqp.py
index 8627feabb..f62d731b1 100644
--- a/framework/test/deqp.py
+++ b/framework/test/deqp.py
@@ -15,34 +15,37 @@
 # 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.
 
 from __future__ import (
 absolute_import, division, print_function, unicode_literals
 )
 import abc
+import collections
 import os
+import re
 import subprocess
 try:
 from lxml import etree as et
 except ImportError:
 from xml.etree import cElementTree as et
 
 import six
 from six.moves import range
 
 from framework import core, grouptools, exceptions
 from framework import options
 from framework.profile import TestProfile
-from framework.test.base import Test, is_crash_returncode, TestRunError
+from framework.results import TestResult
+from framework.test.base import Test, is_crash_returncode, TestRunError, 
TestRunner
 
 __all__ = [
 'DEQPBaseTest',
 'gen_caselist_txt',
 'get_option',
 'iter_deqp_test_cases',
 'make_profile',
 ]
 
 
@@ -75,24 +78,25 @@ def select_source(bin_, filename, mustpass, extra_args):
 if options.OPTIONS.deqp_mustpass:
 return gen_mustpass_tests(mustpass)
 else:
 return iter_deqp_test_cases(
 gen_caselist_txt(bin_, filename, extra_args))
 
 
 def make_profile(test_list, test_class):
 """Create a TestProfile instance."""
 profile = TestProfile()
+runner = DEQPTestRunner()
 for testname in test_list:
 # deqp uses '.' as the testgroup separator.
 piglit_name = testname.replace('.', grouptools.SEPARATOR)
-profile.test_list[piglit_name] = test_class(testname)
+profile.test_list[piglit_name] = test_class(testname, runner)
 
 return profile
 
 
 def gen_mustpass_tests(mp_list):
 """Return a testlist from the mustpass list."""
 root = et.parse(mp_list).getroot()
 group = []
 
 def gen(base):
@@ -146,83 +150,159 @@ def iter_deqp_test_cases(case_file):
 continue
 elif line.startswith('TEST:'):
 yield line[len('TEST:'):].strip()
 else:
 raise exceptions.PiglitFatalError(
 'deqp: {}:{}: ill-formed line'.format(case_file, i))
 
 
 @six.add_metaclass(abc.ABCMeta)
 class DEQPBaseTest(Test):
-__RESULT_MAP = {
-"Pass": "pass",
-"Fail": "fail",
-"QualityWarning": "warn",
-"InternalError": "fail",
-"Crash": "crash",
-"NotSupported": "skip",
-"ResourceError": "crash",
-}
-
 @abc.abstractproperty
 def deqp_bin(self):
 """The path to the exectuable."""
 
 @abc.abstractproperty
 def extra_args(self):
 """Extra arguments to be passed to the each test instance.
 
 Needs to return a list, since self.command uses the '+' operator, which
 only works to join two lists together.
 
 """
 return _EXTRA_ARGS
 
-def __init__(self, case_name):
-command = [self.deqp_bin, '--deqp-case=' + case_name]
-
-super(DEQPBaseTest, self).__init__(command)
-
-# dEQP's working directory must be the same as that of the executable,
-# otherwise it cannot find its data files (2014-12-07).
-# This must be called after super or super will overwrite it
-self.cwd = os.path.dirname(self.deqp_bin)
-
-@Test.command.getter
-def command(self):
-"""Return the command plus any extra arguments."""
-command = super(DEQPBaseTest, self).command
-return command + self.extra_args
-
-def __find_map(self, result):
-"""Run over the lines and set the result."""
-# splitting this into a separate function allows us to return cleanly,
-# otherwise this requires some break/else/continue madness
-for line in result.out.split('\n'):
-line = line.lstrip()
-for k, v in six.iteritems(self.__RESULT_MAP):
-if line.startswith(k):
-result.result = v
-return
-
-def interpret_result(self, result):
-if is_crash_returncode(result.returncode):
-result.result = 'crash'
-elif result.returncode != 0:
-result.result = 'fail'
-else:
-self.__find_map(result)
-
-# We failed to parse the test output. Fallback to 'fail'.
-if result.result == 'notrun':
-result.result = 'fail'
-
-# def _run_command(self, *args, **kwargs):
-# """Rerun the command if X11 connection failure happe

[Piglit] [RFC 08/10] framework/deqp: allow loading a *-master.txt file as mustpass list

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/test/deqp.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/framework/test/deqp.py b/framework/test/deqp.py
index f62d731b1..f54135b0e 100644
--- a/framework/test/deqp.py
+++ b/framework/test/deqp.py
@@ -69,39 +69,49 @@ def get_option(env_varname, config_option, default=None, 
required=False):
 
 
 _EXTRA_ARGS = get_option('PIGLIT_DEQP_EXTRA_ARGS',
  ('deqp', 'extra_args'),
  default='').split()
 
 
 def select_source(bin_, filename, mustpass, extra_args):
 """Return either the mustpass list or the generated list."""
 if options.OPTIONS.deqp_mustpass:
-return gen_mustpass_tests(mustpass)
+if mustpass.endswith('.xml'):
+return gen_mustpass_tests_xml(mustpass)
+
+# Load a *-master.txt list.
+tests = []
+with open(mustpass, 'r') as filp:
+for line in filp:
+line = line.strip()
+if line:
+tests.append(line)
+return tests
 else:
 return iter_deqp_test_cases(
 gen_caselist_txt(bin_, filename, extra_args))
 
 
 def make_profile(test_list, test_class):
 """Create a TestProfile instance."""
 profile = TestProfile()
 runner = DEQPTestRunner()
 for testname in test_list:
 # deqp uses '.' as the testgroup separator.
 piglit_name = testname.replace('.', grouptools.SEPARATOR)
 profile.test_list[piglit_name] = test_class(testname, runner)
 
 return profile
 
 
-def gen_mustpass_tests(mp_list):
+def gen_mustpass_tests_xml(mp_list):
 """Return a testlist from the mustpass list."""
 root = et.parse(mp_list).getroot()
 group = []
 
 def gen(base):
 for elem in base:
 if elem.tag == 'Test':
 yield '{}.{}'.format('.'.join(group), elem.get('name'))
 else:
 group.append(elem.get('name'))
-- 
2.11.0

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


[Piglit] [PATCH 7/7] shader_runner: don't use glMapNamedBufferRange

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

We want to be able to run atomic counter tests even when the DSA
entry points are unavailable (e.g. in GLES).
---
 tests/shaders/shader_runner.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 625521cc0..a1e1597cc 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2829,42 +2829,43 @@ static bool
 probe_atomic_counter(unsigned buffer_num, GLint counter_num, const char *op, 
uint32_t value)
 {
 uint32_t *p;
uint32_t observed;
enum comparison cmp;
bool result;
 
REQUIRE(parse_comparison_op(op, &cmp, NULL),
"Invalid comparison operation at: %s\n", op);
 
-   p = glMapNamedBufferRange(atomics_bos[buffer_num], counter_num * 
sizeof(uint32_t),
+   glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, atomics_bos[buffer_num]);
+   p = glMapBufferRange(GL_ATOMIC_COUNTER_BUFFER, counter_num * 
sizeof(uint32_t),
 sizeof(uint32_t), GL_MAP_READ_BIT);
 
 if (!p) {
 printf("Couldn't map atomic counter to verify expected 
value.\n");
 return false;
 }
 
observed = *p;
result = compare_uint(value, observed, cmp);
 
if (!result) {
printf("Atomic counter %d test failed: Reference %s Observed\n",
   counter_num, comparison_string(cmp));
printf("  Reference: %u\n", value);
printf("  Observed:  %u\n", observed);
-   glUnmapNamedBuffer(atomics_bos[buffer_num]);
+   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
return false;
-}
+   }
 
-glUnmapNamedBuffer(atomics_bos[buffer_num]);
-return true;
+   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
+   return true;
 }
 
 static bool
 probe_ssbo_uint(GLint ssbo_index, GLint ssbo_offset, const char *op, uint32_t 
value)
 {
uint32_t *p;
uint32_t observed;
enum comparison cmp;
bool result;
 
-- 
2.11.0

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


[Piglit] [PATCH 6/7] tests/deqp: remove redundant constructors

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/deqp_gles3.py | 4 
 tests/deqp_vk.py| 3 ---
 2 files changed, 7 deletions(-)

diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py
index 210c6e4ed..6441a9600 100644
--- a/tests/deqp_gles3.py
+++ b/tests/deqp_gles3.py
@@ -81,18 +81,14 @@ _EXTRA_ARGS = 
deqp.get_option('PIGLIT_DEQP_GLES3_EXTRA_ARGS',
 
 class DEQPGLES3Test(deqp.DEQPBaseTest):
 deqp_bin = _DEQP_GLES3_BIN
 
 @property
 def extra_args(self):
 return super(DEQPGLES3Test, self).extra_args + \
 [x for x in _EXTRA_ARGS if not x.startswith('--deqp-case')]
 
 
-def __init__(self, *args, **kwargs):
-super(DEQPGLES3Test, self).__init__(*args, **kwargs)
-
-
 profile = deqp.make_profile(  # pylint: disable=invalid-name
 deqp.select_source(_DEQP_GLES3_BIN, 'dEQP-GLES3-cases.txt', _DEQP_MUSTPASS,
_EXTRA_ARGS),
 DEQPGLES3Test)
diff --git a/tests/deqp_vk.py b/tests/deqp_vk.py
index 4df9e3b63..1f3d58d38 100644
--- a/tests/deqp_vk.py
+++ b/tests/deqp_vk.py
@@ -48,23 +48,20 @@ _DEQP_ASSERT = re.compile(
 
 class DEQPVKTest(deqp.DEQPBaseTest):
 """Test representation for Khronos Vulkan CTS."""
 timeout = 60
 deqp_bin = _DEQP_VK_BIN
 @property
 def extra_args(self):
 return super(DEQPVKTest, self).extra_args + \
 [x for x in _EXTRA_ARGS if not x.startswith('--deqp-case')]
 
-def __init__(self, *args, **kwargs):
-super(DEQPVKTest, self).__init__(*args, **kwargs)
-
 def interpret_result(self):
 if 'Failed to compile shader at vkGlslToSpirV' in self.result.out:
 self.result.result = 'skip'
 self.result.out += \
 '\n\nMarked as skip because GLSLang failed to compile shaders'
 elif _DEQP_ASSERT.search(self.result.err):
 self.result.result = 'skip'
 self.result.out += \
 '\n\nMarked as skip because of a internal dEQP assertion'
 else:
-- 
2.11.0

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


[Piglit] [PATCH 5/7] framework: remove outdated comment

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

TestrunResult.from_dict is indeed used at the end of the function.
---
 framework/backends/json.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index 440202612..882169e09 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -266,21 +266,20 @@ def _load(results_file):
 raise exceptions.PiglitFatalError(
 'While loading json results file: "{}",\n'
 'the following error occurred:\n{}'.format(results_file.name,
six.text_type(e)))
 
 return result
 
 
 def _resume(results_dir):
 """Loads a partially completed json results directory."""
-# TODO: could probably use TestrunResult.from_dict here
 # Pylint can't infer that the json being loaded is a dict
 # pylint: disable=maybe-no-member
 assert os.path.isdir(results_dir), \
 "TestrunResult.resume() requires a directory"
 
 # Load the metadata
 with open(os.path.join(results_dir, 'metadata.json'), 'r') as f:
 meta = json.load(f)
 assert meta['results_version'] == CURRENT_JSON_VERSION, \
 "Old results version, resume impossible"
-- 
2.11.0

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


[Piglit] [PATCH 4/7] framework: fix a comment

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/profile.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 53358868b..a19b4d2d2 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -365,22 +365,22 @@ def load_test_profile(filename):
 'Did you specify the right file?'.format(filename))
 
 
 def run(profiles, logger, backend, concurrency):
 """Runs all tests using Thread pool.
 
 When called this method will flatten out self.tests into self.test_list,
 then will prepare a logger, and begin executing tests through it's Thread
 pools.
 
-Based on the value of options.OPTIONS.concurrent it will either run all the
-tests concurrently, all serially, or first the thread safe tests then the
+Based on the value of concurrency it will either run all the tests
+concurrently, all serially, or first the thread safe tests then the
 serial tests.
 
 Finally it will print a final summary of the tests.
 
 Arguments:
 profiles -- a list of Profile instances.
 logger   -- a log.LogManager instance.
 backend  -- a results.Backend derived instance.
 """
 chunksize = 1
-- 
2.11.0

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


[Piglit] [PATCH 1/7] framework: fix typos in comments

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/backends/abstract.py | 2 +-
 framework/backends/json.py | 8 
 framework/core.py  | 2 +-
 framework/grouptools.py| 2 +-
 framework/profile.py   | 2 +-
 framework/results.py   | 2 +-
 framework/summary/common.py| 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index 13a7b6707..85abfa52d 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -192,21 +192,21 @@ class FileBackend(Backend):
 def _file_extension(self):
 """The file extension of the backend."""
 
 @contextlib.contextmanager
 def write_test(self, name):
 """Write a test.
 
 When this context manager is opened it will first write a placeholder
 file with the status incomplete.
 
-When it is called to write the finall result it will create a temporary
+When it is called to write the final result it will create a temporary
 file, write to that file, then move that file over the original,
 incomplete status file. This helps to make the operation atomic, as
 long as the filesystem continues running and the result was valid in
 the original file it will be valid at the end
 
 """
 def finish(val):
 tfile = file_ + '.tmp'
 with open(tfile, 'w') as f:
 self._write(f, name, val)
diff --git a/framework/backends/json.py b/framework/backends/json.py
index dd08bf053..c810dcaa5 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -76,21 +76,21 @@ def piglit_encoder(obj):
 return obj.to_json()
 return obj
 
 
 class JSONBackend(FileBackend):
 """ Piglit's native JSON backend
 
 This writes out to piglit's native json backend. This class uses the python
 json module or the simplejson.
 
-This class is atomic, writes either completely fail or completley succeed.
+This class is atomic, writes either completely fail or completely succeed.
 To achieve this it writes individual files for each test and for the
 metadata, and composes them at the end into a single file and removes the
 intermediate files. When it tries to compose these files if it cannot read
 a file it just ignores it, making the result atomic.
 
 """
 _file_extension = 'json'
 
 def initialize(self, metadata):
 """ Write boilerplate json code
@@ -298,23 +298,23 @@ def _resume(results_dir):
 with open(os.path.join(tests_dir, file_), 'r') as f:
 try:
 meta['tests'].update(json.load(f))
 except ValueError:
 continue
 
 return results.TestrunResult.from_dict(meta)
 
 
 def _update_results(results, filepath):
-""" Update results to the lastest version
+""" Update results to the latest version
 
-This function is a wraper for other update_* functions, providing
+This function is a wrapper for other update_* functions, providing
 incremental updates from one version to another.
 
 Arguments:
 results -- a TestrunResults instance
 filepath -- the name of the file that the Testrunresults instance was
 created from
 
 """
 
 def loop_updates(results):
@@ -349,21 +349,21 @@ def _update_results(results, filepath):
 os.rename(filepath, filepath + '.old')
 _write(results, filepath)
 except OSError:
 print("WARNING: Could not write updated results {}".format(filepath),
   file=sys.stderr)
 
 return results
 
 
 def _write(results, file_):
-"""WRite the values of the results out to a file."""
+"""Write the values of the results out to a file."""
 with write_compressed(file_) as f:
 json.dump(results, f, default=piglit_encoder, indent=INDENT)
 
 
 def _update_seven_to_eight(result):
 """Update json results from version 7 to 8.
 
 This update replaces the time attribute float with a TimeAttribute object,
 which stores a start time and an end time, and provides methods for getting
 total and delta.
diff --git a/framework/core.py b/framework/core.py
index 9abc1284c..61643af95 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -213,20 +213,20 @@ def parse_listfile(filename):
 
 class lazy_property(object):  # pylint: 
disable=invalid-name,too-few-public-methods
 """Descriptor that replaces the function it wraps with the value generated.
 
 This makes a property that is truly lazy, it is calculated once on demand,
 and stored. This makes this very useful

[Piglit] [PATCH 0/7] framework, shader_runner: misc fixed and cleanups

2017-10-11 Thread Nicolai Hähnle
Hi all,

Mostly no-op changes in comments, but a few functional changes as well.

Please review!
Thanks,
Nicolai
--
 framework/backends/abstract.py |  2 +-
 framework/backends/json.py | 12 +---
 framework/core.py  |  2 +-
 framework/grouptools.py|  2 +-
 framework/profile.py   |  6 +++---
 framework/results.py   |  2 +-
 framework/summary/common.py|  2 +-
 framework/test/base.py |  2 +-
 tests/deqp_gles3.py|  4 
 tests/deqp_vk.py   |  3 ---
 tests/shaders/shader_runner.c  | 11 ++-
 11 files changed, 20 insertions(+), 28 deletions(-)

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


[Piglit] [PATCH 3/7] framework: fix outdated comment

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 framework/backends/json.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index c810dcaa5..440202612 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -223,22 +223,21 @@ def load_results(filename, compression_):
 if not os.path.isdir(filename):
 filepath = filename
 elif (os.path.exists(os.path.join(filename, 'metadata.json')) and
   not os.path.exists(os.path.join(
   filename, 'results.json.' + compression_))):
 # We want to hit this path only if there isn't a
 # results.json., since otherwise we'll continually
 # regenerate values that we don't need to.
 return _resume(filename)
 else:
-# Look for a compressed result first, then a bare result, finally for
-# an old main file
+# Look for a compressed result first, then a bare result.
 for name in ['results.json.{}'.format(compression_), 'results.json']:
 if os.path.exists(os.path.join(filename, name)):
 filepath = os.path.join(filename, name)
 break
 else:
 raise exceptions.PiglitFatalError(
 'No results found in "{}" (compression: {})'.format(
 filename, compression_))
 
 assert compression_ in compression.COMPRESSORS, \
-- 
2.11.0

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


[Piglit] [PATCH 2/7] framework: fix a comment

2017-10-11 Thread Nicolai Hähnle
From: Nicolai Hähnle 

See ReducedProcessMixin._run_command:

if not self._is_cherry():
... rerun path ...
---
 framework/test/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/test/base.py b/framework/test/base.py
index e74ea3d38..0b7ebab2e 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -552,21 +552,21 @@ class ReducedProcessMixin(object):
 # Restore and keep the original returncode (so that it remains a
 # non-pass, since only one test might fail and the resumed part
 # might return 0)
 self.result.returncode = returncode
 self.result.out = '\n\nRESUME\n\n'.join(out)
 self.result.err = '\n\nRESUME\n\n'.join(err)
 
 def _is_cherry(self):
 """Method used to determine if rerunning is required.
 
-If this returns True then the rerun path will be entered, otherwise
+If this returns False then the rerun path will be entered, otherwise
 _run_command is effectively a bare call to super().
 
 Classes using this mixin may need to overwrite this if the binary
 they're calling can stop prematurely but return 0.
 """
 return self.result.returncode == 0
 
 def _populate_subtests(self):
 """Default implementation of subtest prepopulation.
 
-- 
2.11.0

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


[Piglit] [PATCH] arb_gpu_shader_int64: test two operands with indirect access simultaneously

2017-10-06 Thread Nicolai Hähnle
From: Nicolai Hähnle 

This hits a bug in Mesa st/glsl_to_tgsi.
---
 .../indirect-array-two-accesses.shader_test| 61 ++
 1 file changed, 61 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test

diff --git 
a/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
 
b/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
new file mode 100644
index 0..e48f20c50
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
@@ -0,0 +1,61 @@
+# Test an i64vec4 arithmetic operation that uses indirect array accesses in
+# both operands.
+
+[require]
+GLSL >= 1.40
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 140
+
+#extension GL_ARB_gpu_shader_int64: require
+
+uniform int u_src[5];
+uniform int u_idx1, u_idx2;
+uniform ivec4 u_expected;
+
+out vec4 outcolor;
+
+void main() {
+  i64vec4 t[5];
+  for (int i = 0; i < 5; ++i) {
+for (int j = 0; j < 4; ++j)
+  t[i][j] = int(u_src[i]) + j;
+  }
+
+  i64vec4 sum = t[u_idx1] + t[u_idx2];
+
+  outcolor = vec4(0, 1, 0, 1);
+  for (int i = 0; i < 4; ++i) {
+if (sum[i] != u_expected[i])
+  outcolor = vec4(1, float(i) / 255,
+  float(sum[i]) / 255,
+  float(u_expected[i]) / 255);
+  }
+}
+
+[test]
+clear color 0.0 0.0 0.0 1.0
+clear
+
+uniform int u_src[0] 12
+uniform int u_src[1] 3
+uniform int u_src[2] 7
+uniform int u_src[3] 19
+uniform int u_src[4] 11
+
+uniform int u_idx1 1
+uniform int u_idx2 4
+uniform ivec4 u_expected 14 16 18 20
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
+
+uniform int u_idx1 0
+uniform int u_idx2 2
+uniform ivec4 u_expected 19 21 23 25
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
-- 
2.11.0

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


[Piglit] [PATCH] arb_gpu_shader_fp64: add tests for frexp() corner cases

2017-10-06 Thread Nicolai Hähnle
From: Nicolai Hähnle 

The only-{exponent,mantissa} tests hit a bug in Mesa's st/glsl_to_tgsi.
---
 .../fs-frexp-dvec4-only-exponent.shader_test   | 37 +
 .../fs-frexp-dvec4-only-mantissa.shader_test   | 38 +
 .../fs-frexp-dvec4-variable-index.shader_test  | 64 ++
 3 files changed, 139 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test

diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
new file mode 100644
index 0..d7dc64032
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.40
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+uniform dvec4 u_in;
+uniform ivec4 u_exponent;
+
+out vec4 outcolor;
+
+void main()
+{
+  outcolor = vec4(0, 1, 0, 1);
+
+  ivec4 exponent;
+  frexp(u_in, exponent);
+
+  for (int i = 0; i < 4; ++i) {
+if (exponent[i] != u_exponent[i])
+  outcolor = vec4(1.0, float(i) / 255,
+  float(exponent[i] + 127) / 255, float(u_exponent[i] + 
127) / 255);
+  }
+}
+
+[test]
+clear color 0 0 0 1
+clear
+
+uniform dvec4 u_in 2 3 4 9
+uniform ivec4 u_exponent 1 1 2 3
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test
new file mode 100644
index 0..3d7a3f2dc
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test
@@ -0,0 +1,38 @@
+[require]
+GLSL >= 1.40
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+uniform dvec4 u_in;
+uniform dvec4 u_mantissa;
+
+out vec4 outcolor;
+
+void main()
+{
+  outcolor = vec4(0, 1, 0, 1);
+
+  ivec4 exponent;
+  dvec4 mantissa;
+  mantissa = frexp(u_in, exponent);
+
+  for (int i = 0; i < 4; ++i) {
+if (mantissa[i] != u_mantissa[i])
+  outcolor = vec4(1.0, float(i) / 255,
+  float(mantissa[i]), float(u_mantissa[i]));
+  }
+}
+
+[test]
+clear color 0 0 0 1
+clear
+
+uniform dvec4 u_in 2 3 4 5
+uniform dvec4 u_mantissa 0.5 0.75 0.5 0.625
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test
new file mode 100644
index 0..c3912bf9d
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test
@@ -0,0 +1,64 @@
+[require]
+GLSL >= 1.40
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+uniform dvec4 u_in[2];
+uniform dvec4 u_mantissa[2];
+uniform ivec4 u_exponent[2];
+uniform int u_xor_mantissa;
+uniform int u_xor_exponent;
+
+out vec4 outcolor;
+
+void main()
+{
+  outcolor = vec4(0, 1, 0, 1);
+
+  ivec4 exponent[2];
+  dvec4 mantissa[2];
+
+  for (int i = 0; i < 2; ++i)
+mantissa[i ^ u_xor_mantissa] = frexp(u_in[i], exponent[i ^ 
u_xor_exponent]);
+
+  for (int i = 0; i < 2; ++i) {
+for (int j = 0; j < 4; ++j) {
+  if (mantissa[i][j] != u_mantissa[i][j] ||
+  exponent[i][j] != u_exponent[i][j])
+outcolor = vec4(1.0, float(i * 4 + j) / 255,
+float(exponent[i][j] + 127) / 255, 
float(mantissa[i][j]));
+}
+  }
+}
+
+[test]
+clear color 0 0 0 1
+clear
+
+uniform dvec4 u_in[0] 1 2 3 4
+uniform dvec4 u_in[1] 5 6 7 8
+uniform int u_xor_mantissa 0
+uniform int u_xor_exponent 0
+uniform dvec4 u_mantissa[0] 0.5 0.5 0.75 0.5
+uniform dvec4 u_mantissa[1] 0.625 0.75 0.875 0.5
+uniform ivec4 u_exponent[0] 1 2 2 3
+uniform ivec4 u_exponent[1] 3 3 3 4
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
+
+uniform dvec4 u_in[0] 12 16 24 32
+uniform dvec4 u_in[1] 40 64 80 128
+uniform int u_xor_mantissa 0
+uniform int u_xor_exponent 1
+uniform dvec4 u_mantissa[0] 0.75 0.5 0.75 0.5
+uniform dvec4 u_mantissa[1] 0.625 0.5 0.625 0.5
+uniform ivec4 u_exponent[1] 4 5 5 6
+uniform ivec4 u_exponent[0] 6 7 7 8
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
-- 
2.11.0

_

[Piglit] [PATCH] fbo-viewport: fix false error caused by slight rounding differences

2017-09-29 Thread Nicolai Hähnle
From: Nicolai Hähnle 

This test compares rendering to the window system framebuffer with
rendering to an FBO, and it does so by rendering rotated quads. There
can be slight differences in rounding if the Y axis is flipped between
those buffers causing rendering differences which are permitted by GL.

Change the test to render axis-aligned quads in each viewport instead.
This should still catch any error with flipped Ys, and there are no
rounding issues since pixels are fully covered by quads.
---
 tests/fbo/fbo-viewport.c | 37 +++--
 1 file changed, 11 insertions(+), 26 deletions(-)

diff --git a/tests/fbo/fbo-viewport.c b/tests/fbo/fbo-viewport.c
index 82d9f04f4..b2e351ce1 100644
--- a/tests/fbo/fbo-viewport.c
+++ b/tests/fbo/fbo-viewport.c
@@ -36,80 +36,65 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 10;
 
config.window_width = 500;
config.window_height = 500;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
 
 PIGLIT_GL_TEST_CONFIG_END
 
 /**
- * Draw some simple quads in a bunch of viewports which tile the window.
+ * Draw full-viewport quads in a bunch of viewports which tile the window.
  * Note that viewports extend beyond the edges of the window too.
  */
 static void
 draw_test_image(void)
 {
int vx, vy, vw = 200, vh = 200;
 
glClear(GL_COLOR_BUFFER_BIT);
 
-   glMatrixMode(GL_PROJECTION);
-   glLoadIdentity();
-   glFrustum(-1, 1, -1, 1, 3, 9.5);
-
-   /* Draw some quads at an odd rotation.
-* Note that we want near/far frustum clipping.
-*/
-   glMatrixMode(GL_MODELVIEW);
-   glPushMatrix();
-   glTranslatef(0, 1, -6.20);
-   glRotatef(-60, 1, 0, 0);
-   glRotatef(30, 0, 0, 1);
-   glScalef(3.5, 3.5, 3.5);
-
/* loop over viewports */
+   int i = 1;
for (vy = -50; vy < piglit_height; vy += vh+10) {
-   for (vx = -30; vx < piglit_width; vx += vw+10) {
+   for (vx = -30; vx < piglit_width; vx += vw+10, ++i) {
glViewport(vx, vy, vw, vh);
 
glBegin(GL_QUADS);
 
-   glColor3f(1, 0, 0);
+   glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.0);
glVertex2f(-1, -1);
glVertex2f( 0, -1);
glVertex2f( 0,  0);
glVertex2f(-1,  0);
 
-   glColor3f(0, 1, 0);
+   glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.333);
glVertex2f( 0, -1);
glVertex2f( 1, -1);
glVertex2f( 1,  0);
glVertex2f( 0,  0);
 
-   glColor3f(0, 0, 1);
-   glVertex2f(-1,  0);
+   glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.666);
glVertex2f( 0,  0);
+   glVertex2f( 1,  0);
+   glVertex2f( 1,  1);
glVertex2f( 0,  1);
-   glVertex2f(-1,  1);
 
-   glColor3f(1, 1, 1);
+   glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 1.0);
+   glVertex2f(-1,  0);
glVertex2f( 0,  0);
-   glVertex2f( 1,  0);
-   glVertex2f( 1,  1);
glVertex2f( 0,  1);
+   glVertex2f(-1,  1);
 
glEnd();
}
}
-
-   glPopMatrix();
 }
 
 
 enum piglit_result
 piglit_display(void)
 {
GLubyte *win_image, *fbo_image;
GLuint fbo, rb;
bool pass = true;
 
-- 
2.11.0

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


Re: [Piglit] [PATCH] arb_texture_query_lod: add tolerance for some comparisons

2017-09-19 Thread Nicolai Hähnle

Seems reasonable.

Reviewed-by: Nicolai Hähnle 


On 15.09.2017 00:59, Roland Scheidegger wrote:

ping?

Am 09.09.2017 um 07:31 schrieb srol...@vmware.com:

From: Roland Scheidegger 

Tolerance was added for the tests a while ago, but it looks like it was
forgotten for the nearest_biased test (the nearest one has it).
Also, for the linear test, add tolerance too when comparing x and y lodq
results - the values should probably be the same mostly, however it's possible
(due to interpolation inaccuracies) to get values just below 0 or above 3, in
which case they will get clamped. (Could just do a clamp instead of allowing
tolerance I suppose, but some tolerance might be allowed in any case there
too.)

This is required for llvmpipe (with a in-progress change) to pass.
---
  .../execution/fs-textureQueryLOD-linear.shader_test | 2 +-
  .../execution/fs-textureQueryLOD-nearest-biased.shader_test | 6 +-
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
 
b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
index 6afef71..bb2d8ba 100644
--- 
a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
+++ 
b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
@@ -60,7 +60,7 @@ void main()
  }
  
  vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);

-if (queried_lod.x != queried_lod.y) {
+if (!equal(queried_lod.x, queried_lod.y)) {
discard;
  }
  if (!equal(queried_lod.x, lod)) {
diff --git 
a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
 
b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
index 1e0c557..4487930 100644
--- 
a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
+++ 
b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
@@ -51,6 +51,10 @@ GL_ARB_texture_query_lod
  #define MAX_MIPMAP_LEVEL 3
  uniform sampler2D tex;
  uniform float lod;
+
+#define tolerance (1.0/255.0)
+#define equal(x,y) (abs((x) - (y)) <= tolerance)
+
  void main()
  {
  /* The ARB_texture_query_lod spec says that if TEXTURE_MIN_FILTER is set
@@ -69,7 +73,7 @@ void main()
  }
  
  vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);

-if (queried_lod.x != min(queried_lod.y, MAX_MIPMAP_LEVEL)) {
+if (!equal(queried_lod.x, min(queried_lod.y, MAX_MIPMAP_LEVEL))) {
discard;
  }
  if (queried_lod.x != min(nearest_lod + 1, MAX_MIPMAP_LEVEL)) {



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




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] arb_sample_shading: run more tests concurrently

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

There doesn't seem to be a reason for not running those tests
concurrently. Looks like they were just missed.
---
 tests/all.py | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 286c01eee..404c13f3e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2325,25 +2325,23 @@ with profile.test_list.group_manager(
   'builtin-gl-sample-id {}'.format(num_samples), run_concurrent=False)
 g(['arb_sample_shading-builtin-gl-sample-mask', num_samples],
   'builtin-gl-sample-mask {}'.format(num_samples),
   run_concurrent=False)
 g(['arb_sample_shading-builtin-gl-sample-position', num_samples],
   'builtin-gl-sample-position {}'.format(num_samples),
   run_concurrent=False)
 
 for sample_count in MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-interpolate-at-sample-position', sample_count],
-  'interpolate-at-sample-position {}'.format(sample_count),
-  run_concurrent=False)
+  'interpolate-at-sample-position {}'.format(sample_count))
 g(['arb_sample_shading-ignore-centroid-qualifier', sample_count],
-  'ignore-centroid-qualifier {}'.format(sample_count),
-  run_concurrent=False)
+  'ignore-centroid-qualifier {}'.format(sample_count))
 g(['arb_sample_shading-samplemask', sample_count, 'all', 'all'],
   'samplemask {}'.format(sample_count))
 
 for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-builtin-gl-sample-mask-simple',
num_samples],
   'builtin-gl-sample-mask-simple {}'.format(num_samples))
 g(['arb_sample_shading-samplemask', num_samples, 'all'],
   'samplemask {} all'.format(num_samples))
 
-- 
2.11.0

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


[Piglit] [PATCH 1/2] arb_sample_shading: add more extensive gl_SampleMask(In) tests

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Test the interaction of gl_SampleMask and gl_SampleMaskIn with different
sample shading rates. It used to fail on radeonsi.
---
 tests/all.py   |   4 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../arb_sample_shading/execution/samplemask.cpp| 452 +
 3 files changed, 457 insertions(+)
 create mode 100644 tests/spec/arb_sample_shading/execution/samplemask.cpp

diff --git a/tests/all.py b/tests/all.py
index ff2ff1f23..286c01eee 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2330,25 +2330,29 @@ with profile.test_list.group_manager(
   'builtin-gl-sample-position {}'.format(num_samples),
   run_concurrent=False)
 
 for sample_count in MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-interpolate-at-sample-position', sample_count],
   'interpolate-at-sample-position {}'.format(sample_count),
   run_concurrent=False)
 g(['arb_sample_shading-ignore-centroid-qualifier', sample_count],
   'ignore-centroid-qualifier {}'.format(sample_count),
   run_concurrent=False)
+g(['arb_sample_shading-samplemask', sample_count, 'all', 'all'],
+  'samplemask {}'.format(sample_count))
 
 for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-builtin-gl-sample-mask-simple',
num_samples],
   'builtin-gl-sample-mask-simple {}'.format(num_samples))
+g(['arb_sample_shading-samplemask', num_samples, 'all'],
+  'samplemask {} all'.format(num_samples))
 
 g(['arb_sample_shading-builtin-gl-sample-mask-mrt-alpha'])
 
 # Group ARB_debug_output
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_debug_output')) as g:
 g(['arb_debug_output-api_error'], run_concurrent=False)
 
 # Group KHR_debug
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index 3752da78b..124c03022 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -11,11 +11,12 @@ link_libraries (
 
 piglit_add_executable (arb_sample_shading-api api.c)
 piglit_add_executable (arb_sample_shading-builtin-gl-num-samples 
builtin-gl-num-samples.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-id 
builtin-gl-sample-id.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask 
builtin-gl-sample-mask.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask-simple 
builtin-gl-sample-mask-simple.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask-mrt-alpha 
builtin-gl-sample-mask-mrt-alpha.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-position 
builtin-gl-sample-position.cpp)
 piglit_add_executable (arb_sample_shading-interpolate-at-sample-position 
interpolate-at-sample-position.cpp)
 piglit_add_executable (arb_sample_shading-ignore-centroid-qualifier 
ignore-centroid-qualifier.cpp)
+piglit_add_executable (arb_sample_shading-samplemask samplemask.cpp)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_sample_shading/execution/samplemask.cpp 
b/tests/spec/arb_sample_shading/execution/samplemask.cpp
new file mode 100644
index 0..ab593cf12
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/samplemask.cpp
@@ -0,0 +1,452 @@
+/*
+ * Copyright 2017 Advanced Micro Devices, Inc.
+ *
+ * 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 samplemask.c
+ *
+ * Test two properties of gl_SampleMask and gl_SampleMaskIn for different
+ * sample rates, while rendering a slightly of

[Piglit] [PATCH 1/2] arb_query_buffer_object: extract some common code for running queries

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../spec/arb_query_buffer_object/CMakeLists.gl.txt |   2 +-
 tests/spec/arb_query_buffer_object/common.c| 169 +
 tests/spec/arb_query_buffer_object/common.h|  58 +++
 tests/spec/arb_query_buffer_object/qbo.c   | 140 ++---
 4 files changed, 240 insertions(+), 129 deletions(-)
 create mode 100644 tests/spec/arb_query_buffer_object/common.c
 create mode 100644 tests/spec/arb_query_buffer_object/common.h

diff --git a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
index 9a3d202c0..30a545546 100644
--- a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
@@ -1,13 +1,13 @@
 include_directories(
${GLEXT_INCLUDE_DIR}
${OPENGL_INCLUDE_PATH}
)
 
 link_libraries(
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
)
 
-piglit_add_executable(arb_query_buffer_object-qbo qbo.c)
+piglit_add_executable(arb_query_buffer_object-qbo qbo.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_query_buffer_object/common.c 
b/tests/spec/arb_query_buffer_object/common.c
new file mode 100644
index 0..cd6bd4787
--- /dev/null
+++ b/tests/spec/arb_query_buffer_object/common.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright © 2015 Glenn Kennard
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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.
+ *
+ */
+
+#include "common.h"
+
+static int prog;
+
+/* Note: meaningful test cases (with non-zero values) for the following are
+ * missing:
+ *  - GL_COMPUTE_SHADER_INVOCATIONS_ARB
+ *  - GL_GEOMETRY_SHADER_INVOCATIONS
+ *  - GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB
+ *  - GL_TESS_CONTROL_SHADER_PATCHES_ARB
+ *  - GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB
+ *  - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
+ */
+const struct query_type_desc query_types[] = {
+   { GL_ANY_SAMPLES_PASSED,{ 
"GL_ARB_occlusion_query2", NULL } },
+   { GL_ANY_SAMPLES_PASSED_CONSERVATIVE,   { 
"GL_ARB_ES3_compatibility", NULL } },
+   { GL_CLIPPING_INPUT_PRIMITIVES_ARB, { 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_CLIPPING_OUTPUT_PRIMITIVES_ARB,{ 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_COMPUTE_SHADER_INVOCATIONS_ARB,{ 
"GL_ARB_pipeline_statistics_query", "GL_ARB_compute_shader" } },
+   { GL_FRAGMENT_SHADER_INVOCATIONS_ARB,   { 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_GEOMETRY_SHADER_INVOCATIONS,   { 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB,{ 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_PRIMITIVES_GENERATED,  { NULL, } },
+   { GL_PRIMITIVES_SUBMITTED_ARB,  { 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_SAMPLES_PASSED_ARB,{ NULL, } },
+   { GL_TESS_CONTROL_SHADER_PATCHES_ARB,   { 
"GL_ARB_pipeline_statistics_query", "GL_ARB_tessellation_shader" } },
+   { GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB,{ 
"GL_ARB_pipeline_statistics_query", "GL_ARB_tessellation_shader" } },
+   { GL_TIMESTAMP, { "GL_ARB_timer_query", 
NULL } },
+   { GL_TIME_ELAPSED,  { "GL_ARB_timer_query", 
NULL } },
+   { GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, { NULL, } },
+   { GL_VERTEX_SHADER_INVOCATIONS_ARB, { 
"GL_ARB_pipeline_statistics_query", NULL } },
+   { GL_VERTICES_SUBMITTED_ARB,{ 

[Piglit] [PATCH 2/2] arb_query_buffer_object: add additional coherency tests

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

The existing tests only test that shaders receive the query result.
The new tests also check for earlier pipeline stages.
---
 tests/all.py   |   1 +
 .../spec/arb_query_buffer_object/CMakeLists.gl.txt |   1 +
 tests/spec/arb_query_buffer_object/coherency.c | 441 +
 3 files changed, 443 insertions(+)
 create mode 100644 tests/spec/arb_query_buffer_object/coherency.c

diff --git a/tests/all.py b/tests/all.py
index ff2ff1f23..6b751c49d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4878,20 +4878,21 @@ with profile.test_list.group_manager(
 g(['arb_vertex_attrib_64bit-getactiveattrib'], 'getactiveattrib')
 g(['arb_vertex_attrib_64bit-max-vertex-attrib'], 'max-vertex-attrib')
 for test_type in ('shader', 'api'):
 g(['arb_vertex_attrib_64bit-overlapping-locations', test_type],
   run_concurrent=False)
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_query_buffer_object')) as g:
 g(['arb_query_buffer_object-qbo'], 'qbo')
+g(['arb_query_buffer_object-coherency'], 'coherency')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_framebuffer_blit')) as g:
 g(['ext_framebuffer_blit-blit-early'], 'blit-early')
 
 # Group OES_draw_elements_base_vertex
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'OES_draw_elements_base_vertex')) as g:
diff --git a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
index 30a545546..82484c81e 100644
--- a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
@@ -2,12 +2,13 @@ include_directories(
${GLEXT_INCLUDE_DIR}
${OPENGL_INCLUDE_PATH}
)
 
 link_libraries(
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
)
 
 piglit_add_executable(arb_query_buffer_object-qbo qbo.c common.c)
+piglit_add_executable(arb_query_buffer_object-coherency coherency.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_query_buffer_object/coherency.c 
b/tests/spec/arb_query_buffer_object/coherency.c
new file mode 100644
index 0..834daba0d
--- /dev/null
+++ b/tests/spec/arb_query_buffer_object/coherency.c
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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 qbo-coherency.c
+ * Test coherency of ARB_query_buffer_object results with pre-shader pipeline
+ * stages:
+ *  1. Indirect draw
+ * Write the qbo result to the 'first' member of the indirect draw
+ * structure, and write the gl_VertexID to a transform feedback buffer.
+ *  2. Index buffer fetch
+ * Write the qbo result to the index buffer, and write the gl_VertexID to
+ * a transform feedback buffer.
+ *  3. Indirect draw count
+ * Write the qbo result to the 'drawcount' value for an
+ * GL_ARB_indirect_parameters multi-draw, and increment an atomic counter
+ * in the vertex shader.
+ *  4. Indirect dispatch
+ * Write the qbo result to the number of groups, and count the groups using
+ * an atomic counter.
+ */
+
+#include "common.h"
+
+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_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+PIGLIT_GL_TEST_CONFIG_END
+
+#define BUFFER_OFFSET(i) ((void *)((char *)NULL + i))
+
+#define DRAW_COUNT_CLAMP

[Piglit] [PATCH] arb_arrays_of_arrays: remove an unused variable

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../execution/atomic_counters/fs-indirect-index.shader_test  | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
 
b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
index dae9686ad..39dc268df 100644
--- 
a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
+++ 
b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
@@ -11,21 +11,20 @@ GL_ARB_arrays_of_arrays
 [fragment shader]
 #version 140
 #extension GL_ARB_shader_atomic_counters: require
 #extension GL_ARB_arrays_of_arrays: require
 
 layout(binding = 0) uniform atomic_uint a0[2][4];
 
 uniform int n;
 uniform int m;
 
-in vec4 vcolor;
 out vec4 fcolor;
 
 void main()
 {
bool passed = true;
uint v0[12];
uint v1[12];
 
/* Get all initail values of a0 */
v0[0] = atomicCounter(a0[0][0]);
-- 
2.11.0

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


[Piglit] [PATCH] arb_gpu_shader_fp64: relax ldexp test due to denorms

2017-09-18 Thread Nicolai Hähnle
From: Nicolai Hähnle 

ldexp(0.5, -1028) will be different from 0.0 on implementations that
support denorms. Simply crank up the exponents to exclude the possibility
of denorms.
---
 .../execution/built-in-functions/fs-ldexp-dvec4.shader_test   | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
index c0e60b97b..38214dee6 100644
--- 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
@@ -85,25 +85,21 @@ probe rgba 4 0 0.0 0.0 0.0 0.0
 # Test DBL_MIN (2.2250738585072014E-308) and DBL_MAX (1.7976931348623157E+308) 
as inputs.
 uniform dvec4 expected_double 0.5 -0.5 0.99989 -0.99989
 uniform dvec4 given_double 2.2250738585072014E-308 -2.2250738585072014E-308 
1.7976931348623157E+308 -1.7976931348623157E+308
 uniform ivec4 given_exponent 1021 1021 -1024 -1024
 draw arrays GL_TRIANGLE_FAN 0 4
 probe rgba 5 0 0.0 0.0 0.0 0.0
 
 # Test underflow generates zero with sign of x.
 uniform dvec4 expected_double 0.0 -0.0 0.0 -0.0
 uniform dvec4 given_double 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -1028 -1028 -1028 -1028
+uniform ivec4 given_exponent -1028 -1028 -1078 -1078
 draw arrays GL_TRIANGLE_FAN 0 4
 probe rgba 6 0 0.0 0.0 0.0 0.0
 
 uniform dvec4 expected_double 0.0 -0.0 0.0 -0.0
 uniform dvec4 given_double 2.2250738585072014E-308 -2.2250738585072014E-308 
1.7976931348623157E+308 -1.7976931348623157E+308
-# For the FLT_MAX case -255 comes from (-127 + -127 + -1).
-#   ldexp(FLT_MAX, -127)   = 0x1.fep+0 (1.99881)
-#   ldexp(FLT_MAX, -127 - 127) = 0x1p-126 (epsilon above FLT_MIN)
-#   ldexp(FLT_MAX, -127 - 127 - 1) = 0.0
-uniform ivec4 given_exponent -1 -1 -2048 -2048
+uniform ivec4 given_exponent -53 -53 -2100 -2100
 draw arrays GL_TRIANGLE_FAN 0 4
 probe rgba 7 0 0.0 0.0 0.0 0.0
 
 # Overflow is undefined according to the GLSL spec, so nothing to test.
-- 
2.11.0

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


[Piglit] [PATCH v2 3/4] arb_gpu_shader5: add interpolateAt* tests with input in a struct

2017-08-01 Thread Nicolai Hähnle
From: Nicolai Hähnle 

The fact that this should be allowed was clarified in GLSL 4.60.
---
 .../fs-interpolateAtCentroid-struct.shader_test| 59 
 .../fs-interpolateAtOffset-struct.shader_test  | 63 ++
 .../fs-interpolateAtSample-struct.shader_test  | 59 
 3 files changed, 181 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-struct.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-struct.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct.shader_test
new file mode 100644
index 000..081ba2b
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.60 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an l-value
+#from an in declaration; this can include a variable, a block or
+#structure member, an array element, or some combination of these."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+struct S {
+   vec3 a;
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+};
+
+out S vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a = piglit_vertex.xyz;
+   vs2ps.b = vec2(0.0, 1.0);
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+struct S {
+   vec3 a;
+   vec2 b;
+};
+
+in S vs2ps;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a - interpolateAtCentroid(vs2ps.a);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(vs2ps.b.x, vs2ps.b.y, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-struct.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-struct.shader_test
new file mode 100644
index 000..93a507d
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-struct.shader_test
@@ -0,0 +1,63 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.60 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an l-value
+#from an in declaration; this can include a variable, a block or
+#structure member, an array element, or some combination of these."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+struct S {
+   vec3 a;
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+};
+
+out S vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a = piglit_vertex.xyz;
+   vs2ps.b = vec2(0.0, 1.0);
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+struct S {
+   vec3 a;
+   vec2 b;
+};
+
+in S vs2ps;
+
+uniform vec2 u_offset;
+
+out vec4 color;
+
+void main()
+{
+   /* u_offset is always 0, so these should be the same. */
+   vec3 delta = vs2ps.a - interpolateAtOffset(vs2ps.a, u_offset);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(vs2ps.b.x, vs2ps.b.y, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform vec2 u_offset 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-struct.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-struct.shader_test
new file mode 100644
index 000..4bb07e8
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-struct.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.60 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an l-value
+#from an in declaration; this can include a variable, a block or
+#structure member, an array element, or some combination of these."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+struct S {
+   vec3 a;
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+};
+
+out S vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;

[Piglit] [PATCH v2 1/4] arb_gpu_shader5: add execution tests for interpolateAt* with input in an interface block

2017-08-01 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Reviewed-by: Timothy Arceri 
---
 ...s-interpolateAtCentroid-block-array.shader_test | 73 +
 .../fs-interpolateAtCentroid-block.shader_test | 62 ++
 .../fs-interpolateAtOffset-block-array.shader_test | 75 ++
 .../fs-interpolateAtOffset-block.shader_test   | 66 +++
 .../fs-interpolateAtSample-block-array.shader_test | 75 ++
 .../fs-interpolateAtSample-block.shader_test   | 62 ++
 6 files changed, 413 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-block.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-block.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
new file mode 100644
index 000..f245bee
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
@@ -0,0 +1,73 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an input
+#variable or an element of an input variable declared as an array."
+#
+# From Section 4.3.9 (Interface Blocks) of the GLSL 4.50 spec:
+#
+#   "Input, output, uniform, and buffer variable declarations can be grouped
+#into named interface blocks to provide coarser granularity backing than
+#is achievable with individual declarations."
+#
+# So the members of an input interface block should still be considered as
+# input variables and therefore acceptable as interpolants.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out VS2PS {
+   vec3 a[2];
+} vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a[0] = piglit_vertex.xyz;
+   vs2ps.a[1] = piglit_vertex.zxy;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in VS2PS {
+   vec3 a[2];
+} vs2ps;
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a[u_idx] - interpolateAtCentroid(vs2ps.a[u_idx]);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
new file mode 100644
index 000..79b4064
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
@@ -0,0 +1,62 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an input
+#variable or an element of an input variable declared as an array."
+#
+# From Section 4.3.9 (Interface Blocks) of the GLSL 4.50 spec:
+#
+#   "Input, output, uniform, and buffer variable declarations can be grouped
+#into named interface blocks to provide coarser granularity backing than
+#is achievable with individual declarations."
+#
+# So the members of an input interface block should still be considered as
+# input variables and therefore acceptable as interpolants.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out VS2PS {
+   vec3 a;
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+} vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a = piglit_vertex.xyz;
+   vs2ps.b = vec2(0.0, 1.0);
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in VS2PS {
+   vec3 a;
+   vec2 b;
+} vs2ps;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a - interpol

[Piglit] [PATCH v2 0/4] More interpolateAt*() tests

2017-08-01 Thread Nicolai Hähnle
Now with clarifications that made their way into GLSL 4.60.

Please review!

Thanks,
Nicolai

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


[Piglit] [PATCH v2 4/4] glsl-4.40: add tests for interpolateAt* with swizzles / array subscripts on vectors

2017-08-01 Thread Nicolai Hähnle
From: Nicolai Hähnle 

For swizzles, the language changed in GLSL 4.40.

For array subscripts, it's not entirely clear whether the clarification
wrt interpolant being an l-value should be backdated even earlier or not.
Keeping it a 4.40 test should be enough for practical purposes.
---
 .../fs-interpolateAtCentroid-swizzle.shader_test   | 69 
 .../fs-interpolateAtOffset-swizzle.shader_test | 73 ++
 .../fs-interpolateAtSample-swizzle.shader_test | 70 +
 3 files changed, 212 insertions(+)
 create mode 100644 
tests/spec/glsl-4.40/execution/fs-interpolateAtCentroid-swizzle.shader_test
 create mode 100644 
tests/spec/glsl-4.40/execution/fs-interpolateAtOffset-swizzle.shader_test
 create mode 100644 
tests/spec/glsl-4.40/execution/fs-interpolateAtSample-swizzle.shader_test

diff --git 
a/tests/spec/glsl-4.40/execution/fs-interpolateAtCentroid-swizzle.shader_test 
b/tests/spec/glsl-4.40/execution/fs-interpolateAtCentroid-swizzle.shader_test
new file mode 100644
index 000..2e4820d
--- /dev/null
+++ 
b/tests/spec/glsl-4.40/execution/fs-interpolateAtCentroid-swizzle.shader_test
@@ -0,0 +1,69 @@
+# GLSL 4.40 changed the relevant language in Section 8.13.2 (Interpolation
+# Functions) to:
+#
+#"Component selection operators (e.g., .xy) may be used when specifying
+# interpolant."
+#
+# Furthermore, GLSL 4.60 clarified that
+#
+#"(...) interpolant must be an l-value from an in declaration; this can
+# include a variable, a block or structure member, an array element, or
+# some combination of these."
+#
+# which means array subscripts on vectors should also be allowed.
+#
+
+[require]
+GLSL >= 4.40
+
+[vertex shader]
+#version 440
+
+in vec4 piglit_vertex;
+
+out vec3 a;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a = piglit_vertex.xyz;
+}
+
+[fragment shader]
+#version 440
+
+in vec3 a;
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   vec2 delta1 = a.yx - interpolateAtCentroid(a.yx);
+   float delta2 = a[2] - interpolateAtCentroid(a[2]);
+   float delta3 = a[u_idx] - interpolateAtCentroid(a[u_idx]);
+
+   if (delta1 != vec2(0.0)) {
+  color = vec4(0.1, delta1.x + 0.5, delta1.y + 0.5, 0.0);
+   } else if (delta2 != 0.0) {
+  color = vec4(0.2, delta2 + 0.5, 0.0, 0.0);
+   } else if (delta3 != 0.0) {
+  color = vec4(0.3, delta3 + 0.5, 0.0, 0.0);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+draw rect -1 -1 1 2
+
+uniform int u_idx 1
+draw rect 0 -1 1 2
+
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/glsl-4.40/execution/fs-interpolateAtOffset-swizzle.shader_test 
b/tests/spec/glsl-4.40/execution/fs-interpolateAtOffset-swizzle.shader_test
new file mode 100644
index 000..a463c14
--- /dev/null
+++ b/tests/spec/glsl-4.40/execution/fs-interpolateAtOffset-swizzle.shader_test
@@ -0,0 +1,73 @@
+# GLSL 4.40 changed the relevant language in Section 8.13.2 (Interpolation
+# Functions) to:
+#
+#"Component selection operators (e.g., .xy) may be used when specifying
+# interpolant."
+#
+# Furthermore, GLSL 4.60 clarified that
+#
+#"(...) interpolant must be an l-value from an in declaration; this can
+# include a variable, a block or structure member, an array element, or
+# some combination of these."
+#
+# which means array subscripts on vectors should also be allowed.
+#
+
+[require]
+GLSL >= 4.40
+
+[vertex shader]
+#version 440
+
+in vec4 piglit_vertex;
+
+out vec3 a;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a = piglit_vertex.xyz;
+}
+
+[fragment shader]
+#version 440
+
+in vec3 a;
+
+uniform vec2 u_offset;
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* u_offset is always 0, so these should all be the same. */
+   vec2 delta1 = a.yx - interpolateAtOffset(a.yx, u_offset);
+   float delta2 = a[2] - interpolateAtOffset(a[2], u_offset);
+   float delta3 = a[u_idx] - interpolateAtOffset(a[u_idx], u_offset);
+
+   if (delta1 != vec2(0.0)) {
+  color = vec4(0.1, delta1.x + 0.5, delta1.y + 0.5, 0.0);
+   } else if (delta2 != 0.0) {
+  color = vec4(0.2, delta2 + 0.5, 0.0, 0.0);
+   } else if (delta3 != 0.0) {
+  color = vec4(0.3, delta3 + 0.5, 0.0, 0.0);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform vec2 u_offset 0 0
+
+uniform int u_idx 0
+draw rect -1 -1 1 2
+
+uniform int u_idx 1
+draw rect 0 -1 1 2
+
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/glsl-4.40/execution/fs-interpolateAtSample-swizzle.shader_test 
b/tests/spec/glsl-4.40/execution/fs-interpolateAtSample-swizzle.shader_test
new file mode 100644
index 000..74663b1
--- /dev/null
+++ b/tests/spec/glsl-4.40/execution/fs-interpolateAtSample-swizzle.shader_test
@@ -0,0 +1,70 @@
+# GLSL 4.40 changed the relevant language in Section 8.13.2 (Interpolat

[Piglit] [PATCH v2 2/4] arb_gpu_shader5: add interpolateAtSample tests with input in an array

2017-08-01 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Reviewed-by: Timothy Arceri 
---
 ...nterpolateAtSample-array-nonuniform.shader_test | 59 +
 ...-interpolateAtSample-array-of-array.shader_test | 76 ++
 2 files changed, 135 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
new file mode 100644
index 000..0aac1ab
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "Arrayed inputs can be indexed with general (nonuniform) integer
+#expressions."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out vec3 a[2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0] = piglit_vertex.xyz;
+   a[1] = piglit_vertex.zxy;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in vec3 a[2];
+
+out vec4 color;
+
+void main()
+{
+   ivec2 coord = ivec2(gl_FragCoord.xy);
+   int index =
+  /* Generate a pattern where some quads have alternating index on the 
X-axis,
+   * some on the Y-axis, and some on both or none. */
+  ((coord.x >> 1) & (coord.x)) ^
+  ((coord.y >> 1) & (coord.y)) ^
+  /* Flip the overall orientation of the alternating index within quads. */
+  (coord.x >> 2) ^ (coord.y >> 2);
+
+   index = index & 1;
+
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[index] - interpolateAtSample(a[index], 0);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
new file mode 100644
index 000..8d18cf3
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
@@ -0,0 +1,76 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec4 piglit_vertex;
+
+out vec3 a[2][2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0][0] = piglit_vertex.xyz;
+   a[0][1] = piglit_vertex.zxy;
+   a[1][0] = piglit_vertex.xzy;
+   a[1][1] = piglit_vertex.zyx;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec3 a[2][2];
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[u_idx / 2][u_idx % 2] - interpolateAtSample(a[u_idx / 
2][u_idx % 2], 0);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 3
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 2/2] arb_transform_feedback_overflow_query-basic: add any_inverted subtest

2017-07-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

There is a bug in VI+ with conditional render for any-stream overflow
that depends on whether the condition is inverted or not.
---
 .../arb_transform_feedback_overflow_query/basic.c| 20 
 1 file changed, 20 insertions(+)

diff --git a/tests/spec/arb_transform_feedback_overflow_query/basic.c 
b/tests/spec/arb_transform_feedback_overflow_query/basic.c
index 72b32fb..9fb3c0c 100644
--- a/tests/spec/arb_transform_feedback_overflow_query/basic.c
+++ b/tests/spec/arb_transform_feedback_overflow_query/basic.c
@@ -421,6 +421,20 @@ test_overflow_stream_any(void *test_data)
 }
 
 /**
+ * Overflow on stream 1.
+ * Query for overflow on any stream.
+ * inverted = true, expected overflow: true.
+ */
+static enum piglit_result
+test_overflow_stream_any_inverted(void *test_data)
+{
+   GLuint query_type = GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB;
+   int array_sizes[] = { 6, 5 };
+
+   return run_subtest(2, array_sizes, 0, query_type, true, true, 
test_data);
+}
+
+/**
  * No overflow.
  * Query for overflow on any stream.
  * inverted = false, expected overflow: false.
@@ -528,6 +542,12 @@ const struct piglit_subtest overflow_query_subtests[] = {
"conditional_render"
},
{
+   
"arb_transform_feedback_overflow_query-conditional_render_any_inverted",
+   
"arb_transform_feedback_overflow_query-conditional_render_any_inverted",
+   test_overflow_stream_any_inverted,
+   "conditional_render"
+   },
+   {

"arb_transform_feedback_overflow_query-conditional_render_no_overflow",

"arb_transform_feedback_overflow_query-conditional_render_no_overflow",
test_no_overflow_stream_any,
-- 
2.9.3

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


[Piglit] [PATCH 1/2] arb_transform_feedback_overflow_query-basic: fix subtest selection

2017-07-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/spec/arb_transform_feedback_overflow_query/basic.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_transform_feedback_overflow_query/basic.c 
b/tests/spec/arb_transform_feedback_overflow_query/basic.c
index 0ca0afe..72b32fb 100644
--- a/tests/spec/arb_transform_feedback_overflow_query/basic.c
+++ b/tests/spec/arb_transform_feedback_overflow_query/basic.c
@@ -34,10 +34,13 @@
 
 #define BUFFER_OFFSET(i) ((void *)((char *)NULL + i))
 
+const struct piglit_subtest overflow_query_subtests[];
+
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 32;
config.supports_gl_core_version = 32;
+   config.subtests = overflow_query_subtests;
 
 PIGLIT_GL_TEST_CONFIG_END
 
@@ -576,8 +579,7 @@ piglit_init(int argc, char **argv)
/* Strip common piglit args. */
piglit_strip_arg(&argc, argv, "-fbo");
piglit_strip_arg(&argc, argv, "-auto");
-   piglit_parse_subtest_args(&argc, argv, subtests, &selected_subtests,
- &num_selected_subtests);
+   num_selected_subtests = piglit_get_selected_tests(&selected_subtests);
 
if (argc > 1) {
fprintf(stderr, "usage error\n");
-- 
2.9.3

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


Re: [Piglit] [PATCH 3/3] arb_gpu_shader5: interpolateAt* must reject inputs in structs

2017-06-20 Thread Nicolai Hähnle

On 20.06.2017 13:32, Nicolai Hähnle wrote:

On 19.06.2017 23:46, Ian Romanick wrote:

That's actually a little surprising... do other drivers reject this?  If
so, I'll agree with Timothy that a spec quote would be nice.


So, I guess I was going off of what was in the Mesa source already, plus 
the spec part of Section 8.13.2 (Interpolation Functions) of GLSL 4.50 
which says:


"For all of the interpolation functions, interpolant must be an
 input variable or an element of an input variable declared as an
 array. Component selection operators (e.g., .xy) may be used when
 specifying interpolant."

... and if you go out of your way to explicitly say that it *can* be an 
element of an array, one kind of expects that it *cannot* be an element 
of a struct. But maybe that's an artifact of how the spec evolved? 
Actually, now that I re-read it, our rejection of swizzles also looks 
incorrect.


As for compilers I can test:

glslangValidator: accepts swizzles and struct elements
amdgpu-pro: accepts struct elements but rejects swizzles; it does accept 
non-swizzling individual component selection, which seems like a spec 
misunderstanding given how "component selection" is defined in Section 
5.5 (Vector and Scalar Components and Length).

Mesa: rejects swizzles and struct elements

Going back to the ARB_gpu_shader5 spec, it explicitly forbids swizzles 
(there's an additional "not" in the sentence quoted above). So that 
seems to have changed at some point and we simply missed it. More 
digging needed...


So, the "not" was removed in GLSL 4.40, but there's no mention of this 
change in the changelog.


On the matter of struct elements: Consider that they cannot have 
flat/centroid/noperspective qualifiers, so there's actually a good 
reason forbidding them.


I've opened a spec bug about this anyway: 
https://gitlab.khronos.org/opengl/GLSL/issues/8


Cheers,
Nicolai




Honestly, I'd interpret the spec language above in a way that forbids 
using struct elements. The other compilers I can test disagree, but both 
of them aren't exactly known for their high quality...


Cheers,
Nicolai



On 06/16/2017 01:34 PM, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

---
  .../fs-interpolateAtCentroid-struct.frag| 17 
+
  .../fs-interpolateAtOffset-struct.frag  | 17 
+
  .../fs-interpolateAtSampler-struct.frag | 17 
+

  3 files changed, 51 insertions(+)
  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag 

  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag 

  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag 



diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag 


new file mode 100644
index 000..453c2db
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag 


@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtCentroid(a.a);
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag 


new file mode 100644
index 000..9b7ee7e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag 


@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtOffset(a.a, vec2(0));
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag 


new file mode 100644
index 000..78a844e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag 


@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtSample(a.a, 0);
+}









--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/3] arb_gpu_shader5: interpolateAt* must reject inputs in structs

2017-06-20 Thread Nicolai Hähnle

On 19.06.2017 23:46, Ian Romanick wrote:

That's actually a little surprising... do other drivers reject this?  If
so, I'll agree with Timothy that a spec quote would be nice.


So, I guess I was going off of what was in the Mesa source already, plus 
the spec part of Section 8.13.2 (Interpolation Functions) of GLSL 4.50 
which says:


   "For all of the interpolation functions, interpolant must be an
input variable or an element of an input variable declared as an
array. Component selection operators (e.g., .xy) may be used when
specifying interpolant."

... and if you go out of your way to explicitly say that it *can* be an 
element of an array, one kind of expects that it *cannot* be an element 
of a struct. But maybe that's an artifact of how the spec evolved? 
Actually, now that I re-read it, our rejection of swizzles also looks 
incorrect.


As for compilers I can test:

glslangValidator: accepts swizzles and struct elements
amdgpu-pro: accepts struct elements but rejects swizzles; it does accept 
non-swizzling individual component selection, which seems like a spec 
misunderstanding given how "component selection" is defined in Section 
5.5 (Vector and Scalar Components and Length).

Mesa: rejects swizzles and struct elements

Going back to the ARB_gpu_shader5 spec, it explicitly forbids swizzles 
(there's an additional "not" in the sentence quoted above). So that 
seems to have changed at some point and we simply missed it. More 
digging needed...


Honestly, I'd interpret the spec language above in a way that forbids 
using struct elements. The other compilers I can test disagree, but both 
of them aren't exactly known for their high quality...


Cheers,
Nicolai



On 06/16/2017 01:34 PM, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

---
  .../fs-interpolateAtCentroid-struct.frag| 17 +
  .../fs-interpolateAtOffset-struct.frag  | 17 +
  .../fs-interpolateAtSampler-struct.frag | 17 +
  3 files changed, 51 insertions(+)
  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
  create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag

diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
new file mode 100644
index 000..453c2db
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtCentroid(a.a);
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
new file mode 100644
index 000..9b7ee7e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtOffset(a.a, vec2(0));
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
new file mode 100644
index 000..78a844e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtSample(a.a, 0);
+}






--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] arb_gpu_shader5: add execution tests for interpolateAt* with input in an interface block

2017-06-16 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 ...s-interpolateAtCentroid-block-array.shader_test | 73 +
 .../fs-interpolateAtCentroid-block.shader_test | 62 ++
 .../fs-interpolateAtOffset-block-array.shader_test | 75 ++
 .../fs-interpolateAtOffset-block.shader_test   | 66 +++
 .../fs-interpolateAtSample-block-array.shader_test | 75 ++
 .../fs-interpolateAtSample-block.shader_test   | 62 ++
 6 files changed, 413 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtOffset-block.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-block-array.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-block.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
new file mode 100644
index 000..f245bee
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block-array.shader_test
@@ -0,0 +1,73 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an input
+#variable or an element of an input variable declared as an array."
+#
+# From Section 4.3.9 (Interface Blocks) of the GLSL 4.50 spec:
+#
+#   "Input, output, uniform, and buffer variable declarations can be grouped
+#into named interface blocks to provide coarser granularity backing than
+#is achievable with individual declarations."
+#
+# So the members of an input interface block should still be considered as
+# input variables and therefore acceptable as interpolants.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out VS2PS {
+   vec3 a[2];
+} vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a[0] = piglit_vertex.xyz;
+   vs2ps.a[1] = piglit_vertex.zxy;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in VS2PS {
+   vec3 a[2];
+} vs2ps;
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a[u_idx] - interpolateAtCentroid(vs2ps.a[u_idx]);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
new file mode 100644
index 000..79b4064
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-block.shader_test
@@ -0,0 +1,62 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an input
+#variable or an element of an input variable declared as an array."
+#
+# From Section 4.3.9 (Interface Blocks) of the GLSL 4.50 spec:
+#
+#   "Input, output, uniform, and buffer variable declarations can be grouped
+#into named interface blocks to provide coarser granularity backing than
+#is achievable with individual declarations."
+#
+# So the members of an input interface block should still be considered as
+# input variables and therefore acceptable as interpolants.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out VS2PS {
+   vec3 a;
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+} vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a = piglit_vertex.xyz;
+   vs2ps.b = vec2(0.0, 1.0);
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in VS2PS {
+   vec3 a;
+   vec2 b;
+} vs2ps;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a - interpolateAtCentroid(vs2ps.a);
+
+   if (delta != 

[Piglit] [PATCH 2/3] arb_gpu_shader5: add interpolateAtSample tests with input in an array

2017-06-16 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 ...nterpolateAtSample-array-nonuniform.shader_test | 59 +
 ...-interpolateAtSample-array-of-array.shader_test | 76 ++
 2 files changed, 135 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
new file mode 100644
index 000..0aac1ab
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "Arrayed inputs can be indexed with general (nonuniform) integer
+#expressions."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out vec3 a[2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0] = piglit_vertex.xyz;
+   a[1] = piglit_vertex.zxy;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in vec3 a[2];
+
+out vec4 color;
+
+void main()
+{
+   ivec2 coord = ivec2(gl_FragCoord.xy);
+   int index =
+  /* Generate a pattern where some quads have alternating index on the 
X-axis,
+   * some on the Y-axis, and some on both or none. */
+  ((coord.x >> 1) & (coord.x)) ^
+  ((coord.y >> 1) & (coord.y)) ^
+  /* Flip the overall orientation of the alternating index within quads. */
+  (coord.x >> 2) ^ (coord.y >> 2);
+
+   index = index & 1;
+
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[index] - interpolateAtSample(a[index], 0);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
new file mode 100644
index 000..8d18cf3
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
@@ -0,0 +1,76 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec4 piglit_vertex;
+
+out vec3 a[2][2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0][0] = piglit_vertex.xyz;
+   a[0][1] = piglit_vertex.zxy;
+   a[1][0] = piglit_vertex.xzy;
+   a[1][1] = piglit_vertex.zyx;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec3 a[2][2];
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[u_idx / 2][u_idx % 2] - interpolateAtSample(a[u_idx / 
2][u_idx % 2], 0);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 3
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 3/3] arb_gpu_shader5: interpolateAt* must reject inputs in structs

2017-06-16 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../fs-interpolateAtCentroid-struct.frag| 17 +
 .../fs-interpolateAtOffset-struct.frag  | 17 +
 .../fs-interpolateAtSampler-struct.frag | 17 +
 3 files changed, 51 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag

diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
new file mode 100644
index 000..453c2db
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtCentroid-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtCentroid(a.a);
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
new file mode 100644
index 000..9b7ee7e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtOffset-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtOffset(a.a, vec2(0));
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
new file mode 100644
index 000..78a844e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-interpolateAtSampler-struct.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in struct {
+   vec4 a;
+} a;
+
+void main()
+{
+   interpolateAtSample(a.a, 0);
+}
-- 
2.9.3

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


Re: [Piglit] [PATCH] arb_bindless_texture: add new compiler tests for struct with image arrays

2017-06-07 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 05.06.2017 16:34, Samuel Pitoiset wrote:

ping?

On 05/25/2017 08:02 PM, Samuel Pitoiset wrote:

Signed-off-by: Samuel Pitoiset 
---
  .../nested-struct-arrays-mismatch-format.frag  | 27 

  .../nested-struct-with-arrays-no-qualifiers.frag   | 29 
++
  .../images/struct-with-arrays-mismatch-format.frag | 22 

  .../images/struct-with-arrays-no-qualifiers.frag   | 24 
++

  4 files changed, 102 insertions(+)
  create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag 

  create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag 

  create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag 

  create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag 



diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag 
b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag 


new file mode 100644
index 0..dfb518f80
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag 


@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture 
GL_ARB_shader_image_load_store

+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+#extension GL_ARB_arrays_of_arrays: enable
+
+// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 
spec:

+//
+// "It is a compile-time error to declare an image variable where the 
format

+//  qualifier does not match the image variable type."
+
+struct S_inner {
+layout (r32i) image2D img;
+};
+
+struct {
+S_inner si[2][2];
+} s;
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag 
b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag 


new file mode 100644
index 0..5fbec1386
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag 


@@ -0,0 +1,29 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture 
GL_ARB_shader_image_load_store

+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+#extension GL_ARB_arrays_of_arrays: enable
+
+// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 
spec:

+//
+// "Uniforms not qualified with writeonly must have a format layout 
qualifier."

+//
+// Because GL_ARB_bindless_texture allows to declare images insides 
structures,

+// this rule applies and this test should fail.
+
+struct S_inner {
+image2D img;
+};
+
+struct {
+S_inner si[2][2];
+} s;
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag 
b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag 


new file mode 100644
index 0..b9981de77
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag 


@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture 
GL_ARB_shader_image_load_store

+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 
spec:

+//
+// "It is a compile-time error to declare an image variable where the 
format

+//  qualifier does not match the image variable type."
+
+struct {
+layout (r32i) image2D imgs[6];
+} s;
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag 
b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag 


new file mode 100644
index 0..bb29340fb
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag 


@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture 
GL_ARB_shader_image_load_store

+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 
spec:

+//
+// "Uniforms not qualified with writeonly must have a format layout 
qualifier."

+//
+// Because GL_ARB_bindless_texture allows to declare images insides 
structures,

+// thi

[Piglit] [PATCH 2/4] shader_runner: add "relative probe rect rgba" command

2017-05-03 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/shaders/shader_runner.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 39922d3..b990887 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3387,21 +3387,33 @@ piglit_display(void)
  c + 0, c + 1, c + 2, c + 3,
  c + 4, c + 5, c + 6) == 7) {
x = c[0] * read_width;
y = c[1] * read_height;
w = c[2] * read_width;
h = c[3] * read_height;
 
if (!piglit_probe_rect_rgb(x, y, w, h, &c[4])) {
result = PIGLIT_FAIL;
}
+   } else if (sscanf(line, "relative probe rect rgba "
+ "( %f , %f , %f , %f ) "
+ "( %f , %f , %f , %f )",
+ c + 0, c + 1, c + 2, c + 3,
+ c + 4, c + 5, c + 6, c + 7) == 8) {
+   x = c[0] * read_width;
+   y = c[1] * read_height;
+   w = c[2] * read_width;
+   h = c[3] * read_height;
 
+   if (!piglit_probe_rect_rgba(x, y, w, h, &c[4])) {
+   result = PIGLIT_FAIL;
+   }
} else if (sscanf(line, "relative probe rect rgba int "
  "( %f , %f , %f , %f ) "
  "( %d , %d , %d , %d )",
  c + 0, c + 1, c + 2, c + 3,
  &x, &y, &z, &w) == 8) {
const int expected[] = { x, y, z, w };
if (!piglit_probe_rect_rgba_int(c[0] * read_width,
c[1] * read_height,
c[2] * read_width,
c[3] * read_height,
-- 
2.9.3

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


[Piglit] [PATCH 0/4] Test gl_PrimitiveID in instanced draws

2017-05-03 Thread Nicolai Hähnle
Hi all,

these tests add coverage for checking that gl_PrimitiveID resets at the
start of a new instance. Radeon GPUs require a few subtleties in
hardware to make sure that works correctly, and we were missing some
of them. Please review!

Thanks,
Nicolai
--
 tests/shaders/shader_runner.c| 66 +
 .../fs-primitiveid-instanced.shader_test | 79 +++
 .../gs-primitiveid-instanced.shader_test | 87 +
 .../tcs-primitiveid-instanced.shader_test| 92 ++
 ...-no-tcs-primitiveid-instanced.shader_test | 66 +
 .../tes-primitiveid-instanced.shader_test| 85 
 .../primitive-id-no-gs-instanced.shader_test | 60 
 7 files changed, 515 insertions(+), 20 deletions(-)

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


[Piglit] [PATCH 1/4] shader_runner: add "draw arrays instanced" command

2017-05-03 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/shaders/shader_runner.c | 54 +++
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 6ac5f98..39922d3 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2782,20 +2782,46 @@ program_must_be_in_use(void)
 
 static void
 bind_vao_if_supported()
 {
if (vao == 0 && gl_version.num >= 31) {
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
}
 }
 
+static enum piglit_result
+draw_arrays_common(int first, size_t count)
+{
+   enum piglit_result result = program_must_be_in_use();
+   if (first < 0) {
+   printf("draw arrays 'first' must be >= 0\n");
+   piglit_report_result(PIGLIT_FAIL);
+   } else if (vbo_present &&
+   (size_t) first >= num_vbo_rows) {
+   printf("draw arrays 'first' must be < %lu\n",
+   (unsigned long) num_vbo_rows);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   if (count <= 0) {
+   printf("draw arrays 'count' must be > 0\n");
+   piglit_report_result(PIGLIT_FAIL);
+   } else if (vbo_present &&
+   count > num_vbo_rows - (size_t) first) {
+   printf("draw arrays cannot draw beyond %lu\n",
+   (unsigned long) num_vbo_rows);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   bind_vao_if_supported();
+   return result;
+}
+
 static bool
 probe_atomic_counter(unsigned buffer_num, GLint counter_num, const char *op, 
uint32_t value)
 {
 uint32_t *p;
uint32_t observed;
enum comparison cmp;
bool result;
 
REQUIRE(parse_comparison_op(op, &cmp, NULL),
"Invalid comparison operation at: %s\n", op);
@@ -3002,44 +3028,32 @@ piglit_display(void)
parse_floats(rest, c, 4, NULL);
piglit_draw_rect(c[0], c[1], c[2], c[3]);
} else if (parse_str(line, "draw instanced rect ", &rest)) {
int primcount;
 
result = program_must_be_in_use();
sscanf(rest, "%d %f %f %f %f",
   &primcount,
   c + 0, c + 1, c + 2, c + 3);
draw_instanced_rect(primcount, c[0], c[1], c[2], c[3]);
+   } else if (sscanf(line, "draw arrays instanced %31s %d %d %d", 
s, &x, &y, &z) == 4) {
+   GLenum mode = decode_drawing_mode(s);
+   int first = x;
+   size_t count = (size_t) y;
+   size_t primcount = (size_t) z;
+   draw_arrays_common(first, count);
+   glDrawArraysInstanced(mode, first, count, primcount);
} else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y) == 
3) {
GLenum mode = decode_drawing_mode(s);
int first = x;
size_t count = (size_t) y;
-   result = program_must_be_in_use();
-   if (first < 0) {
-   printf("draw arrays 'first' must be >= 0\n");
-   piglit_report_result(PIGLIT_FAIL);
-   } else if (vbo_present &&
-  (size_t) first >= num_vbo_rows) {
-   printf("draw arrays 'first' must be < %lu\n",
-  (unsigned long) num_vbo_rows);
-   piglit_report_result(PIGLIT_FAIL);
-   }
-   if (count <= 0) {
-   printf("draw arrays 'count' must be > 0\n");
-   piglit_report_result(PIGLIT_FAIL);
-   } else if (vbo_present &&
-  count > num_vbo_rows - (size_t) first) {
-   printf("draw arrays cannot draw beyond %lu\n",
-  (unsigned long) num_vbo_rows);
-   piglit_report_result(PIGLIT_FAIL);
-   }
-   bind_vao_if_supported();
+   result = draw_arrays_common(first, count);
glDrawArrays(mode, first, count);
} else if (parse_str(line, "disable ", &rest)) {
do_enable_disable(rest, false);
} else

[Piglit] [PATCH 3/4] arb_tessellation_shader: test gl_PrimitiveID in instanced draws

2017-05-03 Thread Nicolai Hähnle
From: Nicolai Hähnle 

These tests expose a couple of bugs related to gl_PrimitiveID in radeonsi
with tessellation enabled:

- garbage gl_PrimitiveID in fragment shader if no geometry shader is
  present
- gl_PrimitiveIDIn in geometry shaders is not reset at the start of an
  instance when instancing is used
- on SI (or possibly only Verde), gl_PrimitiveID in TCS and TES is not
  reset at the start of an instance when instancing is used
---
 .../execution/fs-primitiveid-instanced.shader_test | 79 +++
 .../execution/gs-primitiveid-instanced.shader_test | 87 
 .../tcs-primitiveid-instanced.shader_test  | 92 ++
 .../tes-no-tcs-primitiveid-instanced.shader_test   | 66 
 .../tes-primitiveid-instanced.shader_test  | 85 
 5 files changed, 409 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/fs-primitiveid-instanced.shader_test
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/gs-primitiveid-instanced.shader_test
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tcs-primitiveid-instanced.shader_test
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tes-no-tcs-primitiveid-instanced.shader_test
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tes-primitiveid-instanced.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/fs-primitiveid-instanced.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/fs-primitiveid-instanced.shader_test
new file mode 100644
index 000..be8b91e
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/fs-primitiveid-instanced.shader_test
@@ -0,0 +1,79 @@
+# Test that the gl_PrimitiveID input in the FS is correctly set up and starts
+# at 0 for each instance in instanced draws.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out int vs_tcs_id;
+out int vs_tcs_instance;
+
+void main()
+{
+   vs_tcs_id = gl_VertexID;
+   vs_tcs_instance = gl_InstanceID;
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 1) out;
+in int vs_tcs_id[];
+in int vs_tcs_instance[];
+out vec2 tcs_tes_position[];
+
+void main()
+{
+   tcs_tes_position[gl_InvocationID].x = -1.0 + vs_tcs_id[gl_InvocationID];
+   tcs_tes_position[gl_InvocationID].y = -1.0 + 
vs_tcs_instance[gl_InvocationID];
+
+   gl_TessLevelInner[0] = 1.0;
+   gl_TessLevelInner[1] = 1.0;
+
+   gl_TessLevelOuter[0] = 1.0;
+   gl_TessLevelOuter[1] = 1.0;
+   gl_TessLevelOuter[2] = 1.0;
+   gl_TessLevelOuter[3] = 1.0;
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+in vec2 tcs_tes_position[];
+
+void main()
+{
+   gl_Position = vec4(tcs_tes_position[0].x + gl_TessCoord.x,
+  tcs_tes_position[0].y + gl_TessCoord.y,
+  0.0, 1.0);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+   gl_FragColor = vec4(0.0, 1.0, gl_PrimitiveID * 0.1, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+patch parameter vertices 1
+draw arrays instanced GL_PATCHES 0 2 2
+
+# First instance
+relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
+relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.1, 1.0)
+
+# Second instance
+relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
+relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.0, 1.0, 0.1, 1.0)
diff --git 
a/tests/spec/arb_tessellation_shader/execution/gs-primitiveid-instanced.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/gs-primitiveid-instanced.shader_test
new file mode 100644
index 000..74d9c16
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/gs-primitiveid-instanced.shader_test
@@ -0,0 +1,87 @@
+# Test that the gl_PrimitiveID input in the TES is correctly set up and starts
+# at 0 for each instance in instanced draws.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out int vs_tes_id;
+out int vs_tes_instance;
+
+void main()
+{
+   vs_tes_id = gl_VertexID;
+   vs_tes_instance = gl_InstanceID;
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+in int vs_tes_id[];
+in int vs_tes_instance[];
+
+void main()
+{
+   gl_Position = vec4(-1.0 + vs_tes_id[0] + gl_TessCoord.x,
+  -1.0 + vs_tes_instance[0] + gl_TessCoord.y,
+  0.0, 1.0);
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+out vec4 color;
+
+void main() {
+   vec4 tmp_color = vec4(0.0, 1.0, gl_PrimitiveIDIn * 0.1, 1.0);
+
+   color = tmp_color;
+   gl_Position = gl_in[0].gl_Po

[Piglit] [PATCH 4/4] glsl-1.50: test gl_PrimitiveID in fragment shader when instancing is used

2017-05-03 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../primitive-id-no-gs-instanced.shader_test   | 60 ++
 1 file changed, 60 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/primitive-id-no-gs-instanced.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/primitive-id-no-gs-instanced.shader_test 
b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-instanced.shader_test
new file mode 100644
index 000..cb05ac5
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-instanced.shader_test
@@ -0,0 +1,60 @@
+# Check proper functioning of the gl_PrimitiveID fragment shader
+# input, in the case where there is no geometry shader and instancing is used.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+flat out int vertex_id;
+
+void main()
+{
+  gl_Position = piglit_vertex + vec4(0.0, gl_InstanceID, 0.0, 0.0);
+  vertex_id = gl_VertexID;
+}
+
+[fragment shader]
+#version 150
+
+flat in int vertex_id;
+
+void main()
+{
+  /* We draw a triangle fan containing 6 vertices, so the relationship between
+   * the primitive ID and the input vertex ID's should be:
+   *
+   * Primitive ID  Vertex ID's  Provoking vertex ID
+   *  0 0 1 22
+   *  1 0 2 33
+   *  2 0 3 44
+   *  3 0 4 55
+   *
+   * Since vertex_id uses interpolation qualifier "flat", it should
+   * always receive the value from the provoking vertex.  Therefore,
+   * by the table above, it should always be 2 greater than the
+   * expected value of gl_PrimitiveID.
+   */
+  int expected_primitive_id = vertex_id - 2;
+  if (expected_primitive_id == gl_PrimitiveID)
+gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+-1.0  0.0
+ 0.0  0.0
+ 1.0  0.0
+ 1.0  -0.5
+ 1.0 -1.0
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays instanced GL_TRIANGLE_FAN 0 6 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


Re: [Piglit] [PATCH] arb_shader_storage_buffer_object: add member-memory-qualifiers.frag

2017-04-29 Thread Nicolai Hähnle

On 29.04.2017 16:23, Samuel Pitoiset wrote:

There is actually no positive test which validates the memory
qualifiers with members of shader storage blocks.


Nice one. Should using readonly/writeonly variables incorrectly be a 
compile-time error?


Reviewed-by: Nicolai Hähnle 




Signed-off-by: Samuel Pitoiset 
---
 .../compiler/member-memory-qualifiers.frag | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/member-memory-qualifiers.frag

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/member-memory-qualifiers.frag
 
b/tests/spec/arb_shader_storage_buffer_object/compiler/member-memory-qualifiers.frag
new file mode 100644
index 0..028527b56
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/compiler/member-memory-qualifiers.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+// From Section 4.10 (Memory Qualifiers) of the GLSL 4.50 spec:
+//
+// "The memory qualifiers coherent, volatile, restrict, readonly, and
+//  writeonly may be used in the declaration of buffer variables
+//  (i.e., members of shader storage blocks)"
+
+buffer ssbo {
+   readonly int a;
+   writeonly int b;
+   coherent int c;
+   volatile int d;
+   restrict int e;
+};




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_bindless_texture: add new execution tests with sampler/image arrays

2017-04-28 Thread Nicolai Hähnle

On 28.04.2017 14:17, Samuel Pitoiset wrote:

Tests loosely based on arb_arrays_of_arrays but with resident
textures/images.

Signed-off-by: Samuel Pitoiset 


Reviewed-by: Nicolai Hähnle 



---
 .../fs-const-index-three-dimensions.shader_test| 45 +++
 .../images/fs-struct-non-const-index.shader_test   | 94 ++
 .../fs-const-index-three-dimensions.shader_test| 35 
 .../samplers/fs-struct-non-const-index.shader_test | 90 +
 4 files changed, 264 insertions(+)
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/fs-const-index-three-dimensions.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/fs-struct-non-const-index.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/samplers/fs-const-index-three-dimensions.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/samplers/fs-struct-non-const-index.shader_test

diff --git 
a/tests/spec/arb_bindless_texture/execution/images/fs-const-index-three-dimensions.shader_test
 
b/tests/spec/arb_bindless_texture/execution/images/fs-const-index-three-dimensions.shader_test
new file mode 100644
index 0..251206f4d
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/images/fs-const-index-three-dimensions.shader_test
@@ -0,0 +1,45 @@
+# Based on 
arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test
+[require]
+GLSL >= 3.30
+GL_ARB_arrays_of_arrays
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_bindless_texture: enable
+#extension GL_ARB_shader_image_load_store: enable
+
+layout (bindless_image) uniform;
+
+uniform vec4 color;
+writeonly uniform image2D img[2][2][2];
+out vec4 outcolor;
+
+void main()
+{
+   imageStore(img[1][0][1], ivec2(gl_FragCoord.xy), color);
+   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Texture 0 is the imageStore output.
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle img[1][0][1] 0
+
+# Texture 1 is the rendering output. We don't care about this.
+texture rgbw 1 (16, 16) GL_RGBA8
+
+# Store red using imageStore
+uniform vec4 color 1.0 0.0 0.0 1.0
+fb tex 2d 1
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 1.0 0.0 0.0 1.0
diff --git 
a/tests/spec/arb_bindless_texture/execution/images/fs-struct-non-const-index.shader_test
 
b/tests/spec/arb_bindless_texture/execution/images/fs-struct-non-const-index.shader_test
new file mode 100644
index 0..399bb7b47
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/images/fs-struct-non-const-index.shader_test
@@ -0,0 +1,94 @@
+# This test verifies that dynamically uniform indexing of image arrays
+# in the fragment shader with resident textures behaves correctly.
+# Based on 
arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index.shader_test.
+[require]
+GLSL >= 3.30
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_bindless_texture: enable
+#extension GL_ARB_shader_image_load_store: enable
+
+layout (bindless_image) uniform;
+
+struct S {
+   writeonly image2D img;
+};
+
+uniform vec4 color;
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 outcolor;
+
+void main()
+{
+   imageStore(s[n][m].img, ivec2(gl_FragCoord.xy), color);
+   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Texture 0 is the imageStore output.
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle s[0][0].img 0
+
+# Texture 3 is the rendering output. We don't care about this.
+texture rgbw 3 (16, 16) GL_RGBA8
+
+# Store red using imageStore
+uniform int n 0
+uniform int m 0
+uniform vec4 color 1.0 0.0 0.0 1.0
+fb tex 2d 3
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 1.0 0.0 0.0 1.0
+
+# Texture 1 is the imageStore output.
+texture rgbw 1 (16, 16) GL_RGBA8
+resident image texture 1 GL_RGBA8
+uniform handle s[1][0].img 1
+
+# Store green using imageStore
+uniform int n 1
+uniform int m 0
+uniform vec4 color 0.0 1.0 0.0 1.0
+fb tex 2d 3
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 1
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Texture 2 is the imageStore output.
+texture rgbw 2 (16, 16) GL_RGBA8
+resident image texture 2 GL_RGBA8
+uniform handle s[0][1].img 2
+
+# Store blue using imageStore
+uniform int n 0
+uniform int m 1
+uniform vec4 color 0.0 0.0 1.0 1.0
+fb tex 2d 3
+draw rect -1 -1 2 2
+
+# Test the resu

Re: [Piglit] [PATCH 2/2] arb_bindless_texture: add struct-inside-uniform-block.frag compiler tests

2017-04-28 Thread Nicolai Hähnle

On 28.04.2017 11:48, Samuel Pitoiset wrote:

The spec doesn't clearly state this, but the spec authors say
it's allowed.

Signed-off-by: Samuel Pitoiset 


Both patches:

Reviewed-by: Nicolai Hähnle 



---
 .../images/struct-inside-uniform-block.frag| 23 +
 .../samplers/struct-inside-uniform-block.frag  | 24 ++
 2 files changed, 47 insertions(+)
 create mode 100644 
tests/spec/arb_bindless_texture/compiler/images/struct-inside-uniform-block.frag
 create mode 100644 
tests/spec/arb_bindless_texture/compiler/samplers/struct-inside-uniform-block.frag

diff --git 
a/tests/spec/arb_bindless_texture/compiler/images/struct-inside-uniform-block.frag
 
b/tests/spec/arb_bindless_texture/compiler/images/struct-inside-uniform-block.frag
new file mode 100644
index 0..99d393aa2
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/images/struct-inside-uniform-block.frag
@@ -0,0 +1,23 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+struct foo {
+   float x;
+   writeonly image2D img;
+};
+
+uniform Block {
+   foo f;
+};
+
+void main()
+{
+   imageStore(f.img, ivec2(0, 0), vec4(1, 2, 3, 4));
+}
diff --git 
a/tests/spec/arb_bindless_texture/compiler/samplers/struct-inside-uniform-block.frag
 
b/tests/spec/arb_bindless_texture/compiler/samplers/struct-inside-uniform-block.frag
new file mode 100644
index 0..fc16827af
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/compiler/samplers/struct-inside-uniform-block.frag
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+struct foo {
+   float x;
+   sampler2D tex;
+};
+
+uniform Block {
+   foo f;
+};
+
+out vec4 color;
+
+void main()
+{
+   color = texture2D(f.tex, vec2(0, 0));
+}




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/6] arb_bindless_texture: test bound samplers/image with glUniform1i()

2017-04-28 Thread Nicolai Hähnle

On 27.04.2017 22:12, Samuel Pitoiset wrote:



On 04/27/2017 10:02 PM, Nicolai Hähnle wrote:

On 27.04.2017 00:52, Samuel Pitoiset wrote:

From section 2.14.16 of the ARB_bindless_texture spec:

"When used as uniforms in the default block, the value of sampler
 variables may be specified with either Uniform1i{v} or
 UniformHandleui64{v}ARB."

From section 2.14.X of the ARB_bindless_texture spec:

"When used as uniforms in the default block, the value of image
 variables may be specified with either Uniform1i{v} or
 UniformHandleui64{v}ARB."

This test just ensures that setting a uniform to bound samplers
doesn't report any GL errors.


Okay, I'm very confused again. The spec *also* says this:

"These modifiers control whether default-block uniforms of the
 corresponding types may have their values set via both
 UniformHandle* and Uniform1i (bindless_sampler and bindless_image)
 or only via Uniform1i (bound_sampler and bound_image)."

Which would actually suggest that the current test is wrong *before*
this patch. What's going on here?


Not wrong, but incomplete, yes.

Basically, if my understanding of the spec is correct. The only GL call
which should report an error is UniformHandle* when a sampler has the
bound_sampler layout qualifier. That said, we can use UniformHandle* and
Uniform1i when the bindless_sampler is set and when no layout qualifiers
are present.


I'd like to get this clarified. My understanding was that, because of:

   "In the absence of these qualifiers, sampler and image uniforms are
considered "bound"."

The behavior of an explicit bound_sampler uniform and a sampler uniform 
without any such qualifiers should be the same, i.e. UniformHandle* is 
forbidden in both cases.


Cheers,
Nicolai










Signed-off-by: Samuel Pitoiset 
---
 tests/spec/arb_bindless_texture/uniform.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/spec/arb_bindless_texture/uniform.c
b/tests/spec/arb_bindless_texture/uniform.c
index c4c06df05..1524eb18c 100644
--- a/tests/spec/arb_bindless_texture/uniform.c
+++ b/tests/spec/arb_bindless_texture/uniform.c
@@ -158,6 +158,7 @@
check_UniformHandleui64_with_implicit_bound_sampler(void *data)
  */
 glUniformHandleui64ARB(loc, handle);
 glProgramUniformHandleui64vARB(prog, loc, 1, &handle);
+glUniform1i(loc, 5);
 if (!piglit_check_gl_error(GL_NO_ERROR))
 return PIGLIT_FAIL;

@@ -223,6 +224,7 @@
check_UniformHandleui64_with_implicit_bound_image(void *data)
  */
 glUniformHandleui64ARB(loc, handle);
 glProgramUniformHandleui64vARB(prog, loc, 1, &handle);
+glUniform1i(loc, 5);
 if (!piglit_check_gl_error(GL_NO_ERROR))
 return PIGLIT_FAIL;








--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 5/6] arb_bindless_texture: add inout-non-matching-type.frag compiler tests

2017-04-27 Thread Nicolai Hähnle

On 27.04.2017 10:12, Samuel Pitoiset wrote:



On 04/27/2017 10:02 AM, Samuel Pitoiset wrote:



On 04/27/2017 02:24 AM, Timothy Arceri wrote:

Same comment for 3-5 as for comment 2. I'd rather see varyables
function params and return values used as frag/vert outputs otherwise
there is no guarantee the compiler won't just optimise the invalid
uses away.


I think it's a bit overkill. Most of the compiler tests in piglit are
really pretty simple. Looks like only very few of them guarantee that
the compiler won't optimize. Yeah, it's sad.

I have written and tested this series against NV blob. At least, this
one doesn't need anything else because it fails as-is.


I understand your point of view though. But the way I designed the
compiler tests for ARB_bindless_texture would need a bunch of changes.


I think these tests are mostly about the compiler accepting the syntax 
in the first place, so it's fine if they're trivial to optimize away.


The execution tests are what checks that later stages of the compiler 
pipeline are working correctly.


With that in mind, patches 2-5 are:

Reviewed-by: Nicolai Hähnle 








On 27/04/17 08:52, Samuel Pitoiset wrote:

"Replace Section 4.1.X, (Images)"

 "As function parameters, images may be only passed to images
  of matching type."

"Replace Section 4.1.7 (Samplers), p. 25"

 "As function parameters, samplers may be only passed to samplers
  of matching type."

Two simple test cases to make sure types are checked.

Signed-off-by: Samuel Pitoiset 
---
  .../compiler/images/inout-non-matching-type.frag   | 26
++
  .../compiler/samplers/inout-non-matching-type.frag | 25
+
  2 files changed, 51 insertions(+)
  create mode 100644
tests/spec/arb_bindless_texture/compiler/images/inout-non-matching-type.frag

  create mode 100644
tests/spec/arb_bindless_texture/compiler/samplers/inout-non-matching-type.frag


diff --git
a/tests/spec/arb_bindless_texture/compiler/images/inout-non-matching-type.frag
b/tests/spec/arb_bindless_texture/compiler/images/inout-non-matching-type.frag

new file mode 100644
index 0..0ff8d5bc9
--- /dev/null
+++
b/tests/spec/arb_bindless_texture/compiler/images/inout-non-matching-type.frag

@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+// The ARB_bindless_texture spec says:
+//
+//  "Replace Section 4.1.X, (Images)"
+//
+//  "As function parameters, images may be only passed to images of
+//   matching type."
+
+void f(inout image2D p)
+{
+}
+
+void main()
+{
+writeonly image1D u;
+f(u);
+}
diff --git
a/tests/spec/arb_bindless_texture/compiler/samplers/inout-non-matching-type.frag
b/tests/spec/arb_bindless_texture/compiler/samplers/inout-non-matching-type.frag

new file mode 100644
index 0..25a5724cf
--- /dev/null
+++
b/tests/spec/arb_bindless_texture/compiler/samplers/inout-non-matching-type.frag

@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+// The ARB_bindless_texture spec says:
+//
+//  "Replace Section 4.1.7 (Samplers), p. 25"
+//
+//  "As function parameters, samplers may be only passed to
samplers of
+//   matching type."
+
+void f(inout sampler2D p)
+{
+}
+
+void main()
+{
+sampler1D u;
+f(u);
+}


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



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/6] arb_bindless_texture: test bound samplers/image with glUniform1i()

2017-04-27 Thread Nicolai Hähnle

On 27.04.2017 00:52, Samuel Pitoiset wrote:

From section 2.14.16 of the ARB_bindless_texture spec:

"When used as uniforms in the default block, the value of sampler
 variables may be specified with either Uniform1i{v} or
 UniformHandleui64{v}ARB."

From section 2.14.X of the ARB_bindless_texture spec:

"When used as uniforms in the default block, the value of image
 variables may be specified with either Uniform1i{v} or
 UniformHandleui64{v}ARB."

This test just ensures that setting a uniform to bound samplers
doesn't report any GL errors.


Okay, I'm very confused again. The spec *also* says this:

   "These modifiers control whether default-block uniforms of the
corresponding types may have their values set via both
UniformHandle* and Uniform1i (bindless_sampler and bindless_image)
or only via Uniform1i (bound_sampler and bound_image)."

Which would actually suggest that the current test is wrong *before* 
this patch. What's going on here?





Signed-off-by: Samuel Pitoiset 
---
 tests/spec/arb_bindless_texture/uniform.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/spec/arb_bindless_texture/uniform.c 
b/tests/spec/arb_bindless_texture/uniform.c
index c4c06df05..1524eb18c 100644
--- a/tests/spec/arb_bindless_texture/uniform.c
+++ b/tests/spec/arb_bindless_texture/uniform.c
@@ -158,6 +158,7 @@ check_UniformHandleui64_with_implicit_bound_sampler(void 
*data)
 */
glUniformHandleui64ARB(loc, handle);
glProgramUniformHandleui64vARB(prog, loc, 1, &handle);
+   glUniform1i(loc, 5);
if (!piglit_check_gl_error(GL_NO_ERROR))
return PIGLIT_FAIL;

@@ -223,6 +224,7 @@ check_UniformHandleui64_with_implicit_bound_image(void 
*data)
 */
glUniformHandleui64ARB(loc, handle);
glProgramUniformHandleui64vARB(prog, loc, 1, &handle);
+   glUniform1i(loc, 5);
if (!piglit_check_gl_error(GL_NO_ERROR))
return PIGLIT_FAIL;





--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] shader_runner: clean up resident handles at exit time

2017-04-27 Thread Nicolai Hähnle
I wonder whether this should also be cleaned up after each test when 
running multiple tests at a time. But I don't think we're doing that 
with textures and other objects either...


Reviewed-by: Nicolai Hähnle 

On 27.04.2017 10:42, Samuel Pitoiset wrote:

Signed-off-by: Samuel Pitoiset 
---
 tests/shaders/shader_runner.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 2047d6cb0..6ac5f9893 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3765,6 +3765,9 @@ piglit_display(void)
for (i = 0; i < ARRAY_SIZE(texture_bindings); i++)
clear_texture_binding(i);

+   for (i = 0; i < ARRAY_SIZE(resident_handles); i++)
+   clear_resident_handle(i);
+
if (prog != 0) {
glDeleteProgram(prog);
glUseProgram(0);




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_shader_image_load_store: add memory-qualifier-with-non-image-type.frag

2017-04-27 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 26.04.2017 18:42, Samuel Pitoiset wrote:

Signed-off-by: Samuel Pitoiset 
---
 .../memory-qualifier-with-non-image-type.frag  | 25 ++
 1 file changed, 25 insertions(+)
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/memory-qualifier-with-non-image-type.frag

diff --git 
a/tests/spec/arb_shader_image_load_store/compiler/memory-qualifier-with-non-image-type.frag
 
b/tests/spec/arb_shader_image_load_store/compiler/memory-qualifier-with-non-image-type.frag
new file mode 100644
index 0..71087ec21
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/compiler/memory-qualifier-with-non-image-type.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_shader_image_load_store: enable
+
+// From Section 4.10 (Memory Qualifiers) of the GLSL 4.50 spec:
+//
+// "Variables declared as image types (the basic opaque types with “image”
+//  in their keyword) can be further qualified with one or more of the
+//  following memory qualifiers: ..."
+//
+// Easy enough to infer that memory qualifiers should not be used with
+// non-image types.
+
+uniform Block {
+   volatile int x;
+};
+
+void main()
+{
+}




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_fragment_shader_interlock: Test image load/store.

2017-04-27 Thread Nicolai Hähnle

On 25.04.2017 20:58, Plamena Manolova wrote:

A test to check whether GL_ARB_fragment_shader_interlock operates as
expected. This test simulates blending behaviour by using image loads/stores
to a 3D texture. The blending formula used is:
result = current_alpha * current_color + (1 - current_alpha) * previous_color
Multisampling is also enabled and tested at 2, 4, 8 and 16.

Signed-off-by: Plamena Manolova 


Thanks for the v2!

Reviewed-by: Nicolai Hähnle 



---
 tests/all.py   |   5 +
 tests/spec/CMakeLists.txt  |   1 +
 .../CMakeLists.gl.txt  |  12 +
 .../arb_fragment_shader_interlock/CMakeLists.txt   |   1 +
 .../image-load-store.c | 297 +
 5 files changed, 316 insertions(+)
 create mode 100644 tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
 create mode 100644 tests/spec/arb_fragment_shader_interlock/image-load-store.c

diff --git a/tests/all.py b/tests/all.py
index 3cd3b47..f105701 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4804,6 +4804,11 @@ with profile.test_list.group_manager(
 g(['arb_post_depth_coverage-sample-shading'])

 with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_fragment_shader_interlock')) as g:
+g(['arb_fragment_shader_interlock-image-load-store'])
+
+with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_shader_image_size')) as g:
 g(['arb_shader_image_size-builtin'], 'builtin')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 5bdde84..5bfa76b 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -160,3 +160,4 @@ add_subdirectory (arb_shader_texture_image_samples)
 add_subdirectory (arb_texture_barrier)
 add_subdirectory (intel_conservative_rasterization)
 add_subdirectory (arb_post_depth_coverage)
+add_subdirectory (arb_fragment_shader_interlock)
diff --git a/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt 
b/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
new file mode 100644
index 000..d8bb7da
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_fragment_shader_interlock-image-load-store
+   image-load-store.c)
diff --git a/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt 
b/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_fragment_shader_interlock/image-load-store.c 
b/tests/spec/arb_fragment_shader_interlock/image-load-store.c
new file mode 100644
index 000..390ffb2
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/image-load-store.c
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "piglit-util-gl.h"
+
+/*
+ * A test to check whether GL_ARB_fragment_shader_interlock operates as
+ * expected. This test simulates blending behaviour by using image loads/stores
+ * to a 3D texture. The blending formula used is:
+ * result = current_alpha * current_color + (1 - current_alpha) * 
previous_color
+ * Multisampling is also enabled and tested at 2, 4, 8 and 16.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 42;
+   config.supports_gl_core_ver

Re: [Piglit] [PATCH] arb_shader_image_load_store: add format-layout-with-non-image-type.frag compiler test

2017-04-27 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 26.04.2017 18:28, Samuel Pitoiset wrote:

Signed-off-by: Samuel Pitoiset 
---
 .../format-layout-with-non-image-type.frag | 24 ++
 1 file changed, 24 insertions(+)
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/format-layout-with-non-image-type.frag

diff --git 
a/tests/spec/arb_shader_image_load_store/compiler/format-layout-with-non-image-type.frag
 
b/tests/spec/arb_shader_image_load_store/compiler/format-layout-with-non-image-type.frag
new file mode 100644
index 0..e072cba0d
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/compiler/format-layout-with-non-image-type.frag
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_shader_image_load_store: enable
+
+// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 spec:
+//
+// "Format layout qualifiers can be used on image variable declarations
+//  (those declared with a basic type having “image” in its keyword)."
+//
+// Easy enough to infer that format layout qualifiers should not be used with
+// non-image types.
+
+uniform Block {
+   layout (r32f) int x;
+};
+
+void main()
+{
+}




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_fragment_shader_interlock: Test image load/store.

2017-04-24 Thread Nicolai Hähnle

Hi Plamena,

On 24.04.2017 23:04, Manolova, Plamena wrote:
[snip]

+   static const char *fs_text =
+   "#version 430\n"
+   "#extension GL_ARB_fragment_shader_interlock:
require\n"
+   "layout(sample_interlock_ordered) in;\n"


Since the shader writes to per-pixel data, it needs to be
pixel_interlock_ordered. Otherwise, there might be a race between
shader invocations that affect the same pixel but disjoint sets of
samples (i.e. along the seams between triangles).


Actually this test cares only about the data written to image3D
img_output  which stores data on a per-sample basis (with the z
coordinate being the sample number), so we actually want
sample_interlock_ordered.


The last plane/slice of img_output contains the per-pixel average over 
all samples.


So I'm concerned about the following scenario of two invocations 
operating on different samples of the same pixel and interleaving as 
follows:


Invocation 1   Invocation 2
   
Write current-sample data
Read and average all samples
   Write current-sample data
   Read and average all samples
   Write per-pixel data
Write per-pixel data

Invocation 1 will produce the final per-pixel data, but won't take into 
account the per-sample data written by Invocation 2. This particular 
issue is fixed by using any of the pixel_interlock_* modes.


Thanks,
Nicolai






+   "layout(rgba32f, binding = 0) uniform image3D
img_output;\n"
+   "layout(location = 1) uniform int sample_rate;\n"
+   "smooth in vec4 col_vary;\n"
+   "out vec4 col_out;\n"
+   "void main()\n"
+   "{\n"
+   "   vec4 result = vec4(0.0, 0.0, 0.0, 1.0);\n"
+   "   ivec3 current_sample_coord =
ivec3(gl_FragCoord.x, gl_FragCoord.y, gl_SampleID);\n"
+   "   ivec3 result_coord =
ivec3(gl_FragCoord.x, gl_FragCoord.y, sample_rate);\n"
+   "   int i;\n"
+   "   beginInvocationInterlockARB();\n"
+   "   vec4 current_sample_color =
imageLoad(img_output, current_sample_coord);\n"
+   "   result.rgb += col_vary.a * col_vary.rgb
+ (1 - col_vary.a) * current_sample_color.rgb;\n"
+   "   imageStore(img_output,
current_sample_coord, result);\n"
+   "\n"
+   "   for (i = 0; i < sample_rate; i++) {\n"
+   "   if (i != gl_SampleID) {\n"
+   "   ivec3 sample_coord =
ivec3(gl_FragCoord.x, gl_FragCoord.y, i);\n"
+   "   vec4 sample_color =
imageLoad(img_output, sample_coord);\n"
+   "   result.rgb +=
sample_color.rgb;\n"
+   "   }\n"
+   "   }\n"
+   "   result.rgb /= sample_rate;\n"
+   "   imageStore(img_output, result_coord,
result);\n"
+   "   endInvocationInterlockARB();\n"
+   "   col_out = result;\n"
+   "}\n";
+
+   GLuint prog;
+
+   prog = piglit_build_simple_program(vs_text, fs_text);
+   glUseProgram(prog);
+
+   glBindAttribLocation(prog, 0, "pos_in");
+   glBindAttribLocation(prog, 1, "col_in");
+
+   glLinkProgram(prog);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   return prog;
+}
+
+static GLuint
+make_texture_buffer(void)
+{
+   GLuint tex;
+
+   glGenTextures(1, &tex);
+   glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+   glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 2,
+   GL_RGBA32F, piglit_width, piglit_height, false);
+   glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+
+   return tex;
+}
+
+static GLuint
+make_texture_blend(void)
+{
+   GLuint tex;
+
+   glGenTextures(1, &tex);
+   glActiveTexture(GL_TEXTURE0);
+   glBindTexture(GL_TEXTURE_3D, tex);
+   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE);
+   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,
GL_CLA

Re: [Piglit] [PATCH] arb_fragment_shader_interlock: Test image load/store.

2017-04-23 Thread Nicolai Hähnle

On 19.04.2017 02:58, Plamena Manolova wrote:

A test to check whether GL_ARB_fragment_shader_interlock operates as
expected. This test simulates blending behaviour by using image loads/stores
to a 3D texture. The bledning formula used is:


Type: blending



result = current_alpha * current_color + (1 - current_alpha) * previous_color
Multisampling is also enabled and tested at 2, 4, 8 and 16.

Signed-off-by: Plamena Manolova 
---
 tests/all.py   |   5 +
 tests/spec/CMakeLists.txt  |   1 +
 .../CMakeLists.gl.txt  |  12 +
 .../arb_fragment_shader_interlock/CMakeLists.txt   |   1 +
 .../image-load-store.c | 298 +
 5 files changed, 317 insertions(+)
 create mode 100644 tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
 create mode 100644 tests/spec/arb_fragment_shader_interlock/image-load-store.c

diff --git a/tests/all.py b/tests/all.py
index a832ffb..1a28e62 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4803,6 +4803,11 @@ with profile.test_list.group_manager(
 g(['arb_post_depth_coverage-sample-shading'])

 with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_fragment_shader_interlock')) as g:
+g(['arb_fragment_shader_interlock-image-load-store'])
+
+with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_shader_image_size')) as g:
 g(['arb_shader_image_size-builtin'], 'builtin')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 5bdde84..5bfa76b 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -160,3 +160,4 @@ add_subdirectory (arb_shader_texture_image_samples)
 add_subdirectory (arb_texture_barrier)
 add_subdirectory (intel_conservative_rasterization)
 add_subdirectory (arb_post_depth_coverage)
+add_subdirectory (arb_fragment_shader_interlock)
diff --git a/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt 
b/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
new file mode 100644
index 000..d8bb7da
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_fragment_shader_interlock-image-load-store
+   image-load-store.c)
diff --git a/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt 
b/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_fragment_shader_interlock/image-load-store.c 
b/tests/spec/arb_fragment_shader_interlock/image-load-store.c
new file mode 100644
index 000..2f4a7d0
--- /dev/null
+++ b/tests/spec/arb_fragment_shader_interlock/image-load-store.c
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "piglit-util-gl.h"
+
+/*
+ * A test to check whether GL_ARB_fragment_shader_interlock operates as
+ * expected. This test simulates blending behaviour by using image loads/stores
+ * to a 3D texture. The bledning formula used is:


Typo: blending



+ * result = current_alpha * current_color + (1 - current_alpha) * 
previous_color
+ * Multisampling is also enabled and tested at 2, 4, 8 and 16.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 42;
+   config.supports_gl_core_version = 42;
+   config.window_width = 100;
+   config.window_height = 100;
+   config.window_visual = PIGLIT_GL_VISUAL_RG

Re: [Piglit] [PATCH] arb_enhanced_layouts: Remove unused variable.

2017-04-21 Thread Nicolai Hähnle

On 20.04.2017 23:42, Vinson Lee wrote:

Fix GCC unused-const-variable warning.

gs-stream-location-aliasing.c:74:18: warning: ‘num_total_xfb_results’ defined 
but not used [-Wunused-const-variable=]
 static const int num_total_xfb_results = 2 * 2 * 2;
  ^

Fixes: b81ecc9d3c68 ("arb_enhanced_layouts: add test for location aliasing across GS 
vertex streams")
Signed-off-by: Vinson Lee 


Thanks, and sorry for the noise.

Reviewed-by: Nicolai Hähnle 



---
 tests/spec/arb_enhanced_layouts/gs-stream-location-aliasing.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/spec/arb_enhanced_layouts/gs-stream-location-aliasing.c 
b/tests/spec/arb_enhanced_layouts/gs-stream-location-aliasing.c
index 5bcacb0fdb37..765431e98665 100644
--- a/tests/spec/arb_enhanced_layouts/gs-stream-location-aliasing.c
+++ b/tests/spec/arb_enhanced_layouts/gs-stream-location-aliasing.c
@@ -71,7 +71,6 @@ static const char gs_text[] =

 static const int num_in_vertices = 2;
 static const int num_xfb_results_per_stream = 2 * 2;
-static const int num_total_xfb_results = 2 * 2 * 2;

 static void
 build_and_use_program()




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 3/5] arb_sparse_buffer: add basic rendering test

2017-04-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

v2: also add a test where the vbuf is stored outside the committed
region

Reviewed-by: Alejandro Piñeiro  (v1)
---
 tests/all.py   |   1 +
 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt |   1 +
 tests/spec/arb_sparse_buffer/basic.c   | 199 +
 3 files changed, 201 insertions(+)
 create mode 100644 tests/spec/arb_sparse_buffer/basic.c

diff --git a/tests/all.py b/tests/all.py
index 9cc2b9d..89e9ad4 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4396,20 +4396,21 @@ with profile.test_list.group_manager(
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vs'], 'vs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vsexceed'],
   'vsexceed')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fs'], 'fs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fsexceed'],
   'fsexceed')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_sparse_buffer')) as g:
+g(['arb_sparse_buffer-basic'], 'basic')
 g(['arb_sparse_buffer-minmax'], 'minmax')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
 g(['ext_polygon_offset_clamp-draw'])
 g(['ext_polygon_offset_clamp-draw_gles2'])
 g(['ext_polygon_offset_clamp-dlist'])
 
 with profile.test_list.group_manager(
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
index 3490ba7..affbdf6 100644
--- a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
@@ -2,11 +2,12 @@ include_directories(
${GLEXT_INCLUDE_DIR}
${OPENGL_INCLUDE_PATH}
${piglit_SOURCE_DIR}/tests/util
 )
 
 link_libraries (
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_sparse_buffer-basic basic.c)
 piglit_add_executable (arb_sparse_buffer-minmax minmax.c)
diff --git a/tests/spec/arb_sparse_buffer/basic.c 
b/tests/spec/arb_sparse_buffer/basic.c
new file mode 100644
index 000..e181f24
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/basic.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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
+ *
+ * Draw a colored quad from a vertex buffer residing in a sparse buffer.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define BUFFER_OFFSET(i) ((char *)NULL + (i))
+
+static const char vs_source[] =
+"#version 130\n"
+"\n"
+"in vec4 pos;\n"
+"in vec4 color;\n"
+"\n"
+"out vec4 fs_color;\n"
+"\n"
+"void main() {\n"
+"   gl_Position = pos;\n"
+"   fs_color = color;\n"
+"}\n";
+
+static const char fs_source[] =
+"#version 130\n"
+"\n"
+"in vec4 fs_color;\n"
+"\n"
+"out vec4 out_color;\n"
+"\n"
+"void main() {\n"
+"   out_color = fs_color;\n"
+"}\n";
+
+/* Interleaved position and color data. */
+static const float vb_data[] = {
+   -1.0, -1.0, 0.0, 1.0,   0.5, 1.0, 0.0, 1.0,
+   -1.0,  1.0, 0.0, 1.0,   0.5, 1.0, 0.0, 1.0,
+1.0, -1.0, 0.0, 1.0,   0.5, 1.0, 0.0, 1.0,
+1.0,  1.0, 0.0, 1.0,   0.5, 1.0, 0.0, 1.0,
+};
+
+static int sparse_buffer_page_size;
+static GLuint prog

[Piglit] [PATCH v2 2/5] arb_sparse_buffer: minmax test

2017-04-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Reviewed-by: Alejandro Piñeiro 
---
 tests/all.py   |  5 +++
 tests/spec/CMakeLists.txt  |  1 +
 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt | 12 ++
 tests/spec/arb_sparse_buffer/CMakeLists.txt|  1 +
 tests/spec/arb_sparse_buffer/minmax.c  | 58 ++
 5 files changed, 77 insertions(+)
 create mode 100644 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_sparse_buffer/CMakeLists.txt
 create mode 100644 tests/spec/arb_sparse_buffer/minmax.c

diff --git a/tests/all.py b/tests/all.py
index a832ffb..9cc2b9d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4395,20 +4395,25 @@ with profile.test_list.group_manager(
 'max-ssbo-size')) as g:
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vs'], 'vs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vsexceed'],
   'vsexceed')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fs'], 'fs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fsexceed'],
   'fsexceed')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
+grouptools.join('spec', 'arb_sparse_buffer')) as g:
+g(['arb_sparse_buffer-minmax'], 'minmax')
+
+with profile.test_list.group_manager(
+PiglitGLTest,
 grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
 g(['ext_polygon_offset_clamp-draw'])
 g(['ext_polygon_offset_clamp-draw_gles2'])
 g(['ext_polygon_offset_clamp-dlist'])
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_pipeline_statistics_query')) as g:
 g(['arb_pipeline_statistics_query-vert'])
 g(['arb_pipeline_statistics_query-vert_adj'])
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 5bdde84..0eda19d 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -54,20 +54,21 @@ add_subdirectory (arb_shader_subroutine)
 add_subdirectory (arb_shader_texture_lod/execution)
 add_subdirectory (arb_shader_atomic_counters)
 add_subdirectory (arb_shader_objects)
 add_subdirectory (arb_shader_image_load_store)
 add_subdirectory (arb_shader_image_size)
 add_subdirectory (arb_shading_language_420pack/execution)
 add_subdirectory (arb_stencil_texturing)
 add_subdirectory (arb_sync)
 add_subdirectory (arb_uniform_buffer_object)
 add_subdirectory (ati_draw_buffers)
+add_subdirectory (arb_sparse_buffer)
 add_subdirectory (arb_tessellation_shader)
 add_subdirectory (arb_texture_buffer_object)
 add_subdirectory (arb_texture_buffer_range)
 add_subdirectory (arb_texture_compression)
 add_subdirectory (arb_texture_cube_map_array)
 add_subdirectory (arb_texture_float)
 add_subdirectory (arb_texture_rectangle)
 add_subdirectory (arb_texture_multisample)
 add_subdirectory (arb_texture_storage)
 add_subdirectory (arb_texture_storage_multisample)
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
new file mode 100644
index 000..3490ba7
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_sparse_buffer-minmax minmax.c)
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_sparse_buffer/minmax.c 
b/tests/spec/arb_sparse_buffer/minmax.c
new file mode 100644
index 000..1f8e617
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/minmax.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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
+ * IMPLI

[Piglit] [PATCH v2 1/5] util: add MIN3/MAX3 convenience macros

2017-04-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/util/piglit-util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 7e9c840..b30ae07 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -176,20 +176,22 @@ enum piglit_result
 piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
 const char **selected_subtests,
 size_t num_selected_subtests,
 enum piglit_result previous_result);
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 #define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
 #define MIN2(a, b) ((a) > (b) ? (b) : (a))
 #define MAX2(a, b) ((a) > (b) ? (a) : (b))
+#define MIN3(a, b, c) MIN2(MIN2((a), (b)), (c))
+#define MAX3(a, b, c) MAX2(MAX2((a), (b)), (c))
 #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
 
 /**
  * Utility macro that checks for a given opengl error, and report a
  * subtest result.
  */
 #define PIGLIT_SUBTEST_ERROR(error, global, ...) \
 do { \
bool local = piglit_check_gl_error((error)); \
global = global && local; \
-- 
2.9.3

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


[Piglit] [PATCH v2 5/5] arb_sparse_buffer: add tests for various *BufferSubData commands

2017-04-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/all.py   |   1 +
 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt |   1 +
 tests/spec/arb_sparse_buffer/buffer-data.c | 593 +
 3 files changed, 595 insertions(+)
 create mode 100644 tests/spec/arb_sparse_buffer/buffer-data.c

diff --git a/tests/all.py b/tests/all.py
index 76af2aa..5528c5a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4397,20 +4397,21 @@ with profile.test_list.group_manager(
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vsexceed'],
   'vsexceed')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fs'], 'fs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fsexceed'],
   'fsexceed')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_sparse_buffer')) as g:
 g(['arb_sparse_buffer-basic'], 'basic')
+g(['arb_sparse_buffer-buffer-data'], 'buffer-data')
 g(['arb_sparse_buffer-commit'], 'commit')
 g(['arb_sparse_buffer-minmax'], 'minmax')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
 g(['ext_polygon_offset_clamp-draw'])
 g(['ext_polygon_offset_clamp-draw_gles2'])
 g(['ext_polygon_offset_clamp-dlist'])
 
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
index 612d910..09874d7 100644
--- a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
@@ -3,12 +3,13 @@ include_directories(
${OPENGL_INCLUDE_PATH}
${piglit_SOURCE_DIR}/tests/util
 )
 
 link_libraries (
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
 )
 
 piglit_add_executable (arb_sparse_buffer-basic basic.c)
+piglit_add_executable (arb_sparse_buffer-buffer-data buffer-data.c)
 piglit_add_executable (arb_sparse_buffer-commit commit.c)
 piglit_add_executable (arb_sparse_buffer-minmax minmax.c)
diff --git a/tests/spec/arb_sparse_buffer/buffer-data.c 
b/tests/spec/arb_sparse_buffer/buffer-data.c
new file mode 100644
index 000..31ece6f
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/buffer-data.c
@@ -0,0 +1,593 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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 sequences of BufferSubData, ClearBufferSubData, and CopyBufferSubData
+ * with partially committed sparse buffers.
+ *
+ * The same sequence of operations is applied to a sparse buffer and a
+ * shadow buffer on the CPU. In the end, the results are read back and 
compared.
+ *
+ * Has a stress-test mode: run with -stress N to perform N random operations.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+
+/* Set this to 1 for verbose logging of operations. */
+#define VERBOSE 0
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static void
+usage(const char *name)
+{
+   fprintf(stderr, "usage: %s [-stress N] [-seed S]\n", name);
+   exit(1);
+}
+
+static int sparse_buffer_page_size;
+
+struct buffer_pair {
+   GLuint sparse_buffer;
+   uint64_t size;
+   uint64_t num_pages;
+
+   /* Bitmap indicating which pages are committed. */
+   uint8_t *pagemap;
+
+   /* Shadow data buffer, contains the expected data. */
+   uint8_t *shadow;
+
+   /* Shadow copy that indicates which bytes contain defined data. */
+   uint8_t *defined;
+};
+
+static struct buffer_pair *
+create_b

[Piglit] [PATCH v2 0/5] ARB_sparse_buffer tests (less rudimentary version)

2017-04-19 Thread Nicolai Hähnle
Hi all,

some more additions to the sparse buffer tests I posted some time ago.
This allows you to stress the commit/uncommit logic and buffer ops.

Cheers,
Nicolai

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


[Piglit] [PATCH v2 4/5] arb_sparse_buffer: add an extended commit test

2017-04-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Test sequences of commit / uncommit. Verify that the committed pages
are there and retain their data using ClearNamedBufferData and
GetBufferSubData.
---
 tests/all.py   |   1 +
 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt |   1 +
 tests/spec/arb_sparse_buffer/commit.c  | 332 +
 3 files changed, 334 insertions(+)
 create mode 100644 tests/spec/arb_sparse_buffer/commit.c

diff --git a/tests/all.py b/tests/all.py
index 89e9ad4..76af2aa 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4397,20 +4397,21 @@ with profile.test_list.group_manager(
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'vsexceed'],
   'vsexceed')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fs'], 'fs')
 g(['arb_shader_storage_buffer_object-max-ssbo-size', 'fsexceed'],
   'fsexceed')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_sparse_buffer')) as g:
 g(['arb_sparse_buffer-basic'], 'basic')
+g(['arb_sparse_buffer-commit'], 'commit')
 g(['arb_sparse_buffer-minmax'], 'minmax')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
 g(['ext_polygon_offset_clamp-draw'])
 g(['ext_polygon_offset_clamp-draw_gles2'])
 g(['ext_polygon_offset_clamp-dlist'])
 
 with profile.test_list.group_manager(
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
index affbdf6..612d910 100644
--- a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
@@ -3,11 +3,12 @@ include_directories(
${OPENGL_INCLUDE_PATH}
${piglit_SOURCE_DIR}/tests/util
 )
 
 link_libraries (
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
 )
 
 piglit_add_executable (arb_sparse_buffer-basic basic.c)
+piglit_add_executable (arb_sparse_buffer-commit commit.c)
 piglit_add_executable (arb_sparse_buffer-minmax minmax.c)
diff --git a/tests/spec/arb_sparse_buffer/commit.c 
b/tests/spec/arb_sparse_buffer/commit.c
new file mode 100644
index 000..07c8cdd
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/commit.c
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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 sequences of commitment and uncommitment.
+ *
+ * Whenever a page is newly committed, clear it with a random value. Verify
+ * that this value is retained by downloading the buffer contents with
+ * GetBufferSubData.
+ *
+ * Has a stress-test mode: run with -stress N to perform N random 
commit/uncommit
+ * operations.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+
+/* Set to 1 for verbose logging of operations. */
+#define VERBOSE 0
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int sparse_buffer_page_size;
+
+struct sparse_buffer {
+   GLuint buffer;
+   uint64_t num_pages;
+   uint64_t num_committed_pages;
+
+   /* Bitmap indicating which pages are committed. */
+   uint8_t *pagemap;
+
+   /* For each page, the value that it was cleared with. */
+   uint32_t *pagedata;
+};
+
+static struct sparse_buffer *
+create_buffer(uint64_t num_pages)
+{
+   uint64_t size;
+   struct sparse_buffer *buf = calloc(1, sizeof(*buf));
+   if (!buf)
+   abort();
+
+   buf->num_pages = num_pages;
+   size = buf->num_pages * sp

Re: [Piglit] [PATCH] gl-1.4: test some glMultiDrawArrays error conditions

2017-04-18 Thread Nicolai Hähnle

I added some spec quotes before pushing, thanks for taking a look!

Cheers,
Nicolai

On 14.04.2017 10:33, Samuel Pitoiset wrote:



On 04/13/2017 09:38 PM, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

---
  tests/all.py   |   1 +
  tests/spec/gl-1.4/CMakeLists.gl.txt|   1 +
  tests/spec/gl-1.4/multidrawarrays-errors.c | 114
+
  3 files changed, 116 insertions(+)
  create mode 100644 tests/spec/gl-1.4/multidrawarrays-errors.c

diff --git a/tests/all.py b/tests/all.py
index 0b84e5d..bc84111 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1035,20 +1035,21 @@ with profile.test_list.group_manager(
  g(['tex3d-depth1'])
with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', '!opengl 1.4')) as g:
  g(['fdo25614-genmipmap'], run_concurrent=False)
  g(['tex1d-2dborder'], run_concurrent=False)
  g(['blendminmax'], run_concurrent=False)
  g(['blendsquare'], run_concurrent=False)
  g(['gl-1.4-dlist-multidrawarrays'])
+g(['gl-1.4-multidrawarrays-errors'])
  g(['gl-1.4-polygon-offset'])
  g(['draw-batch'], run_concurrent=False)
  g(['stencil-wrap'], run_concurrent=False)
  g(['triangle-rasterization'], run_concurrent=False)
  g(['triangle-rasterization', '-use_fbo'],
'triangle-rasterization-fbo',
run_concurrent=False)
  g(['triangle-rasterization-overdraw'], run_concurrent=False)
  g(['tex-miplevel-selection', '-nobias', '-nolod'],
'tex-miplevel-selection')
  g(['tex-miplevel-selection', '-nobias'],
'tex-miplevel-selection-lod')
diff --git a/tests/spec/gl-1.4/CMakeLists.gl.txt
b/tests/spec/gl-1.4/CMakeLists.gl.txt
index a6888f3..22ce3c4 100644
--- a/tests/spec/gl-1.4/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.4/CMakeLists.gl.txt
@@ -2,13 +2,14 @@ include_directories(
  ${GLEXT_INCLUDE_DIR}
  ${OPENGL_INCLUDE_PATH}
  )
link_libraries (
  piglitutil_${piglit_target_api}
  ${OPENGL_gl_LIBRARY}
  )
piglit_add_executable (gl-1.4-dlist-multidrawarrays
dlist-multidrawarrays.c)
+piglit_add_executable (gl-1.4-multidrawarrays-errors
multidrawarrays-errors.c)
  piglit_add_executable (gl-1.4-polygon-offset polygon-offset.c)
# vim: ft=cmake:
diff --git a/tests/spec/gl-1.4/multidrawarrays-errors.c
b/tests/spec/gl-1.4/multidrawarrays-errors.c
new file mode 100644
index 000..db25a78
--- /dev/null
+++ b/tests/spec/gl-1.4/multidrawarrays-errors.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2017 Advanced Micro Devices, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 NON-INFRINGEMENT. IN NO EVENT
SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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.
+ */
+
+/**
+ * Test error conditions of glMultiDrawArrays.
+ * glMultiDrawArrays is part of GL 1.4 and later.
+ *
+ * Based loosely on dlist-multidrawarrays.c.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+config.supports_gl_compat_version = 14;
+config.window_visual = PIGLIT_GL_VISUAL_DOUBLE |
PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float verts[][2] = {
+{ -1.0f, -1.0f },
+{  1.0f, -1.0f },
+{  1.0f,  1.0f },
+{ -1.0f,  1.0f }
+};
+
+static const float zero[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+
+static bool
+test_draw_negative_primcount()
+{
+int first = 0;
+GLsizei count = 4;
+
+glClearColor(0.0, 0.0, 0.0, 0.0);
+glClear(GL_COLOR_BUFFER_BIT);
+
+glEnableClientState(GL_VERTEX_ARRAY);
+glVertexPointer(2, GL_FLOAT, 0, verts);
+


/**
 * The GL spec says 
 */

Maybe add this?


+glMultiDrawArrays(GL_TRIANGLE_STRIP, &first, &count, -1);
+if (!piglit_check_gl_error(GL_INVALID_VALUE))
+return false;
+
+return

[Piglit] [PATCH] gl-1.4: test some glMultiDrawArrays error conditions

2017-04-13 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/all.py   |   1 +
 tests/spec/gl-1.4/CMakeLists.gl.txt|   1 +
 tests/spec/gl-1.4/multidrawarrays-errors.c | 114 +
 3 files changed, 116 insertions(+)
 create mode 100644 tests/spec/gl-1.4/multidrawarrays-errors.c

diff --git a/tests/all.py b/tests/all.py
index 0b84e5d..bc84111 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1035,20 +1035,21 @@ with profile.test_list.group_manager(
 g(['tex3d-depth1'])
 
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', '!opengl 1.4')) as g:
 g(['fdo25614-genmipmap'], run_concurrent=False)
 g(['tex1d-2dborder'], run_concurrent=False)
 g(['blendminmax'], run_concurrent=False)
 g(['blendsquare'], run_concurrent=False)
 g(['gl-1.4-dlist-multidrawarrays'])
+g(['gl-1.4-multidrawarrays-errors'])
 g(['gl-1.4-polygon-offset'])
 g(['draw-batch'], run_concurrent=False)
 g(['stencil-wrap'], run_concurrent=False)
 g(['triangle-rasterization'], run_concurrent=False)
 g(['triangle-rasterization', '-use_fbo'], 'triangle-rasterization-fbo',
   run_concurrent=False)
 g(['triangle-rasterization-overdraw'], run_concurrent=False)
 g(['tex-miplevel-selection', '-nobias', '-nolod'],
   'tex-miplevel-selection')
 g(['tex-miplevel-selection', '-nobias'], 'tex-miplevel-selection-lod')
diff --git a/tests/spec/gl-1.4/CMakeLists.gl.txt 
b/tests/spec/gl-1.4/CMakeLists.gl.txt
index a6888f3..22ce3c4 100644
--- a/tests/spec/gl-1.4/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.4/CMakeLists.gl.txt
@@ -2,13 +2,14 @@ include_directories(
${GLEXT_INCLUDE_DIR}
${OPENGL_INCLUDE_PATH}
 )
 
 link_libraries (
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
 )
 
 piglit_add_executable (gl-1.4-dlist-multidrawarrays dlist-multidrawarrays.c)
+piglit_add_executable (gl-1.4-multidrawarrays-errors multidrawarrays-errors.c)
 piglit_add_executable (gl-1.4-polygon-offset polygon-offset.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.4/multidrawarrays-errors.c 
b/tests/spec/gl-1.4/multidrawarrays-errors.c
new file mode 100644
index 000..db25a78
--- /dev/null
+++ b/tests/spec/gl-1.4/multidrawarrays-errors.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2017 Advanced Micro Devices, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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.
+ */
+
+/**
+ * Test error conditions of glMultiDrawArrays.
+ * glMultiDrawArrays is part of GL 1.4 and later.
+ *
+ * Based loosely on dlist-multidrawarrays.c.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 14;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float verts[][2] = {
+   { -1.0f, -1.0f },
+   {  1.0f, -1.0f },
+   {  1.0f,  1.0f },
+   { -1.0f,  1.0f }
+};
+
+static const float zero[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+
+static bool
+test_draw_negative_primcount()
+{
+   int first = 0;
+   GLsizei count = 4;
+
+   glClearColor(0.0, 0.0, 0.0, 0.0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glVertexPointer(2, GL_FLOAT, 0, verts);
+
+   glMultiDrawArrays(GL_TRIANGLE_STRIP, &first, &count, -1);
+   if (!piglit_check_gl_error(GL_INVALID_VALUE))
+   return false;
+
+   return piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, zero);
+}
+
+static bool
+test_draw_negative_count()
+{
+   static const int first[2] = { 0, 0 };
+   static const GLsiz

Re: [Piglit] [PATCH] arb_shader_image_load_store: Create complete textures.

2017-04-11 Thread Nicolai Hähnle

On 10.04.2017 00:26, Dorian Apanel wrote:

Hi Nicolai,

Thanks for checking it.
Yes I can add some negative tests for it - as another patch, maybe in
this week.


Thanks.



As I understand the spec, log2(size) is not relevant here.
Example: You create texture, default filter uses mipmaps, and default
max level is 1000, base 0. You supply 5 mips (16,8,4,2,1). At this
point, even if log2(16)+1 == 5, texture is not complete. OGL expects 995
more levels of size 1.

From Spec: "required width for mipmap level i is max(1, floor(w_b / 2^i))"
See also this SO answer http://stackoverflow.com/a/3906855/1688267 and
"Creating a complete texture" paragraph
here https://www.khronos.org/opengl/wiki/Common_Mistakes


Section 8.17 (Texture Completeness) says:

"Image levels k where k < level_base or k > q are insignificant to the 
definition of completeness."


... and Section 8.14.3 (Mipmapping) defines q as:

p = floor(log2 (maxsize)) + level_base
q = min{p, level_max}

Explicitly setting TEXTURE_MAX_LEVEL has *never* been a necessity in 
OpenGL. You only need it if, as in this test, you don't define the 
smallest levels in the mip tree.


Cheers,
Nicolai




Thanks,
Dorian

2017-04-05 15:58 GMT+02:00 Nicolai Hähnle mailto:nhaeh...@gmail.com>>:

On 05.04.2017 09:55, Dorian Apanel wrote:

From: Dorian Apanel mailto:dorian.apanel%2bpig...@gmail.com>>

Textures created by image load/store tests are not complete (max
level defaults to 1000).
Load/Store on incomplete textures should return zeros/change
nothing.
This fix sets proper base and max level of textures.

Signed-off-by: Dorian Apanel mailto:dorian.apa...@gmail.com>>


Interesting. It seems you're right, but could you please also add a
corresponding negative test and check it against whatever drivers
you have? I.e., a test that creates a texture with mipmaps enabled,
defines only the first level image, and then tries to use it from a
shader to make sure that (a) reads return 0 and (b) writes are ignored?

Also, the commit message doesn't quite capture the heart of it as
far as I understand it. The textures are incomplete because
num_levels levels are created, which may be less than log2(size). So
GL_TEXTURE_MAX_LEVEL is used to restrict the required number of levels.

Thanks,
Nicolai



---
 tests/spec/arb_shader_image_load_store/common.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tests/spec/arb_shader_image_load_store/common.c
b/tests/spec/arb_shader_image_load_store/common.c
index cbeaac7..fdc2ef3 100644
--- a/tests/spec/arb_shader_image_load_store/common.c
+++ b/tests/spec/arb_shader_image_load_store/common.c
@@ -141,6 +141,11 @@ upload_image_levels(const struct image_info
img, unsigned num_levels,
 glGenTextures(1, &textures[unit]);
 glBindTexture(img.target->target, textures[unit]);

+if (img.target->target != GL_TEXTURE_BUFFER) {
+glTexParameteri(img.target->target,
GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(img.target->target,
GL_TEXTURE_MAX_LEVEL, num_levels - 1);
+}
+
 switch (img.target->target) {
 case GL_TEXTURE_1D:
 for (l = 0; l < num_levels; ++l) {
@@ -301,6 +306,8 @@ upload_image_levels(const struct image_info
img, unsigned num_levels,

 glGenTextures(1, &tmp_tex);
 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAX_LEVEL, 0);

 if (img.target->target ==
GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {

 glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
@@ -462,6 +469,8 @@ download_image_levels(const struct
image_info img, unsigned num_levels,

 glGenTextures(1, &tmp_tex);
 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAX_LEVEL, 0);

 glTexImage2D(GL_TEXTURE_2D, 0, img.format->format,
  grid.size.x, grid.size.y, 0,



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.





--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_shader_image_load_store: Create complete textures.

2017-04-05 Thread Nicolai Hähnle

On 05.04.2017 09:55, Dorian Apanel wrote:

From: Dorian Apanel 

Textures created by image load/store tests are not complete (max level defaults 
to 1000).
Load/Store on incomplete textures should return zeros/change nothing.
This fix sets proper base and max level of textures.

Signed-off-by: Dorian Apanel 


Interesting. It seems you're right, but could you please also add a 
corresponding negative test and check it against whatever drivers you 
have? I.e., a test that creates a texture with mipmaps enabled, defines 
only the first level image, and then tries to use it from a shader to 
make sure that (a) reads return 0 and (b) writes are ignored?


Also, the commit message doesn't quite capture the heart of it as far as 
I understand it. The textures are incomplete because num_levels levels 
are created, which may be less than log2(size). So GL_TEXTURE_MAX_LEVEL 
is used to restrict the required number of levels.


Thanks,
Nicolai



---
 tests/spec/arb_shader_image_load_store/common.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tests/spec/arb_shader_image_load_store/common.c 
b/tests/spec/arb_shader_image_load_store/common.c
index cbeaac7..fdc2ef3 100644
--- a/tests/spec/arb_shader_image_load_store/common.c
+++ b/tests/spec/arb_shader_image_load_store/common.c
@@ -141,6 +141,11 @@ upload_image_levels(const struct image_info img, unsigned 
num_levels,
 glGenTextures(1, &textures[unit]);
 glBindTexture(img.target->target, textures[unit]);

+if (img.target->target != GL_TEXTURE_BUFFER) {
+glTexParameteri(img.target->target, GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(img.target->target, GL_TEXTURE_MAX_LEVEL, 
num_levels - 1);
+}
+
 switch (img.target->target) {
 case GL_TEXTURE_1D:
 for (l = 0; l < num_levels; ++l) {
@@ -301,6 +306,8 @@ upload_image_levels(const struct image_info img, unsigned 
num_levels,

 glGenTextures(1, &tmp_tex);
 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);

 if (img.target->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
 
glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
@@ -462,6 +469,8 @@ download_image_levels(const struct image_info img, unsigned 
num_levels,

 glGenTextures(1, &tmp_tex);
 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);

 glTexImage2D(GL_TEXTURE_2D, 0, img.format->format,
  grid.size.x, grid.size.y, 0,




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_texture_buffer_range: test glTexBufferRange() with wrong target

2017-04-05 Thread Nicolai Hähnle

On 04.04.2017 14:50, Samuel Pitoiset wrote:

From OpenGL 4.5 spec, section 8.9 Buffer Textures:

  "An INVALID_ENUM error is generated if the effective target is not
   TEXTURE_BUFFER."

Signed-off-by: Samuel Pitoiset 


Reviewed-by: Nicolai Hähnle 



---
 tests/spec/arb_texture_buffer_range/errors.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tests/spec/arb_texture_buffer_range/errors.c 
b/tests/spec/arb_texture_buffer_range/errors.c
index 6c6a32cb6..a5e9cbec6 100644
--- a/tests/spec/arb_texture_buffer_range/errors.c
+++ b/tests/spec/arb_texture_buffer_range/errors.c
@@ -69,6 +69,15 @@ piglit_init(int argc, char **argv)
piglit_report_result(PIGLIT_FAIL);
}

+   /* From OpenGL 4.5 spec, section 8.9 Buffer Textures:
+*
+* "An INVALID_ENUM error is generated if the effective target is not
+*  TEXTURE_BUFFER."
+*/
+   glTexBufferRange(GL_TEXTURE_2D, GL_RGBA8, bo, 0, 4);
+   if (!piglit_check_gl_error(GL_INVALID_ENUM))
+   piglit_report_result(PIGLIT_FAIL);
+
/* If  is negative or if  is
 * less than or equal to zero or if  +  is greater than
 * the value of BUFFER_SIZE for the buffer bound to , of if




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] glslparsertest: Add test case for FDO bug #100438.

2017-04-03 Thread Nicolai Hähnle

On 01.04.2017 01:25, Vinson Lee wrote:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100438
Signed-off-by: Vinson Lee 


Reviewed-by: Nicolai Hähnle 



---
 tests/glslparsertest/glsl2/fdo100438.frag | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 tests/glslparsertest/glsl2/fdo100438.frag

diff --git a/tests/glslparsertest/glsl2/fdo100438.frag 
b/tests/glslparsertest/glsl2/fdo100438.frag
new file mode 100644
index ..c804835a5d63
--- /dev/null
+++ b/tests/glslparsertest/glsl2/fdo100438.frag
@@ -0,0 +1,10 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+//
+// [end config]
+
+void main()
+{
+  a[b](c);
+}




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_cull_distance: Fix sometimes-uninitialized warnings.

2017-04-03 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 01.04.2017 01:27, Vinson Lee wrote:

exceed-limits.c:75:6: warning: variable 'clip_distances' is used uninitialized 
whenever 'if' condition is true [-Wsometimes-uninitialized]
if (strcmp(argv[1], "cull") == 0) {
^~~~
exceed-limits.c:90:14: note: uninitialized use occurs here
 use_clip, clip_distances,
   ^~
exceed-limits.c:75:2: note: remove the 'if' if its condition is always false
if (strcmp(argv[1], "cull") == 0) {
^~~
exceed-limits.c:61:22: note: initialize the variable 'clip_distances' to 
silence this warning
GLint clip_distances;
^
 = 0
exceed-limits.c:78:13: warning: variable 'cull_distances' is used uninitialized 
whenever 'if' condition is true [-Wsometimes-uninitialized]
} else if (strcmp(argv[1], "clip") == 0) {
   ^~~~
exceed-limits.c:91:14: note: uninitialized use occurs here
 use_cull, cull_distances);
   ^~
exceed-limits.c:78:9: note: remove the 'if' if its condition is always false
} else if (strcmp(argv[1], "clip") == 0) {
   ^~~
exceed-limits.c:62:22: note: initialize the variable 'cull_distances' to 
silence this warning
GLint cull_distances;
^
 = 0

Fixes: 35469c1b05bb ("Add more ARB_cull_distance tests")
Signed-off-by: Vinson Lee 
---
 tests/spec/arb_cull_distance/exceed-limits.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/spec/arb_cull_distance/exceed-limits.c 
b/tests/spec/arb_cull_distance/exceed-limits.c
index 10fecb969e5c..15304b752db9 100644
--- a/tests/spec/arb_cull_distance/exceed-limits.c
+++ b/tests/spec/arb_cull_distance/exceed-limits.c
@@ -74,9 +74,11 @@ piglit_init(int argc, char **argv)

if (strcmp(argv[1], "cull") == 0) {
use_clip = "// ";
+   clip_distances = 0;
cull_distances = max_cull_distances + 2;
} else if (strcmp(argv[1], "clip") == 0) {
clip_distances = max_clip_distances + 2;
+   cull_distances = 0;
use_cull = "// ";
} else if (strcmp(argv[1], "total") == 0) {
clip_distances = max_combined_clip_and_cull_distances / 2 + 1;




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] glsl: update assumption in array out of bounds test

2017-04-03 Thread Nicolai Hähnle

On 03.04.2017 02:01, Timothy Arceri wrote:



On 31/03/17 17:30, Nicolai Hähnle wrote:

On 31.03.2017 01:53, Timothy Arceri wrote:

Section 5.7 of the GLSL 4.5 spec says:

   "Behavior is undefined if a shader subscripts an array with an
   index less than 0 or greater than or equal to the size the array
   was declared with."

So we cannot be sure which path the shader will take. Update the
test so that both branches end in the same result.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96684
---
 tests/shaders/glsl-array-bounds-01.shader_test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/glsl-array-bounds-01.shader_test
b/tests/shaders/glsl-array-bounds-01.shader_test
index 2e7c762..a06fef7 100644
--- a/tests/shaders/glsl-array-bounds-01.shader_test
+++ b/tests/shaders/glsl-array-bounds-01.shader_test
@@ -15,21 +15,21 @@ void main()
  */
 #version 120

 float array[] = float [] (1.0, 2.0, 3.0, 4.0);

 void main()
 {
int idx = 20;

if (array[idx] == 5.0)
-  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
else
   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
 }


I'm a bit concerned that an optimizer will do tail-merging followed by
eliminating the load. Maybe do something silly like

float tmp = array[idx];

gl_FragColor = vec4(0.0, 1.0 + abs(tmp), 0.0, 1.0);

instead? Then the compiler can't optimize the load away, because the
shader has to work with un-clamped floating point framebuffers.

On second thought, what about NaNs?


Well we are testing undefined behavior, the correct thing might be to
just delete the test?


That's a good point. Though robust buffer access changes this, so that 
only the returned value is undefined. So instead of deleting the test, 
it should probably be modified / moved to become a test for robust 
buffer access.


Cheers,
Nicolai







Cheers,
Nicolai



 [test]
 clear color 0.0 0.0 0.0 0.0
 clear
 ortho
 draw rect 10 10 10 10
 probe rgb 15 15 0.0 1.0 0.0







--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/6] arb_shader_ballot: test ballotARB inside if/else control flow

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../execution/fs-ballot-if-else.shader_test| 83 ++
 1 file changed, 83 insertions(+)
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-ballot-if-else.shader_test

diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-ballot-if-else.shader_test 
b/tests/spec/arb_shader_ballot/execution/fs-ballot-if-else.shader_test
new file mode 100644
index 000..e78bc91
--- /dev/null
+++ b/tests/spec/arb_shader_ballot/execution/fs-ballot-if-else.shader_test
@@ -0,0 +1,83 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+GL_ARB_gpu_shader_int64
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+#extension GL_ARB_gpu_shader5 : require
+
+out vec4 outcolor;
+
+int findLSB64(uint64_t v)
+{
+   uvec2 split = unpackUint2x32(v);
+   int lsb = findLSB(split.x);
+   if (lsb >= 0)
+   return lsb;
+
+   lsb = findLSB(split.y);
+   if (lsb >= 0)
+   return 32 + lsb;
+
+   return -1;
+}
+
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+   bool ok = true;
+
+   uint64_t even_set = active_set & 0xul;
+   uint64_t odd_set = active_set & 0xul;
+   uint64_t even_inner = 0ul;
+   uint64_t odd_inner = 0ul;
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   if (gl_SubGroupInvocationARB % 2u == 0u) {
+   even_inner = ballotARB(true);
+   if (ok && even_inner != even_set) {
+   outcolor = vec4(1.0, 0.1, 0.0, gl_SubGroupInvocationARB 
/ 255.0);
+   ok = false;
+   }
+   } else {
+   odd_inner = ballotARB(true);
+   if (ok && odd_inner != odd_set) {
+   outcolor = vec4(1.0, 0.2, 0.0, gl_SubGroupInvocationARB 
/ 255.0);
+   ok = false;
+   }
+   }
+
+   int first_even = findLSB64(even_set);
+   int first_odd = findLSB64(odd_set);
+
+   if (first_even >= 0) {
+   even_inner = 
packUint2x32(readInvocationARB(unpackUint2x32(even_inner), first_even));
+   }
+   if (first_odd >= 0) {
+   odd_inner = 
packUint2x32(readInvocationARB(unpackUint2x32(odd_inner), first_odd));
+   }
+
+   if (ok && even_inner != even_set) {
+   outcolor = vec4(1.0, 0.3, first_even / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+   ok = false;
+   }
+   if (ok && odd_inner != odd_set) {
+   outcolor = vec4(1.0, 0.4, first_odd / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+   ok = false;
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 4/6] arb_shader_ballot: test builtin variables

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../execution/fs-builtin-variables.shader_test | 58 ++
 1 file changed, 58 insertions(+)
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test

diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test 
b/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test
new file mode 100644
index 000..cd75bca
--- /dev/null
+++ b/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test
@@ -0,0 +1,58 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+
+out vec4 outcolor;
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+
+   uint id = gl_SubGroupInvocationARB;
+
+   if (id >= gl_SubGroupSizeARB) {
+   outcolor = vec4(1.0, 0 / 255.0, id / 255.0, gl_SubGroupSizeARB 
/ 255.0);
+   return;
+   }
+
+   if (gl_SubGroupEqMaskARB != (1ul << id)) {
+   outcolor = vec4(1.0, 1 / 255.0, id / 255.0, 0.0);
+   return;
+   }
+
+   if (gl_SubGroupGeMaskARB != (~0ul << id)) {
+   outcolor = vec4(1.0, 2 / 255.0, id / 255.0, 0.0);
+   return;
+   }
+
+   if (gl_SubGroupGtMaskARB != (~1ul << id)) {
+   outcolor = vec4(1.0, 2 / 255.0, id / 255.0, 0.0);
+   return;
+   }
+
+   if (gl_SubGroupLeMaskARB != ~(~1ul << id)) {
+   outcolor = vec4(1.0, 3 / 255.0, id / 255.0, 0.0);
+   return;
+   }
+
+   if (gl_SubGroupLtMaskARB != ~(~0ul << id)) {
+   outcolor = vec4(1.0, 4 / 255.0, id / 255.0, 0.0);
+   return;
+   }
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 6/6] arb_shader_ballot: test peeling away the first invocation

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../fs-readFirstInvocation-uint-if.shader_test | 32 ++
 .../fs-readFirstInvocation-uint-loop.shader_test   | 49 ++
 2 files changed, 81 insertions(+)
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-if.shader_test
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test

diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-if.shader_test
 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-if.shader_test
new file mode 100644
index 000..0c63436
--- /dev/null
+++ 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-if.shader_test
@@ -0,0 +1,32 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+
+out vec4 outcolor;
+
+void main() {
+   uint first_invocation = 
readFirstInvocationARB(gl_SubGroupInvocationARB);
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   if (first_invocation != gl_SubGroupInvocationARB) {
+   uint new_first_invocation = 
readFirstInvocationARB(gl_SubGroupInvocationARB);
+
+   if (first_invocation == new_first_invocation)
+   outcolor = vec4(1.0, 0.0, first_invocation / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test
 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test
new file mode 100644
index 000..d1f98f4
--- /dev/null
+++ 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test
@@ -0,0 +1,49 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+
+out vec4 outcolor;
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+   int i;
+
+   int num_active = 0;
+   for (i = 0; i < 64; ++i) {
+   if ((active_set & (1ul << i)) != 0ul)
+   num_active++;
+   }
+
+   /* This loop should terminate even without the loop condition. We simply
+* add the condition here to ensure termination when there are shader
+* compiler bugs.
+*/
+   for (i = 0; i < num_active; ++i) {
+   uint first_invocation = 
readFirstInvocationARB(gl_SubGroupInvocationARB);
+
+   if (first_invocation == gl_SubGroupInvocationARB)
+   break;
+   }
+
+   if (i >= num_active) {
+   outcolor = vec4(1.0, 0.0, i / 255.0, gl_SubGroupInvocationARB / 
255.0);
+   } else {
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 2/6] arb_shader_ballot: add readInvocationARB tests

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../fs-readInvocation-uint-uniform.shader_test | 39 ++
 .../execution/fs-readInvocation-uint.shader_test   | 37 
 2 files changed, 76 insertions(+)
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint-uniform.shader_test
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint.shader_test

diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint-uniform.shader_test
 
b/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint-uniform.shader_test
new file mode 100644
index 000..f63a76a
--- /dev/null
+++ 
b/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint-uniform.shader_test
@@ -0,0 +1,39 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform uint u_value = 5u;
+
+out vec4 outcolor;
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   for (uint i = 0u; i < gl_SubGroupSizeARB; ++i) {
+   if ((active_set & (1ul << i)) == 0ul)
+   continue;
+
+   uint read = readInvocationARB(u_value, i);
+   if (read != u_value) {
+   outcolor = vec4(1.0, read / 255.0, i / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+   break;
+   }
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint.shader_test 
b/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint.shader_test
new file mode 100644
index 000..64994b4
--- /dev/null
+++ b/tests/spec/arb_shader_ballot/execution/fs-readInvocation-uint.shader_test
@@ -0,0 +1,37 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+
+out vec4 outcolor;
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   for (uint i = 0u; i < gl_SubGroupSizeARB; ++i) {
+   if ((active_set & (1ul << i)) == 0ul)
+   continue;
+
+   uint read = readInvocationARB(gl_SubGroupInvocationARB, i);
+   if (read != i) {
+   outcolor = vec4(1.0, read / 255.0, i / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+   break;
+   }
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 0/6] ARB_shader_ballot tests

2017-03-31 Thread Nicolai Hähnle
Hi,

this series adds some basic tests for the builtin functions and
variables of the ARB_shader_ballot extension.

I have only tested this against my own work-in-progress implementation.
If somebody got to test it against the AMD or Nvidia blobs, that would
be much appreciated.

Please review!

Thanks,
Nicolai
--
 .../execution/fs-ballot-if-else.shader_test  | 83 ++
 .../execution/fs-ballot.shader_test  | 28 ++
 .../fs-builtin-variables.shader_test | 58 
 ...s-readFirstInvocation-uint-if.shader_test | 32 +++
 ...readFirstInvocation-uint-loop.shader_test | 49 +++
 ...dFirstInvocation-uint-uniform.shader_test | 39 
 .../fs-readFirstInvocation-uint.shader_test  | 52 +++
 ...s-readInvocation-uint-uniform.shader_test | 39 
 .../fs-readInvocation-uint.shader_test   | 37 
 9 files changed, 417 insertions(+)

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


[Piglit] [PATCH 3/6] arb_shader_ballot: add readFirstInvocationARB test

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 ...fs-readFirstInvocation-uint-uniform.shader_test | 39 
 .../fs-readFirstInvocation-uint.shader_test| 52 ++
 2 files changed, 91 insertions(+)
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-uniform.shader_test
 create mode 100644 
tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint.shader_test

diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-uniform.shader_test
 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-uniform.shader_test
new file mode 100644
index 000..6ce4948
--- /dev/null
+++ 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-uniform.shader_test
@@ -0,0 +1,39 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_gpu_shader_int64
+GL_ARB_gpu_shader5
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+#extension GL_ARB_gpu_shader5 : require
+
+uniform uint u_value = 5;
+
+out vec4 outcolor;
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   uint expected = u_value;
+   uint read = readFirstInvocationARB(u_value);
+
+   if (read == expected)
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+   else
+   outcolor = vec4(1.0, read / 255.0, expected / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint.shader_test
 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint.shader_test
new file mode 100644
index 000..3603f3c
--- /dev/null
+++ 
b/tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint.shader_test
@@ -0,0 +1,52 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_gpu_shader_int64
+GL_ARB_gpu_shader5
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+#extension GL_ARB_gpu_shader_int64 : require
+#extension GL_ARB_gpu_shader5 : require
+
+out vec4 outcolor;
+
+int findLSB64(uint64_t v)
+{
+   uvec2 split = unpackUint2x32(v);
+   int lsb = findLSB(split.x);
+   if (lsb >= 0)
+   return lsb;
+
+   lsb = findLSB(split.y);
+   if (lsb >= 0)
+   return 32 + lsb;
+
+   return -1;
+}
+
+void main() {
+   uint64_t active_set = ballotARB(true);
+   int first_invocation = findLSB64(active_set);
+
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   uint expected = uint(42 + first_invocation);
+   uint read = readFirstInvocationARB(gl_SubGroupInvocationARB + 42u);
+
+   if (read == expected)
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+   else
+   outcolor = vec4(1.0, read / 255.0, expected / 255.0, 
gl_SubGroupInvocationARB / 255.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


[Piglit] [PATCH 1/6] arb_shader_ballot: simple ballotARB execution test

2017-03-31 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../execution/fs-ballot.shader_test| 28 ++
 1 file changed, 28 insertions(+)
 create mode 100644 tests/spec/arb_shader_ballot/execution/fs-ballot.shader_test

diff --git a/tests/spec/arb_shader_ballot/execution/fs-ballot.shader_test 
b/tests/spec/arb_shader_ballot/execution/fs-ballot.shader_test
new file mode 100644
index 000..b16d723
--- /dev/null
+++ b/tests/spec/arb_shader_ballot/execution/fs-ballot.shader_test
@@ -0,0 +1,28 @@
+[require]
+GL >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_ballot
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_ballot : require
+
+out vec4 outcolor;
+
+void main() {
+   if (ballotARB(false) != 0ul)
+   outcolor = vec4(1.0, 0.0, 0.0, 0.0);
+   else if (ballotARB(true) == 0ul)
+   outcolor = vec4(1.0, 0.1, 0.0, 0.0);
+   else
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3

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


Re: [Piglit] [PATCH] arb_shader_clock: add basic execution tests

2017-03-30 Thread Nicolai Hähnle

On 30.03.2017 15:03, Ilia Mirkin wrote:

On Thu, Mar 30, 2017 at 8:19 AM, Nicolai Hähnle  wrote:

On 30.03.2017 14:07, Ilia Mirkin wrote:


Time could roll over... not sure what to do about that though. Maybe
check if the top 2 bits are set in the old value and are unset in the
new value, and hope that the counter precision > 2 bits? [It'd be
unfortunate for CIs to get occasional failures in these tests...]



Shouldn't roll-over be covered by the cast to int followed by comparison
with 0?


Let's say start_time == 0xfff, late_time = 0. Perhaps I'm
getting the math wrong here, but as far as I can see, that test will
fail.


+   int64_t diff = int64_t(late_time - start_time);
+
+   if (diff <= 0l)
+   atomicCounterIncrement(bad);

In your example, we get late_time - start_time == 0 - uint64_t(-1) == 1, 
so the atomic increment of bad doesn't happen.


Cheers,
Nicolai



  -ilia




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] glsl: update assumption in array out of bounds test

2017-03-30 Thread Nicolai Hähnle

On 31.03.2017 01:53, Timothy Arceri wrote:

Section 5.7 of the GLSL 4.5 spec says:

   "Behavior is undefined if a shader subscripts an array with an
   index less than 0 or greater than or equal to the size the array
   was declared with."

So we cannot be sure which path the shader will take. Update the
test so that both branches end in the same result.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96684
---
 tests/shaders/glsl-array-bounds-01.shader_test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/glsl-array-bounds-01.shader_test 
b/tests/shaders/glsl-array-bounds-01.shader_test
index 2e7c762..a06fef7 100644
--- a/tests/shaders/glsl-array-bounds-01.shader_test
+++ b/tests/shaders/glsl-array-bounds-01.shader_test
@@ -15,21 +15,21 @@ void main()
  */
 #version 120

 float array[] = float [] (1.0, 2.0, 3.0, 4.0);

 void main()
 {
int idx = 20;

if (array[idx] == 5.0)
-  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
else
   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
 }


I'm a bit concerned that an optimizer will do tail-merging followed by 
eliminating the load. Maybe do something silly like


float tmp = array[idx];

gl_FragColor = vec4(0.0, 1.0 + abs(tmp), 0.0, 1.0);

instead? Then the compiler can't optimize the load away, because the 
shader has to work with un-clamped floating point framebuffers.


On second thought, what about NaNs?

Cheers,
Nicolai



 [test]
 clear color 0.0 0.0 0.0 0.0
 clear
 ortho
 draw rect 10 10 10 10
 probe rgb 15 15 0.0 1.0 0.0




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_gpu_shader_int64: add bit-shift tests

2017-03-30 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Exposes a bug in st/glsl_to_tgsi.
---
 .../fs-shift-scalar-by-scalar.shader_test  | 78 ++
 .../fs-shift-vector-by-scalar.shader_test  | 77 +
 .../fs-shift-vector-by-vector.shader_test  | 77 +
 3 files changed, 232 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-shift-scalar-by-scalar.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-shift-vector-by-scalar.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-shift-vector-by-vector.shader_test

diff --git 
a/tests/spec/arb_gpu_shader_int64/execution/fs-shift-scalar-by-scalar.shader_test
 
b/tests/spec/arb_gpu_shader_int64/execution/fs-shift-scalar-by-scalar.shader_test
new file mode 100644
index 000..e66798d
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_int64/execution/fs-shift-scalar-by-scalar.shader_test
@@ -0,0 +1,78 @@
+[require]
+GL >= 4.0
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 400
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform int64_t ival;
+uniform uint64_t uval;
+uniform int shl, shr;
+
+uniform int64_t iexpected_shl;
+uniform int64_t iexpected_shr;
+uniform uint64_t uexpected_shl;
+uniform uint64_t uexpected_shr;
+
+out vec4 color;
+
+void main()
+{
+   int64_t iresult_shl = ival << shl;
+   uint64_t uresult_shl = uval << shl;
+   int64_t iresult_shr = ival >> shr;
+   uint64_t uresult_shr = uval >> shr;
+
+   if (iresult_shl != iexpected_shl)
+   color = vec4(1.0, 0.0, float(iresult_shl) / 255.0, 0.0);
+   else if (iresult_shr != iexpected_shr)
+   color = vec4(1.0, 0.1, float(iresult_shr) / 255.0, 0.0);
+   else if (uresult_shl != uexpected_shl)
+   color = vec4(1.0, 0.2, float(uresult_shl) / 255.0, 0.0);
+   else if (uresult_shr != uexpected_shr)
+   color = vec4(1.0, 0.3, float(uresult_shr) / 255.0, 0.0);
+   else
+   color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int64_t ival 3
+uniform uint64_t uval 3
+uniform int shl 1
+uniform int shr 1
+uniform int64_t iexpected_shl 6
+uniform int64_t iexpected_shr 1
+uniform uint64_t uexpected_shl 6
+uniform uint64_t uexpected_shr 1
+draw rect ortho 0 0 4 4
+
+uniform int64_t ival 0x7848302090a0b0c6
+uniform uint64_t uval 0xc01020308090a0b5
+uniform int shl 4
+uniform int shr 4
+uniform int64_t iexpected_shl -0x7b7cfdf6f5f4f3a0 # bit pattern: 
0x848302090a0b0c60
+uniform int64_t iexpected_shr 0x07848302090a0b0c
+uniform uint64_t uexpected_shl 0x01020308090a0b50
+uniform uint64_t uexpected_shr 0x0c01020308090a0b
+draw rect ortho 4 0 4 4
+
+uniform int64_t ival -0x7dfcfefbdf6536ff # bit pattern: 0x82030104209ac901
+uniform uint64_t uval 0x140085010203
+uniform int shl 8
+uniform int shr 8
+uniform int64_t iexpected_shl 0x030104209ac90100
+uniform int64_t iexpected_shr -0x7dfcfefbdf6537 # bit pattern: 
0xff82030104209ac9
+uniform uint64_t uexpected_shl 0x008501020300
+uniform uint64_t uexpected_shr 0x001400850102
+draw rect ortho 8 0 4 4
+
+probe rect rgba (0, 0, 4, 4) (0.0, 1.0, 0.0, 1.0)
+probe rect rgba (4, 0, 4, 4) (0.0, 1.0, 0.0, 1.0)
+probe rect rgba (8, 0, 4, 4) (0.0, 1.0, 0.0, 1.0)
diff --git 
a/tests/spec/arb_gpu_shader_int64/execution/fs-shift-vector-by-scalar.shader_test
 
b/tests/spec/arb_gpu_shader_int64/execution/fs-shift-vector-by-scalar.shader_test
new file mode 100644
index 000..cd4f998
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_int64/execution/fs-shift-vector-by-scalar.shader_test
@@ -0,0 +1,77 @@
+[require]
+GL >= 4.0
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 400
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform i64vec4 ival;
+uniform u64vec4 uval;
+uniform int shl, shr;
+
+uniform i64vec4 iexpected_shl;
+uniform i64vec4 iexpected_shr;
+uniform u64vec4 uexpected_shl;
+uniform u64vec4 uexpected_shr;
+
+out vec4 color;
+
+void main()
+{
+   i64vec4 iresult_shl = ival << shl;
+   u64vec4 uresult_shl = uval << shl;
+   i64vec4 iresult_shr = ival >> shr;
+   u64vec4 uresult_shr = uval >> shr;
+
+   color = vec4(0.0, 1.0, 0.0, 1.0);
+
+   for (int i = 0; i < 4; ++i) {
+   if (iresult_shl[i] != iexpected_shl[i]) {
+   color = vec4(1.0, 0.0, i / 255.0, float(iresult_shl[i]) 
/ 255.0);
+   break;
+   }
+   if (iresult_shr[i] != iexpected_shr[i]) {
+   color = vec4(1.0, 0.1, i / 255.0, float(iresult_shr[i]) 
/ 255.0);
+   break;
+   }
+   if (uresult_shl[i] != uexpected_shl[i]) {
+   color = vec4(1.0, 0.2, i / 255.0, float(uresult_shl[i]) 
/ 255.0);
+  

Re: [Piglit] [PATCH] arb_shader_clock: add basic execution tests

2017-03-30 Thread Nicolai Hähnle

On 30.03.2017 14:07, Ilia Mirkin wrote:

Time could roll over... not sure what to do about that though. Maybe
check if the top 2 bits are set in the old value and are unset in the
new value, and hope that the counter precision > 2 bits? [It'd be
unfortunate for CIs to get occasional failures in these tests...]


Shouldn't roll-over be covered by the cast to int followed by comparison 
with 0?


Cheers,
Nicolai



On Thu, Mar 30, 2017 at 3:23 AM, Nicolai Hähnle  wrote:

From: Nicolai Hähnle 

---
 .../arb_shader_clock/execution/clock.shader_test   | 54 +++
 .../execution/clock2x32.shader_test| 63 ++
 2 files changed, 117 insertions(+)
 create mode 100644 tests/spec/arb_shader_clock/execution/clock.shader_test
 create mode 100644 tests/spec/arb_shader_clock/execution/clock2x32.shader_test

diff --git a/tests/spec/arb_shader_clock/execution/clock.shader_test 
b/tests/spec/arb_shader_clock/execution/clock.shader_test
new file mode 100644
index 000..07530e6
--- /dev/null
+++ b/tests/spec/arb_shader_clock/execution/clock.shader_test
@@ -0,0 +1,54 @@
+[require]
+GL >= 4.3
+GLSL >= 4.30
+GL_ARB_gpu_shader_int64
+GL_ARB_shader_clock
+
+[compute shader]
+#version 430
+#extension GL_ARB_gpu_shader_int64: require
+#extension GL_ARB_shader_clock: require
+
+layout(local_size_x = 1) in;
+
+layout(binding = 0) uniform atomic_uint good;
+layout(binding = 1) uniform atomic_uint bad;
+
+layout(std430, binding = 0) buffer ssbo_data {
+   uint64_t ssbo_time[];
+};
+
+uniform uint phase;
+
+void main() {
+   uint64_t start_time = clockARB();
+
+   if (phase == 0u) {
+   ssbo_time[gl_WorkGroupID.x] = start_time;
+   } else {
+   int64_t diff = int64_t(start_time - 
ssbo_time[gl_WorkGroupID.x]);
+   if (diff > 0l)
+   atomicCounterIncrement(good);
+   }
+
+   uint64_t late_time = clockARB();
+   int64_t diff = int64_t(late_time - start_time);
+
+   if (diff <= 0l)
+   atomicCounterIncrement(bad);
+}
+
+[test]
+atomic counters 2
+ssbo 0 64
+
+uniform uint phase 0
+compute 8 1 1
+
+memory barrier GL_SHADER_STORAGE_BARRIER_BIT
+
+uniform uint phase 1
+compute 8 1 1
+
+probe atomic counter 0 == 8
+probe atomic counter 1 == 0
diff --git a/tests/spec/arb_shader_clock/execution/clock2x32.shader_test 
b/tests/spec/arb_shader_clock/execution/clock2x32.shader_test
new file mode 100644
index 000..1a2bfef
--- /dev/null
+++ b/tests/spec/arb_shader_clock/execution/clock2x32.shader_test
@@ -0,0 +1,63 @@
+[require]
+GL >= 4.3
+GLSL >= 4.30
+GL_ARB_shader_clock
+
+[compute shader]
+#version 430
+#extension GL_ARB_shader_clock: require
+
+layout(local_size_x = 1) in;
+
+layout(binding = 0) uniform atomic_uint good;
+layout(binding = 1) uniform atomic_uint bad;
+
+layout(std430, binding = 0) buffer ssbo_data {
+   uvec2 ssbo_time[];
+};
+
+uniform uint phase;
+
+bool is_time_ordered(uvec2 a, uvec2 b) {
+   int diff = int(b.y - a.y);
+   if (diff > 0)
+   return true;
+   if (diff < 0)
+   return false;
+
+   diff = int(b.x - a.x);
+   if (diff > 0)
+   return true;
+   return false;
+}
+
+void main() {
+   uvec2 start_time = clock2x32ARB();
+
+   if (phase == 0u) {
+   ssbo_time[gl_WorkGroupID.x] = start_time;
+   } else {
+   if (is_time_ordered(ssbo_time[gl_WorkGroupID.x], start_time))
+   atomicCounterIncrement(good);
+   }
+
+   uvec2 late_time = clock2x32ARB();
+
+   if (!is_time_ordered(start_time, late_time))
+   atomicCounterIncrement(bad);
+}
+
+[test]
+atomic counters 2
+ssbo 0 64
+
+uniform uint phase 0
+compute 8 1 1
+
+memory barrier GL_SHADER_STORAGE_BARRIER_BIT
+
+uniform uint phase 1
+compute 8 1 1
+
+probe atomic counter 0 == 8
+probe atomic counter 1 == 0
--
2.9.3

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



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_shader_clock: add basic execution tests

2017-03-30 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 .../arb_shader_clock/execution/clock.shader_test   | 54 +++
 .../execution/clock2x32.shader_test| 63 ++
 2 files changed, 117 insertions(+)
 create mode 100644 tests/spec/arb_shader_clock/execution/clock.shader_test
 create mode 100644 tests/spec/arb_shader_clock/execution/clock2x32.shader_test

diff --git a/tests/spec/arb_shader_clock/execution/clock.shader_test 
b/tests/spec/arb_shader_clock/execution/clock.shader_test
new file mode 100644
index 000..07530e6
--- /dev/null
+++ b/tests/spec/arb_shader_clock/execution/clock.shader_test
@@ -0,0 +1,54 @@
+[require]
+GL >= 4.3
+GLSL >= 4.30
+GL_ARB_gpu_shader_int64
+GL_ARB_shader_clock
+
+[compute shader]
+#version 430
+#extension GL_ARB_gpu_shader_int64: require
+#extension GL_ARB_shader_clock: require
+
+layout(local_size_x = 1) in;
+
+layout(binding = 0) uniform atomic_uint good;
+layout(binding = 1) uniform atomic_uint bad;
+
+layout(std430, binding = 0) buffer ssbo_data {
+   uint64_t ssbo_time[];
+};
+
+uniform uint phase;
+
+void main() {
+   uint64_t start_time = clockARB();
+
+   if (phase == 0u) {
+   ssbo_time[gl_WorkGroupID.x] = start_time;
+   } else {
+   int64_t diff = int64_t(start_time - 
ssbo_time[gl_WorkGroupID.x]);
+   if (diff > 0l)
+   atomicCounterIncrement(good);
+   }
+
+   uint64_t late_time = clockARB();
+   int64_t diff = int64_t(late_time - start_time);
+
+   if (diff <= 0l)
+   atomicCounterIncrement(bad);
+}
+
+[test]
+atomic counters 2
+ssbo 0 64
+
+uniform uint phase 0
+compute 8 1 1
+
+memory barrier GL_SHADER_STORAGE_BARRIER_BIT
+
+uniform uint phase 1
+compute 8 1 1
+
+probe atomic counter 0 == 8
+probe atomic counter 1 == 0
diff --git a/tests/spec/arb_shader_clock/execution/clock2x32.shader_test 
b/tests/spec/arb_shader_clock/execution/clock2x32.shader_test
new file mode 100644
index 000..1a2bfef
--- /dev/null
+++ b/tests/spec/arb_shader_clock/execution/clock2x32.shader_test
@@ -0,0 +1,63 @@
+[require]
+GL >= 4.3
+GLSL >= 4.30
+GL_ARB_shader_clock
+
+[compute shader]
+#version 430
+#extension GL_ARB_shader_clock: require
+
+layout(local_size_x = 1) in;
+
+layout(binding = 0) uniform atomic_uint good;
+layout(binding = 1) uniform atomic_uint bad;
+
+layout(std430, binding = 0) buffer ssbo_data {
+   uvec2 ssbo_time[];
+};
+
+uniform uint phase;
+
+bool is_time_ordered(uvec2 a, uvec2 b) {
+   int diff = int(b.y - a.y);
+   if (diff > 0)
+   return true;
+   if (diff < 0)
+   return false;
+
+   diff = int(b.x - a.x);
+   if (diff > 0)
+   return true;
+   return false;
+}
+
+void main() {
+   uvec2 start_time = clock2x32ARB();
+
+   if (phase == 0u) {
+   ssbo_time[gl_WorkGroupID.x] = start_time;
+   } else {
+   if (is_time_ordered(ssbo_time[gl_WorkGroupID.x], start_time))
+   atomicCounterIncrement(good);
+   }
+
+   uvec2 late_time = clock2x32ARB();
+
+   if (!is_time_ordered(start_time, late_time))
+   atomicCounterIncrement(bad);
+}
+
+[test]
+atomic counters 2
+ssbo 0 64
+
+uniform uint phase 0
+compute 8 1 1
+
+memory barrier GL_SHADER_STORAGE_BARRIER_BIT
+
+uniform uint phase 1
+compute 8 1 1
+
+probe atomic counter 0 == 8
+probe atomic counter 1 == 0
-- 
2.9.3

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


Re: [Piglit] [RFC PATCH 0/5] Add tests for ARB_bindless_texture

2017-03-29 Thread Nicolai Hähnle

On 28.03.2017 00:05, Samuel Pitoiset wrote:

Hi,

This series introduces some tests for ARB_bindless_texture. The series
has been splitted into 4 different parts to try to help reviewers because
it's a bunch of new code.

Although this seems huge at first look, I don't cover 100% of the spec
but I think it's time to have some feedbacks. What I have in mind is to
add few more tests like one for seamless cubemap and at least one which
uses both bindless/bound samplers/images.

I tested the series with the NVIDIA blob (378-13-4 on ArchLinux), here's
the list of fails:

$ ./piglit-run.py -v -1 tests/all.py -t arb_bindless_texture nvidia-bindless

fail: 
spec/arb_bindless_texture/linker/global_bindless_sampler_and_implicit_bound_sampler
fail: 
spec/arb_bindless_texture/linker/global_bindless_image_and_implicit_bound_image


I don't think those two tests are valid. At least the quoted spec 
language doesn't support it.


It's not clear to me whether the global default of bindless should apply 
to the uniform declared in the other compilation unit, but even if it 
doesn't, the spec language only calls for an error if there are 
conflicting *explicit* specifications.




fail: spec/arb_bindless_texture/linker/global_bindless_image_and_bound_image
fail: spec/arb_bindless_texture/linker/global_bindless_sampler_and_bound_sampler

Those fail with the NVIDIA blob, I think they are valid though. Any ideas?


I agree they're valid.



fail: spec/arb_bindless_texture/compiler/images/return.frag

No ideas why the NVIDIA blob doesn't allow this, it should be valid I think.


I also agree this should be valid. What's the error given by the blob?



fail: spec/arb_bindless_texture/compiler/images/explicit-conversions.vert

The NVIDIA blob looks buggy here.


Agreed.



fail: spec/arb_bindless_texture/compiler/images/output.frag
fail: spec/arb_bindless_texture/compiler/samplers/output.frag

Although it's dumb to declare shader outputs inside fragment shaders, the 
NVIDIA blob allows this.


... and the spec forbids it, so I'd say the test is good.



fail: spec/arb_bindless_texture/compiler/images/input.frag
fail: spec/arb_bindless_texture/compiler/samplers/input.frag

The NVIDIA blob doesn't seem to require the 'flat' qualifier.


Test looks good.



fail: spec/arb_bindless_texture/errors
fail: spec/arb_bindless_texture/handles

The NVIDIA blob returns GL_INVALID_OPERATION instead of GL_INVALID_VALUE when
the texture object doesn't exist.


Wouldn't be the first time for this kind of bug.

I didn't really look into the patches in any detail, just the conflicts 
you mentioned above, but thanks for tackling this!


Cheers,
Nicolai



Feedbacks are welcome,
Please review, Thanks!

Samuel Pitoiset (5):
  shader_runner: add support for ARB_bindless_texture
  add API-related tests for ARB_bindless_texture
  arb_bindless_texture: add compiler-related tests
  arb_bindless_texture: add linker-related tests
  arb_bindless_texture: add execution-related tests

 tests/all.py   |  14 +
 tests/shaders/shader_runner.c  |  92 
 tests/spec/CMakeLists.txt  |   1 +
 tests/spec/arb_bindless_texture/CMakeLists.gl.txt  |  21 +
 tests/spec/arb_bindless_texture/CMakeLists.txt |   1 +
 tests/spec/arb_bindless_texture/border-color.c | 209 
 .../compiler/images/arith-expr.vert|  32 ++
 .../compiler/images/bindless-global.vert   |  25 +
 .../compiler/images/bindless-local.vert|  25 +
 .../compiler/images/bindless-nonuniform.vert   |  23 +
 .../compiler/images/bound-global.vert  |  25 +
 .../compiler/images/bound-local.vert   |  25 +
 .../compiler/images/bound-nonuniform.vert  |  23 +
 .../compiler/images/explicit-conversions.vert  |  86 +++
 .../compiler/images/flat-input.frag|  28 +
 .../compiler/images/implicit_conversions.vert  |  22 +
 .../compiler/images/indexing.vert  |  30 ++
 .../compiler/images/inout-struct.frag  |  29 ++
 .../compiler/images/inout.frag |  24 +
 .../compiler/images/input.frag |  28 +
 .../compiler/images/input.vert |  25 +
 .../compiler/images/interface-block.vert   |  27 +
 .../compiler/images/out-struct.frag|  29 ++
 .../arb_bindless_texture/compiler/images/out.frag  |  24 +
 .../compiler/images/output.frag|  22 +
 .../compiler/images/output.vert|  24 +
 .../compiler/images/return-struct.frag |  32 ++
 .../compiler/images/return.frag|  26 +
 .../compiler/images/temporary.vert |  21 +
 .../compiler/samplers/arith-expr.vert  |  31 ++
 .../compiler/samplers/bindless-global.vert |  24 +
 .../compiler/samplers/bindless-local.vert  |  24 +
 .../compiler/samplers/bindless-nonuniform.vert |  22 +
 .../compiler/sa

Re: [Piglit] [RFC PATCH 3/5] arb_bindless_texture: add compiler-related tests

2017-03-29 Thread Nicolai Hähnle

On 29.03.2017 01:09, Samuel Pitoiset wrote:

diff --git
a/tests/spec/arb_bindless_texture/compiler/images/indexing.vert
b/tests/spec/arb_bindless_texture/compiler/images/indexing.vert
new file mode 100644
index 0..dd865b22f
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/compiler/images/indexing.vert
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_bindless_texture
GL_ARB_shader_image_load_store
+// [end config]
+
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+// The ARB_bindless_texture spec says:
+//
+//  "Replace Section 4.1.X, (Images)"
+//
+//  "Images may be aggregated into arrays within a shader (using square
+//   brackets []) and can be indexed with general integer expressions."
+
+uniform writeonly image2D imgs[64];
+uniform uint a, b;
+
+void main()
+{
+writeonly image2D img;
+uint idx = 42u;
+
+img = imgs[42];
+img = imgs[idx];
+img = imgs[idx + idx];



This is an out of bounds access. Should this fail compilation?


Mmmh, good question. I would say yes. The test works with the NVIDIA
blob, but I will update.


This kind of thing shouldn't generate an error -- maybe a warning. Makes 
sense to update it anyway.


Cheers,
Nicolai
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] get-active-attrib-array: allocate a sufficiently large buffer

2017-02-22 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Found by ASAN.
---
 tests/spec/glsl-1.50/execution/get-active-attrib-array.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/glsl-1.50/execution/get-active-attrib-array.c 
b/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
index e2d4e64..e11ed6c 100644
--- a/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
+++ b/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
@@ -71,21 +71,21 @@ piglit_display(void)
  * Find the given attribute size then, check if the passed expected size
  * is equal to the actual size.
  */
 bool
 getAttribLocTest(GLint program, int active_attribs, int max_name_length,
char *attrib_name, int expected_size)
 {
bool pass = true;
int size = -1;
GLenum type = GL_NONE;
-   char *name = malloc(max_name_length-1);
+   char *name = malloc(max_name_length);
 
int i;
for(i = 0; i < active_attribs; i++) {
glGetActiveAttrib(program, i, max_name_length,
  NULL, &size, &type, name);
 
if(strcmp(attrib_name, name) == 0) {
break;
}
}
-- 
2.9.3

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


Re: [Piglit] [PATCH] draw-elements: test glMultiDrawElements(GL_UNSIGNED_BYTE)

2017-02-19 Thread Nicolai Hähnle

Thanks for doing this.

Reviewed-by: Nicolai Hähnle 

On 17.02.2017 13:08, Marek Olšák wrote:

From: Marek Olšák 

this was broken in radeonsi
---
 tests/general/draw-elements.c | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/tests/general/draw-elements.c b/tests/general/draw-elements.c
index 29436cf..d20e85a 100644
--- a/tests/general/draw-elements.c
+++ b/tests/general/draw-elements.c
@@ -55,22 +55,24 @@ void piglit_init(int argc, char **argv)
}

piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

piglit_require_gl_version(15);

glShadeModel(GL_FLAT);
glClearColor(0.2, 0.2, 0.2, 1.0);
 }

-static void test_ubyte_indices(float x1, float y1, float x2, float y2, int 
index)
+static void test_ubyte_indices(float x1, float y1, float x2, float y2, int 
test)
 {
+   bool use_multi = test / 4;
+   int index = test % 4;
float v[] = {
x1, y1,
x1, y2,
x2, y1,

x1, y1,
x1, y2,
x2, y1,

x1, y1,
@@ -93,25 +95,46 @@ static void test_ubyte_indices(float x1, float y1, float 
x2, float y2, int index
11, 11, 11, 11
};
GLuint buf;

glVertexPointer(2, GL_FLOAT, 0, v);

if (!user) {
glGenBuffers(1, &buf);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indx), indx, 
GL_STATIC_DRAW);
-   glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, 
(void*)(intptr_t)(index*9));
+   if (use_multi) {
+   GLsizei count[] = {3, 3};
+   /* We need 2 draws in order to get non-zero in
+* pipe_draw_info::start, so make the second draw
+* a zero-area triangle. */
+   const void *offset[] = {(void*)(intptr_t)(index*9),
+   (void*)(intptr_t)1};
+   glMultiDrawElements(GL_TRIANGLES, count,
+   GL_UNSIGNED_BYTE, offset, 2);
+   } else {
+   glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE,
+  (void*)(intptr_t)(index*9));
+   }
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &buf);
} else {
-   glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, indx + 
index*9);
+   if (use_multi) {
+   GLsizei count[] = {3, 3};
+   /* The second draw is a zero-area triangle. */
+   const void *indices[] = {indx + index*9, indx + 1};
+   glMultiDrawElements(GL_TRIANGLES, count,
+   GL_UNSIGNED_BYTE, indices, 2);
+   } else {
+   glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE,
+  indx + index*9);
+   }
}
 }

 static void test_ushort_indices(float x1, float y1, float x2, float y2, int 
index)
 {
float v[] = {
x1, y1,
x1, y2,
x2, y1,

@@ -208,20 +231,25 @@ struct test {
int flag;
const char *name;
 };

 struct test tests[] = {
{test_ubyte_indices, 0, {1, 1, 1}, BOTH, "Ubyte indices - offset: 0"},
{test_ubyte_indices, 1, {1, 1, 1}, BOTH, "Ubyte indices - offset: 1"},
{test_ubyte_indices, 2, {1, 1, 1}, BOTH, "Ubyte indices - offset: 2"},
{test_ubyte_indices, 3, {1, 1, 1}, BOTH, "Ubyte indices - offset: 3"},

+   {test_ubyte_indices, 4, {1, 1, 1}, BOTH, "Ubyte indices - offset: 0 
(glMultiDraw)"},
+   {test_ubyte_indices, 5, {1, 1, 1}, BOTH, "Ubyte indices - offset: 1 
(glMultiDraw)"},
+   {test_ubyte_indices, 6, {1, 1, 1}, BOTH, "Ubyte indices - offset: 2 
(glMultiDraw)"},
+   {test_ubyte_indices, 7, {1, 1, 1}, BOTH, "Ubyte indices - offset: 3 
(glMultiDraw)"},
+
{test_ushort_indices, 0, {1, 1, 1}, BOTH, "Ushort indices - offset: 0"},
{test_ushort_indices, 1, {1, 1, 1}, BOTH, "Ushort indices - offset: 2"},

{test_large_index_count, 1, {1, 1, 1}, USER, "Large index count"},
{test_large_indexbuf_offset, 0, {1, 1, 1}, VBO, "Large index offset"},

{0}
 };

 enum piglit_result



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


Re: [Piglit] [PATCH] glsl-shaders: test correct shader source is use on cache fallback

2017-02-16 Thread Nicolai Hähnle

On 16.02.2017 01:21, Timothy Arceri wrote:

On 16/02/17 07:27, Eric Anholt wrote:

Timothy Arceri  writes:


The scenario is:

glShaderSource
glCompileShader <-- deferred due to cache hit of shader

glShaderSource <-- with new source code

glAttachShader
glLinkProgram <-- no cache hit for program

At this point we need make sure we compiled the original source
when Mesa falls back.


This is a really good test for the cache.  Thanks for writing it.  Just
a few cleanups to suggest:


---
 tests/all.py  |   1 +
 tests/shaders/CMakeLists.gl.txt   |   1 +
 tests/shaders/glsl-cache-fallback-shader-source.c | 187
++
 3 files changed, 189 insertions(+)
 create mode 100644 tests/shaders/glsl-cache-fallback-shader-source.c

diff --git a/tests/all.py b/tests/all.py
index 03cf0c8..4bafcc7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -536,6 +536,7 @@ with
profile.test_list.group_manager(PiglitGLTest, 'shaders') as g:
 g(['glsl-novertexdata'])
 g(['glsl-preprocessor-comments'])
 g(['glsl-reload-source'])
+g(['glsl-cache-fallback-shader-source'])
 g(['glsl-uniform-out-of-bounds'])
 g(['glsl-uniform-out-of-bounds-2'])
 g(['glsl-uniform-update'])
diff --git a/tests/shaders/CMakeLists.gl.txt
b/tests/shaders/CMakeLists.gl.txt
index 3c50ac6..7f786ee 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -63,6 +63,7 @@ piglit_add_executable (glsl-invalid-asm-02
glsl-invalid-asm-02.c)
 piglit_add_executable (glsl-novertexdata glsl-novertexdata.c)
 piglit_add_executable (glsl-orangebook-ch06-bump
glsl-orangebook-ch06-bump.c)
 piglit_add_executable (glsl-reload-source glsl-reload-source.c)
+piglit_add_executable (glsl-cache-fallback-shader-source
glsl-cache-fallback-shader-source.c)
 piglit_add_executable (glsl-unused-varying glsl-unused-varying.c)
 piglit_add_executable (glsl-uniform-update glsl-uniform-update.c)
 piglit_add_executable (glsl-uniform-out-of-bounds
glsl-uniform-out-of-bounds.c)
diff --git a/tests/shaders/glsl-cache-fallback-shader-source.c
b/tests/shaders/glsl-cache-fallback-shader-source.c
new file mode 100644
index 000..f764617
--- /dev/null
+++ b/tests/shaders/glsl-cache-fallback-shader-source.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2009 Nicolai Hähnle


I suspect your copyright should go on this, too.


+ *
+ * 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
+ * Tests setting shader source on an already compiled shader. If we
don't
+ * compile the new source we need to make sure the old source being
used if
+ * Mesa's on-disk shader cache is forced to fallback and recompile
the shader.
+ */
+
+#include 
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_one[] =
+"varying vec4 color;\n"
+"void main() {\n"
+"   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+"   color = vec4(0.0, 0.4, 0.0, 1.0);\n"
+"}\n";


I'd love some indents before the '"'s, I find them a bit hard to read
like this.


+
+static const char vs_two[] =
+"varying vec4 color;\n"
+"void main() {\n"
+"   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+"   color = vec4(0.4, 0.4, 0.0, 1.0);\n"
+"}\n";
+
+static const char fs_one[] =
+"varying vec4 color;\n"
+"void main() {\n"
+"   gl_FragColor = color;\n"
+"}\n";
+
+static const char fs_two[] =
+"varying vec4 color;\n"
+"void main() {\n"
+"   gl_FragColor = color + vec4(0.4, 0.0, 0.4, 0.0

[Piglit] [PATCH 1/2] arb_sparse_buffer: minmax test

2017-02-08 Thread Nicolai Hähnle
From: Nicolai Hähnle 

---
 tests/all.py   |  5 +++
 tests/spec/CMakeLists.txt  |  1 +
 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt | 12 ++
 tests/spec/arb_sparse_buffer/CMakeLists.txt|  1 +
 tests/spec/arb_sparse_buffer/minmax.c  | 58 ++
 5 files changed, 77 insertions(+)
 create mode 100644 tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_sparse_buffer/CMakeLists.txt
 create mode 100644 tests/spec/arb_sparse_buffer/minmax.c

diff --git a/tests/all.py b/tests/all.py
index 96737f6..9ad9652 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4374,6 +4374,11 @@ with profile.test_list.group_manager(
 
 with profile.test_list.group_manager(
 PiglitGLTest,
+grouptools.join('spec', 'arb_sparse_buffer')) as g:
+g(['arb_sparse_buffer-minmax'], 'minmax')
+
+with profile.test_list.group_manager(
+PiglitGLTest,
 grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
 g(['ext_polygon_offset_clamp-draw'])
 g(['ext_polygon_offset_clamp-draw_gles2'])
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 4ac1a53..6a62379 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -60,6 +60,7 @@ add_subdirectory (arb_stencil_texturing)
 add_subdirectory (arb_sync)
 add_subdirectory (arb_uniform_buffer_object)
 add_subdirectory (ati_draw_buffers)
+add_subdirectory (arb_sparse_buffer)
 add_subdirectory (arb_tessellation_shader)
 add_subdirectory (arb_texture_buffer_object)
 add_subdirectory (arb_texture_buffer_range)
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
new file mode 100644
index 000..3490ba7
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_sparse_buffer-minmax minmax.c)
diff --git a/tests/spec/arb_sparse_buffer/CMakeLists.txt 
b/tests/spec/arb_sparse_buffer/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_sparse_buffer/minmax.c 
b/tests/spec/arb_sparse_buffer/minmax.c
new file mode 100644
index 000..1f8e617
--- /dev/null
+++ b/tests/spec/arb_sparse_buffer/minmax.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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 for the minimum maximum values specified in the
+ * ARB_sparse_buffer extension.
+ */
+
+#include "piglit-util-gl.h"
+#include "minmax-test.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* UNREACHED */
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_ARB_sparse_buffer");
+   piglit_print_minmax_header();
+
+   piglit_test_max_uint(GL_SPARSE_BUFFER_PAGE_SIZE_ARB, 65536);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
2.9.3

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


  1   2   3   >