yum-mirror/slang

Making it easier to work with shaders

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

cheneym2Fix simplify if-else (#6077)4da52b65a

master
645 B26 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target hlsl
2//CHECK: computeMain
3
4//TEST_INPUT:ubuffer(data=[9 9 9 9], stride=4):out,name=outputBuffer
5RWStructuredBuffer<int> outputBuffer;
6
7[numthreads(4, 1, 1)]
8void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
9{
10    vector<float32_t, 4> vvv = vector<float32_t, 4>(0);
11    float32_t ret = 0.0f;
12    if (vvv.y < 1.0f)
13    {
14        ret = 1.0f;
15    }
16    else
17    {
18        if (vvv.y > 1.0f && outputBuffer[3] == 3)
19        {
20            ret = 0.0f;
21        } else {
22            if (true) {}
23        }
24    }
25    outputBuffer[int(dispatchThreadID.x)] = int(ret);
26}