yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyConvert more tests to use shader objects (#1659)2a5d5b323

master
654 B36 linesraw
1// gh-569.slang
2//TEST(compute):COMPARE_COMPUTE: -shaderobj
3
4// Test that correct scoping is used in generated HLSL/GLSL,
5// even when dominator tree and structured control flow disagree.
6
7uint test(uint inVal)
8{
9	uint tmp = inVal;
10    for(;;)
11    {
12    	if(tmp < 4)
13    	{
14    		tmp++;
15    	}
16    	else
17    	{
18    		break;
19    	}
20    }
21    return tmp + inVal;
22}
23
24//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name gBuffer
25RWStructuredBuffer<uint> gBuffer;
26
27[numthreads(4, 1, 1)]
28void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
29{
30    uint tid = dispatchThreadID.x;
31
32    uint val = tid;
33    val = test(val);
34
35    gBuffer[tid] = val;
36}