1 # Simple test that verifies gl_GlobalInvocationID values are
2 # functioning. Atomic counters are used as outputs.
4 # The additional twist is that the work is done in a different shader,
5 # which also has the layout declaration.
11 GL_ARB_shader_atomic_counters
15 #extension GL_ARB_compute_shader: enable
19 // When the go() function gets moved here, the gl_WorkGroupSize can stay
20 // behind in the other shader.
28 #extension GL_ARB_compute_shader: enable
29 #extension GL_ARB_shader_atomic_counters: require
31 layout(local_size_x = 4, local_size_y = 2, local_size_z = 4) in;
33 layout(binding = 0) uniform atomic_uint a0;
34 layout(binding = 0) uniform atomic_uint a1;
35 layout(binding = 0) uniform atomic_uint a2;
36 layout(binding = 0) uniform atomic_uint a3;
37 layout(binding = 0) uniform atomic_uint a4;
38 layout(binding = 0) uniform atomic_uint a5;
39 layout(binding = 0) uniform atomic_uint a6;
40 layout(binding = 0) uniform atomic_uint a7;
44 uint x = gl_GlobalInvocationID.x;
45 uint y = gl_GlobalInvocationID.y;
46 uint z = gl_GlobalInvocationID.z;
48 if (((x & y) & z) == 0u)
49 atomicCounterIncrement(a0);
50 if (((x | y) | z) == 7u)
51 atomicCounterIncrement(a1);
53 atomicCounterIncrement(a2);
54 if (x != y && y != z && x != z)
55 atomicCounterIncrement(a3);
56 if (((x & y) & z) == 2u)
57 atomicCounterIncrement(a4);
58 if (((x | y) | z) == 5u)
59 atomicCounterIncrement(a5);
60 if (x < 4u && y < 4u && z < 4u)
61 atomicCounterIncrement(a6);
62 if (x >= 4u || y >= 4u || z >= 4u)
63 atomicCounterIncrement(a7);
70 probe atomic counter 0 == 343
71 probe atomic counter 1 == 343
72 probe atomic counter 2 == 8
73 probe atomic counter 3 == 336
74 probe atomic counter 4 == 49
75 probe atomic counter 5 == 49
76 probe atomic counter 6 == 64
77 probe atomic counter 7 == 448