From: Nicolai Hähnle <[email protected]>

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

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to