https://github.com/shader-slang/slang
Raw File
Tip revision: 926009a58315845b3a3a95e2724486a6c9e987ea authored by Tomáš Pazdiora on 10 May 2024, 01:17:38 UTC
fix typo (#4144)
Tip revision: 926009a
gh-4111.slang
//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);
}
back to top