summaryrefslogtreecommitdiffstats
path: root/tests/spirv/ref-this.slang
blob: de426397595f93578e1cc873bf8166d67956e8ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//TEST:SIMPLE(filecheck=CHECK): -target spirv

// CHECK: %[[PTR:[0-9a-zA-Z_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %{{.*}} %int_0
// CHECK: %{{.*}} = OpAtomicIAdd %uint %[[PTR]] %uint_1 %uint_0 %uint_1

struct Buf
{
    uint t;

    [__ref]
    func tester()
    {
        uint prev;
        InterlockedAdd(t, 1, prev);
    }
};

struct Push
{
    Buf * b;
};

[[vk::push_constant]] Push push;

[shader("compute")]
[numthreads(1, 1, 1)]
void main()
{
    push.b->tester();
}