yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyFix a crash on function-static variables with initializers (#703)098dd5d87

master
396 B25 linesraw
1// ir-null-parent-crash.slang
2
3// Test an issue where Slang was crashing on functions that
4// have `static` variables with initializers.
5
6//TEST:SIMPLE:-target hlsl
7
8struct RNG
9{
10	uint state[2];
11}
12
13void jump(inout RNG rng)
14{
15    static uint32_t a[] = { 0x4, 0x2, 0x1, 0x3 };
16
17    uint32_t s0 = 0;
18
19    for (int i = 0; i < 4; i++)
20    {
21        s0 ^= rng.state[0];
22    }
23
24    rng.state[0] = s0;
25}