diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ir/loop-unroll-2.slang | 23 | ||||
| -rw-r--r-- | tests/ir/loop-unroll-2.slang.expected.txt | 4 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/ir/loop-unroll-2.slang b/tests/ir/loop-unroll-2.slang new file mode 100644 index 000000000..aff227432 --- /dev/null +++ b/tests/ir/loop-unroll-2.slang @@ -0,0 +1,23 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + int sum = 0; + [ForceUnroll] + for (int i = 0; i < 2; i++) + { + [ForceUnroll(2)] + for (int j = 1; j < 3; j++) + { + if (i == 1 && j == 1) + continue; + sum += (i+j); + } + } + outputBuffer[0] = sum; +} diff --git a/tests/ir/loop-unroll-2.slang.expected.txt b/tests/ir/loop-unroll-2.slang.expected.txt new file mode 100644 index 000000000..e20d75ba3 --- /dev/null +++ b/tests/ir/loop-unroll-2.slang.expected.txt @@ -0,0 +1,4 @@ +6 +0 +0 +0 |
