yum-mirror/slang

Making it easier to work with shaders

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

Yong HeMake sure pointer local vars have `AliasedPointer` decoration. (#4132)eb3970897

master
456 B31 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv
2
3// Check that a pointer typed local variable has `AliasedPointer` decoration.
4
5// CHECK: OpDecorate %b AliasedPointer
6struct Buf
7{
8    uint test;
9};
10
11struct Push
12{
13    bool a_or_b;
14    Buf * a;
15    Buf * b;
16};
17
18[[vk::push_constant]] Push push;
19
20func tester(Buf * buf)
21{
22    buf->test = 1;
23}
24
25[shader("compute")]
26[numthreads(1, 1, 1)]
27void main()
28{
29    Buf * b = push.a_or_b ? push.a : push.b;
30    tester(b);
31}