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

2017-03-31 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


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

2017-03-31 Thread Ilia Mirkin
On Fri, Mar 31, 2017 at 2:32 AM, Nicolai Hähnle  wrote:
> 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.

Right. So unless the counter goes REALLY fast (or is a single bit),
this should be pretty safe.

This series is

Reviewed-by: Ilia Mirkin 

>
> 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


[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 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 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 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


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

2017-03-31 Thread Ilia Mirkin
On Fri, Mar 31, 2017 at 1:02 PM, Nicolai Hähnle  wrote:
> 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++;
> +   }

Not that perf *really* matters, but

uvec2 t = bitCount(unpackUint2x32(active_set));
int num_active = t.x + t.y;

This series is

Reviewed-by: Ilia Mirkin 

> +
> +   /* 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 mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


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

2017-03-31 Thread Vinson Lee
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;
-- 
2.9.3

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


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

2017-03-31 Thread Vinson Lee
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100438
Signed-off-by: Vinson Lee 
---
 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);
+}
-- 
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-31 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