1 # Simple test that verifies gl_GlobalInvocationID values are
2 # functioning. Atomic counters are used as outputs.
4 # The additional twist is that the layout (and thus gl_WorkGroupSize)
5 # is declared in a different shader.
11 GL_ARB_shader_atomic_counters
15 #extension GL_ARB_compute_shader: enable
17 layout(local_size_x = 4, local_size_y = 2, local_size_z = 4) in;
21 #extension GL_ARB_compute_shader: enable
22 #extension GL_ARB_shader_atomic_counters: require
24 layout(binding = 0) uniform atomic_uint a0;
25 layout(binding = 0) uniform atomic_uint a1;
26 layout(binding = 0) uniform atomic_uint a2;
27 layout(binding = 0) uniform atomic_uint a3;
28 layout(binding = 0) uniform atomic_uint a4;
29 layout(binding = 0) uniform atomic_uint a5;
30 layout(binding = 0) uniform atomic_uint a6;
31 layout(binding = 0) uniform atomic_uint a7;
35 uint x = gl_GlobalInvocationID.x;
36 uint y = gl_GlobalInvocationID.y;
37 uint z = gl_GlobalInvocationID.z;
39 if (((x & y) & z) == 0u)
40 atomicCounterIncrement(a0);
41 if (((x | y) | z) == 7u)
42 atomicCounterIncrement(a1);
44 atomicCounterIncrement(a2);
45 if (x != y && y != z && x != z)
46 atomicCounterIncrement(a3);
47 if (((x & y) & z) == 2u)
48 atomicCounterIncrement(a4);
49 if (((x | y) | z) == 5u)
50 atomicCounterIncrement(a5);
51 if (x < 4u && y < 4u && z < 4u)
52 atomicCounterIncrement(a6);
53 if (x >= 4u || y >= 4u || z >= 4u)
54 atomicCounterIncrement(a7);
61 probe atomic counter 0 == 343
62 probe atomic counter 1 == 343
63 probe atomic counter 2 == 8
64 probe atomic counter 3 == 336
65 probe atomic counter 4 == 49
66 probe atomic counter 5 == 49
67 probe atomic counter 6 == 64
68 probe atomic counter 7 == 448