summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-4111.slang
blob: 66d565d9fd4a6cd6eec84f47f15a6c9d7081b382 (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
31
//TEST:SIMPLE(filecheck=CHECK): -target spirv

// Check that a pointer typed local variable has `AliasedPointer` decoration.

// CHECK: OpDecorate %b AliasedPointer
struct Buf
{
    uint test;
};

struct Push
{
    bool a_or_b;
    Buf * a;
    Buf * b;
};

[[vk::push_constant]] Push push;

func tester(Buf * buf)
{
    buf->test = 1;
}

[shader("compute")]
[numthreads(1, 1, 1)]
void main()
{
    Buf * b = push.a_or_b ? push.a : push.b;
    tester(b);
}