yum-mirror/slang

Making it easier to work with shaders

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

Harsh Aggarwal (NVIDIA)Fix#8085: Batch-9: Enable cuda tests (#8269)bf607e2f3

master
695 B43 linesraw
1//TEST(compute):COMPARE_COMPUTE: -shaderobj
2//TEST(compute):COMPARE_COMPUTE: -cuda -shaderobj
3
4// Test that `swith` statement works
5
6int test(int inVal)
7{
8	int result = inVal;
9	switch(inVal)
10	{
11	case 0:
12		result = 16;
13		break;
14
15	case 2:
16	case 5:
17		result = inVal + 16;
18		break;
19
20	case 4:
21		{}
22		break;		
23
24	default:
25	case 3:
26		result = 0;
27		break;
28	}
29
30	return result;
31}
32
33//TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7], stride=4):out,name=outputBuffer
34RWStructuredBuffer<int> outputBuffer;
35
36[numthreads(8, 1, 1)]
37void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
38{
39	uint tid = dispatchThreadID.x;
40	int inVal = outputBuffer[tid];
41	int outVal = test(inVal);
42	outputBuffer[tid] = outVal;
43}