1 # Simple test that verifies gl_LocalInvocationID values are
2 # functioning. Atomic counters are used as outputs.
8 GL_ARB_shader_atomic_counters
12 #extension GL_ARB_compute_shader: enable
13 #extension GL_ARB_shader_atomic_counters: require
15 layout(binding = 0) uniform atomic_uint a0;
16 layout(binding = 0) uniform atomic_uint a1;
17 layout(binding = 0) uniform atomic_uint a2;
18 layout(binding = 0) uniform atomic_uint a3;
19 layout(binding = 0) uniform atomic_uint a4;
20 layout(binding = 0) uniform atomic_uint a5;
21 layout(binding = 0) uniform atomic_uint a6;
22 layout(binding = 0) uniform atomic_uint a7;
24 layout(local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
28 uint x = gl_LocalInvocationIndex & 0x7u;
29 uint y = (gl_LocalInvocationIndex >> 3u) & 0x7u;
30 uint z = (gl_LocalInvocationIndex >> 6u) & 0x7u;
32 if (((x & y) & z) == 0u)
33 atomicCounterIncrement(a0);
34 if (((x | y) | z) == 7u)
35 atomicCounterIncrement(a1);
37 atomicCounterIncrement(a2);
38 if (x != y && y != z && x != z)
39 atomicCounterIncrement(a3);
40 if (((x & y) & z) == 2u)
41 atomicCounterIncrement(a4);
42 if (((x | y) | z) == 5u)
43 atomicCounterIncrement(a5);
44 if (x < 4u && y < 4u && z < 4u)
45 atomicCounterIncrement(a6);
46 if (x >= 4u || y >= 4u || z >= 4u)
47 atomicCounterIncrement(a7);
54 probe atomic counter 0 == 343
55 probe atomic counter 1 == 343
56 probe atomic counter 2 == 8
57 probe atomic counter 3 == 336
58 probe atomic counter 4 == 49
59 probe atomic counter 5 == 49
60 probe atomic counter 6 == 64
61 probe atomic counter 7 == 448