summaryrefslogtreecommitdiffstats
path: root/tests/bugs/sccp-switch-case-removal.slang
blob: cf8d36ef76743454ab66757c529ebc033efa4e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj

//TEST_INPUT:ubuffer(data=[9 9 9 9], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

static const uint kConstant = 5;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    float x = 1.0;
    switch(kConstant)
    {
    case 5:
        int tid = int(dispatchThreadID.x);
	    outputBuffer[tid] = 0;
        break;
    case 1:
        ddx(x); // this should trigger glslang error if it doesn't get eliminated by sccp.
        break;
    default:
        ddy(x); // this should trigger glslang error if it doesn't get eliminated by sccp.
        break;
    }
}