1 # Test layouts of atomic counters in a fragment shader.
5 GL_ARB_shader_atomic_counters
6 INT GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS >= 2
8 [vertex shader passthrough]
12 #extension GL_ARB_shader_atomic_counters: require
14 layout(binding = 0, offset = 0) uniform atomic_uint a0;
15 layout(binding = 1, offset = 0) uniform atomic_uint b0;
16 layout(binding = 1, offset = 4) uniform atomic_uint b1[2];
18 uniform uint a0_expected;
19 uniform uint b0_expected;
20 uniform uint b1_expected;
27 uint old_a0 = atomicCounterIncrement(a0);
28 uint old_b0 = atomicCounterIncrement(b0);
29 uint old_b1 = atomicCounterIncrement(b1[idx]);
31 if (old_a0 != a0_expected) {
32 color = vec4(1.0, 0.0, float(old_a0) / 255.0, 1.0);
35 if (old_b0 != b0_expected) {
36 color = vec4(1.0, 0.1, float(old_b0) / 255.0, 1.0);
39 if (old_b1 != b1_expected) {
40 color = vec4(1.0, 0.2, float(old_b1) / 255.0, 1.0);
43 color = vec4(0.0, 1.0, 0.0, 1.0);
47 atomic counter buffer 0 1
48 atomic counter buffer 1 3
50 clear color 0.0 0.0 0.0 0.0
58 uniform uint a0_expected 17
59 uniform uint b0_expected 31
61 uniform uint b1_expected 9
63 draw rect ortho 0 0 1 1
64 probe rgba 0 0 0.0 1.0 0.0 1.0