4 GL_ARB_shader_storage_buffer_object
5 GL_ARB_shader_atomic_counters
6 GL_ARB_shader_atomic_counter_ops
7 GL_INTEL_shader_atomic_float_minmax
9 [vertex shader passthrough]
12 #extension GL_ARB_shader_storage_buffer_object: require
13 #extension GL_ARB_shader_atomic_counters: require
14 #extension GL_ARB_shader_atomic_counter_ops: require
15 #extension GL_INTEL_shader_atomic_float_minmax: require
17 layout(binding = 0) buffer bufblock {
21 /* +0.0 and -0.0 stored as bits. Storing these in a uniform and converting
22 * them to float using uintBitsToFloat should prevent the compiler from
23 * silently dropping the sign bit.
25 uniform uint zeros[] = uint[](0x00000000u, 0x80000000u);
27 layout(binding = 0) uniform atomic_uint pass;
33 uint idx = uint(gl_FragCoord.x + gl_FragCoord.y) % uint(value.length());
34 float v = uintBitsToFloat(zeros[idx & 1u]);
35 float f = atomicCompSwap(value[idx], v, 47.0 + float(idx));
38 atomicCounterIncrement(pass);
39 color = vec4(0.0, 1.0, 0.0, 1.0);
41 color = vec4(0.0, 0.0, 1.0, 1.0);
49 ssbo 0 subdata int 0 0x80000000
50 ssbo 0 subdata int 4 0x00000000
51 ssbo 0 subdata int 8 0x80000000
52 ssbo 0 subdata int 12 0x00000000
53 ssbo 0 subdata int 16 0x80000000
54 ssbo 0 subdata int 20 0x00000000
55 ssbo 0 subdata int 24 0x80000000
56 ssbo 0 subdata int 28 0x00000000
58 clear color 0.5 0.5 0.5 0.5
63 probe atomic counter 0 == 8