1#version 450 2#extension GL_KHR_memory_scope_semantics : require 3#extension GL_ARB_gpu_shader_int64 : require 4 5#pragma use_vulkan_memory_model 6 7shared uint value; 8shared int atomi; 9shared uint atomu; 10layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu; 11layout(binding = 1, r32i) volatile coherent uniform iimage2D imagei; 12layout(binding = 5, r32i) nonprivate uniform iimage2D imagej[2]; 13layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu; 14layout (binding = 3) coherent buffer BufferI { uint x; } bufferi; 15struct A { uint x[2]; }; 16layout (binding = 4) volatile buffer BufferJ { subgroupcoherent A a; } bufferj[2]; 17layout (binding = 6) nonprivate uniform sampler2D samp[2]; 18layout (binding = 7) nonprivate uniform BufferK { uint x; } bufferk; 19shared uint64_t atomu64; 20shared int64_t atomi64; 21layout (binding = 8) volatile buffer BufferL { uint x; } bufferl; 22layout (binding = 9) buffer BufferM { volatile uint x; } bufferm; 23layout(binding = 10, r32i) volatile coherent uniform iimage2DMS imageMS; 24 25 26void main() 27{ 28 int origi = atomicAdd(atomi, 3, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); 29 uint origu = atomicAnd(atomu, value); 30 origi = atomicLoad(atomi, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); 31 atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); 32 origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); 33 origu = imageAtomicAdd(imageu, ivec2(0,0), 3u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); 34 imageAtomicStore(imageu, ivec2(0,0), 4u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); 35 origu = atomicOr(atomu, 7u, gl_ScopeDevice, 0, 0); 36 origu = atomicXor(atomu, 7u, gl_ScopeDevice, 0, 0); 37 origu = atomicMin(atomu, value, gl_ScopeDevice, 0, 0); 38 origi = atomicMax(atomi, 7, gl_ScopeDevice, 0, 0); 39 origi = atomicExchange(atomi, origi, gl_ScopeDevice, 0, 0); 40 origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); 41 atomicAdd(bufferu.x, 1, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); 42 memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); 43 controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); 44 controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0); 45 46 uint y; 47 y = bufferu.x; 48 bufferu.x = y; 49 y = bufferi.x; 50 y = bufferj[0].a.x[1]; 51 bufferi.x = y; 52 bufferj[0].a.x[1] = y; 53 bufferj[0].a = bufferj[1].a; 54 bufferi.x = bufferk.x; 55 56 imageLoad(imagei, ivec2(0,0)); 57 imageLoad(imagej[0], ivec2(0,0)); 58 imageStore(imagej[1], ivec2(0,0), ivec4(0,0,0,0)); 59 texture(samp[0], vec2(0,0)); 60 61 atomu64 = atomicMax(atomu64, uint64_t(7), gl_ScopeDevice, 0, 0); 62 atomicCompSwap(atomi64, int64_t(10), int64_t(atomu64), gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); 63 64 y = bufferl.x; 65 atomicAdd(bufferl.x, 1); 66 atomicOr(bufferm.x, 2); 67 imageAtomicAdd(imagei, ivec2(0,0), 3); 68 atomicAdd(bufferu.x, 4u, gl_ScopeDevice, 0, 0); 69 atomicAdd(bufferu.x, 5u, gl_ScopeDevice, 0, gl_SemanticsVolatile); 70 71 imageAtomicStore(imageMS, ivec2(0,0), 1, 4, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); 72 imageAtomicStore(imagei, ivec2(0,0), -7, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); 73} 74 75