SPIRV-Cross/reference/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp
Hans-Kristian Arntzen 9b7140e2ba Implement OpAtomicLoad/OpAtomicStore.
Need some emulation on GLSL/HLSL, fix bug with atomic store on MSL.
2020-04-27 12:11:46 +02:00

24 lines
494 B
Plaintext

#pragma clang diagnostic ignored "-Wunused-variable"
#include <metal_stdlib>
#include <simd/simd.h>
#include <metal_atomic>
using namespace metal;
struct SSBO
{
uint a;
uint b;
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
kernel void main0(device SSBO& _5 [[buffer(0)]])
{
uint _20 = atomic_load_explicit((device atomic_uint*)&_5.b, memory_order_relaxed);
uint c = _20;
atomic_store_explicit((device atomic_uint*)&_5.a, c, memory_order_relaxed);
}