summaryrefslogtreecommitdiff
path: root/tests/spirv/coherent.slang
blob: ba58b713b21069126fd13d8d758d3e4f50993086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Test that globallycoherent works.

//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly

struct S
{
    globallycoherent int member;
}
globallycoherent RWStructuredBuffer<S> buffer;

RWStructuredBuffer<float> output;
[numthreads(4,1,1)]
void main(int tid : SV_DispatchThreadID)
{
    InterlockedAdd(buffer[0].member, 1);
    AllMemoryBarrier();
    output[tid] = buffer[0].member;
    // CHECK-DAG: OpMemberDecorate {{.*}} 0 Coherent
    // CHECK-DAG: OpDecorate %buffer Coherent
}