blob: 0dc6eceda8e3592c76589863f3d7473c8fb626a6 (
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
26
27
28
29
30
31
32
33
34
35
36
|
// gh-569.slang
//TEST(compute):COMPARE_COMPUTE: -shaderobj
// Test that correct scoping is used in generated HLSL/GLSL,
// even when dominator tree and structured control flow disagree.
uint test(uint inVal)
{
uint tmp = inVal;
for(;;)
{
if(tmp < 4)
{
tmp++;
}
else
{
break;
}
}
return tmp + inVal;
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name gBuffer
RWStructuredBuffer<uint> gBuffer;
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
uint val = tid;
val = test(val);
gBuffer[tid] = val;
}
|