3 #extension GL_KHR_memory_scope_semantics : enable
4 #extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
5 #extension GL_EXT_shader_atomic_float2: enable
6 #pragma use_vulkan_memory_model
8 layout(local_size_x = 16, local_size_y = 16) in;
10 layout(binding = 0) buffer Buffer
17 shared float16_t atomh;
21 layout(binding = 0, r32f) volatile coherent uniform image1D fimage1D;
22 layout(binding = 1, r32f) volatile coherent uniform image1DArray fimage1DArray;
23 layout(binding = 2, r32f) volatile coherent uniform image2D fimage2D;
24 layout(binding = 3, r32f) volatile coherent uniform image2DArray fimage2DArray;
25 layout(binding = 4, r32f) volatile coherent uniform image2DRect fimage2DRect;
26 layout(binding = 5, r32f) volatile coherent uniform imageCube fimageCube;
27 layout(binding = 6, r32f) volatile coherent uniform imageCubeArray fimageCubeArray;
28 layout(binding = 9, r32f) volatile coherent uniform image3D fimage3D;
33 float16_t resulth = float16_t(0.0);
34 resulth = atomicAdd(atomh, float16_t(3.0));
35 resulth = atomicAdd(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
36 resulth = atomicAdd(buf.datah, float16_t(3.0));
37 resulth = atomicAdd(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
40 resulth = atomicMin(atomh, float16_t(3.0));
41 resulth = atomicMin(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
42 resulth = atomicMin(buf.datah, float16_t(3.0));
43 resulth = atomicMin(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
46 resultf = atomicMin(atomf, 3.0);
47 resultf = atomicMin(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
48 resultf = atomicMin(buf.dataf, 3.0);
49 resultf = atomicMin(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
52 resultd = atomicMin(atomd, 3.0);
53 resultd = atomicMin(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
54 resultd = atomicMin(buf.datad, 3.0);
55 resultd = atomicMin(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
58 resulth = atomicMax(atomh, float16_t(3.0));
59 resulth = atomicMax(atomh, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
60 resulth = atomicMax(buf.datah, float16_t(3.0));
61 resulth = atomicMax(buf.datah, float16_t(4.5), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
63 resultf = atomicMax(atomf, 3.0);
64 resultf = atomicMax(atomf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
65 resultf = atomicMax(buf.dataf, 3.0);
66 resultf = atomicMax(buf.dataf, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
68 resultd = atomicMax(atomd, 3.0);
69 resultd = atomicMax(atomd, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
70 resultd = atomicMax(buf.datad, 3.0);
71 resultd = atomicMax(buf.datad, 4.5, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelaxed);
74 resulth = atomicExchange(buf.datah, resulth);
76 resulth = atomicExchange(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
78 resulth = atomicExchange(atomh, resulth);
80 resulth = atomicExchange(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
84 resulth = atomicLoad(buf.datah, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
85 atomicStore(buf.datah, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
88 resulth = atomicLoad(atomh, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
89 atomicStore(atomh, resulth, gl_ScopeDevice, gl_StorageSemanticsShared, gl_SemanticsRelaxed);
92 // image atomics on 1D:
93 atomf = imageAtomicMin(fimage1D, int(0), 2.0);
95 atomf = imageAtomicMin(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
98 atomf = imageAtomicMax(fimage1D, int(0), 2.0);
100 atomf = imageAtomicMax(fimage1D, int(1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
103 // image atomics on 1D Array:
104 atomf = imageAtomicMin(fimage1DArray, ivec2(0,0), 2.0);
106 atomf = imageAtomicMin(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
109 atomf = imageAtomicMax(fimage1DArray, ivec2(0,0), 2.0);
111 atomf = imageAtomicMax(fimage1DArray, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
114 // image atomics on 2D:
115 atomf = imageAtomicMin(fimage2D, ivec2(0,0), 2.0);
117 atomf = imageAtomicMin(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
120 atomf = imageAtomicMax(fimage2D, ivec2(0,0), 2.0);
122 atomf = imageAtomicMax(fimage2D, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
125 // image atomics on 2D Rect:
126 atomf = imageAtomicMin(fimage2DRect, ivec2(0,0), 2.0);
128 atomf = imageAtomicMin(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
131 atomf = imageAtomicMax(fimage2DRect, ivec2(0,0), 2.0);
133 atomf = imageAtomicMax(fimage2DRect, ivec2(1,1), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
136 // image atomics on 2D Array:
137 atomf = imageAtomicMin(fimage2DArray, ivec3(0,0,0), 2.0);
139 atomf = imageAtomicMin(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
142 atomf = imageAtomicMax(fimage2DArray, ivec3(0,0,0), 2.0);
144 atomf = imageAtomicMax(fimage2DArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
147 // image atomics on Cube:
148 atomf = imageAtomicMin(fimageCube, ivec3(0,0,0), 2.0);
150 atomf = imageAtomicMin(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
153 atomf = imageAtomicMax(fimageCube, ivec3(0,0,0), 2.0);
155 atomf = imageAtomicMax(fimageCube, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
158 // image atomics on Cube Array:
159 atomf = imageAtomicMin(fimageCubeArray, ivec3(0,0,0), 2.0);
161 atomf = imageAtomicMin(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
164 atomf = imageAtomicMax(fimageCubeArray, ivec3(0,0,0), 2.0);
166 atomf = imageAtomicMax(fimageCubeArray, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
169 // image atomics on 3D:
170 atomf = imageAtomicMin(fimage3D, ivec3(0,0,0), 2.0);
172 atomf = imageAtomicMin(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);
175 atomf = imageAtomicMax(fimage3D, ivec3(0,0,0), 2.0);
177 atomf = imageAtomicMax(fimage3D, ivec3(1,1,0), 3.0, gl_ScopeDevice, gl_StorageSemanticsImage , gl_SemanticsRelaxed);