yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Jay KwakSupport Vulkan memory model (#7057)d58243d90

master
784 B20 linesraw
1// Test that globallycoherent works on arrays of uavs.
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
6globallycoherent RWByteAddressBuffer buffer[];
7
8RWStructuredBuffer<float> output;
9[numthreads(4,1,1)]
10void main(int tid : SV_DispatchThreadID)
11{
12    buffer[NonUniformResourceIndex(0)].InterlockedAdd(0, 1);
13    AllMemoryBarrier();
14    output[tid] = buffer[0].Load(0);
15    // CHECK-DAG: OpDecorate %buffer Coherent
16    // CHECK-DAG: OpDecorate %[[VAR1:[a-zA-Z0-9_]+]] NonUniform
17    // CHECK: %[[VAR1]] = OpAccessChain %{{.*}} %buffer
18
19    //VK_MEM_MODEL: OpLoad {{.*}} MakePointerVisible|NonPrivatePointer
20}