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

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


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

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



More information about the Piglit mailing list