blob: c03c12394157f757ec55d394b3519f095e4f65bf [file] [log] [blame]
#version 450
#extension GL_KHR_memory_scope_semantics : require
#extension GL_ARB_gpu_shader_int64 : require
#pragma use_vulkan_memory_model
shared uint value;
shared int atomi;
shared uint atomu;
layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu;
layout(binding = 1, r32i) volatile coherent uniform iimage2D imagei;
layout(binding = 5, r32i) nonprivate uniform iimage2D imagej[2];
layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu;
layout (binding = 3) coherent buffer BufferI { uint x; } bufferi;
struct A { uint x[2]; };
layout (binding = 4) volatile buffer BufferJ { subgroupcoherent A a; } bufferj[2];
layout (binding = 6) nonprivate uniform sampler2D samp[2];
layout (binding = 7) nonprivate uniform BufferK { uint x; } bufferk;
shared uint64_t atomu64;
shared int64_t atomi64;
void main()
{
int origi = atomicAdd(atomi, 3, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);
uint origu = atomicAnd(atomu, value);
origi = atomicLoad(atomi, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
origu = imageAtomicAdd(imageu, ivec2(0,0), 3u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire);
imageAtomicStore(imageu, ivec2(0,0), 4u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
origu = atomicOr(atomu, 7u, gl_ScopeDevice, 0, 0);
origu = atomicXor(atomu, 7u, gl_ScopeDevice, 0, 0);
origu = atomicMin(atomu, value, gl_ScopeDevice, 0, 0);
origi = atomicMax(atomi, 7, gl_ScopeDevice, 0, 0);
origi = atomicExchange(atomi, origi, gl_ScopeDevice, 0, 0);
origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
atomicAdd(bufferu.x, 1, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);
memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease);
controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0);
uint y;
y = bufferu.x;
bufferu.x = y;
y = bufferi.x;
y = bufferj[0].a.x[1];
bufferi.x = y;
bufferj[0].a.x[1] = y;
bufferj[0].a = bufferj[1].a;
bufferi.x = bufferk.x;
imageLoad(imagei, ivec2(0,0));
imageLoad(imagej[0], ivec2(0,0));
imageStore(imagej[1], ivec2(0,0), ivec4(0,0,0,0));
texture(samp[0], vec2(0,0));
atomu64 = atomicMax(atomu64, uint64_t(7), gl_ScopeDevice, 0, 0);
atomicCompSwap(atomi64, int64_t(10), int64_t(atomu64), gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire);
}