yum-mirror/slang

Making it easier to work with shaders

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

Julius IkkalaAllow simplifying self-referential Phi parameters (#6870)0f6ba1476

master
616 B29 linesraw
1//TEST:SIMPLE(filecheck=CHECK):-stage fragment -entry fragment -target wgsl
2
3func dummy(b: StructuredBuffer<float>)->float {
4    return 0;
5}
6
7func breaker(b: StructuredBuffer<float>)->float {
8    // CHECK-NOT: var<storage, read> {{.*}} : array<f32> = {{.*}};
9    var x: float = 0;
10    for (int i = 0; i < 1; ++i) {
11        x = dummy(b);
12        if (true) {
13        } else {
14            return 0;
15            x = 0;
16        }
17    }
18    return x;
19}
20
21StructuredBuffer<float> b;
22
23[shader("fragment")]
24float4 fragment(float4 in: SV_Position)
25    : SV_Target
26{
27    let res = breaker(b);
28    return float4(res, 0, 0, 0);
29}