diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/gh-569.slang | 36 | ||||
| -rw-r--r-- | tests/bugs/gh-569.slang.expected.txt | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/bugs/gh-569.slang b/tests/bugs/gh-569.slang new file mode 100644 index 000000000..fa7525d45 --- /dev/null +++ b/tests/bugs/gh-569.slang @@ -0,0 +1,36 @@ +// gh-569.slang +//TEST(compute):COMPARE_COMPUTE: + +// 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):dxbinding(0),glbinding(0),out +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; +} diff --git a/tests/bugs/gh-569.slang.expected.txt b/tests/bugs/gh-569.slang.expected.txt new file mode 100644 index 000000000..3195a6aa5 --- /dev/null +++ b/tests/bugs/gh-569.slang.expected.txt @@ -0,0 +1,4 @@ +4 +5 +6 +7 |
