yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d58243d90
master
1// Test that globallycoherent works. 2 3//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly 4//TEST:SIMPLE(filecheck=VK_MEM_MODEL): -target spirv -stage compute -entry main -emit-spirv-directly -capability vk_mem_model 5 6struct S 7{ 8 globallycoherent int member; 9} 10globallycoherent RWStructuredBuffer<S> buffer; 11 12RWStructuredBuffer<float> output; 13[numthreads(4,1,1)] 14void main(int tid : SV_DispatchThreadID) 15{ 16 InterlockedAdd(buffer[0].member, 1); 17 AllMemoryBarrier(); 18 output[tid] = buffer[0].member; 19 // CHECK-DAG: OpMemberDecorate {{.*}} 0 Coherent 20 // CHECK-DAG: OpDecorate %buffer Coherent 21 // VK_MEM_MODEL: OpLoad {{.*}} MakePointerVisible|NonPrivatePointer 22}