[Piglit] [PATCH 3/6] arb_shader_ballot: add readFirstInvocationARB test
Nicolai Hähnle
nhaehnle at gmail.com
Fri Mar 31 17:02:25 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
...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 0000000..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 0000000..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
More information about the Piglit
mailing list