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

Nicolai Hähnle nhaehnle at gmail.com
Fri Mar 31 17:02:24 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 .../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 0000000..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 0000000..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



More information about the Piglit mailing list