diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/switch-stmt.slang | 43 | ||||
| -rw-r--r-- | tests/compute/switch-stmt.slang.1.expected.txt | 8 | ||||
| -rw-r--r-- | tests/compute/switch-stmt.slang.expected.txt | 8 |
3 files changed, 59 insertions, 0 deletions
diff --git a/tests/compute/switch-stmt.slang b/tests/compute/switch-stmt.slang new file mode 100644 index 000000000..3e352eb57 --- /dev/null +++ b/tests/compute/switch-stmt.slang @@ -0,0 +1,43 @@ +//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST(compute):COMPARE_COMPUTE: +//TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7], stride=4):dxbinding(0),glbinding(0),out + +// Test that `swith` statement works + +int test(int inVal) +{ + int result = inVal; + switch(inVal) + { + case 0: + result = 16; + break; + + case 2: + case 5: + result = inVal + 16; + break; + + case 4: + {} + break; + + default: + case 3: + result = 0; + break; + } + + return result; +} + +RWStructuredBuffer<int> outputBuffer : register(u0); + +[numthreads(8, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int inVal = outputBuffer[tid]; + int outVal = test(inVal); + outputBuffer[tid] = outVal; +}
\ No newline at end of file diff --git a/tests/compute/switch-stmt.slang.1.expected.txt b/tests/compute/switch-stmt.slang.1.expected.txt new file mode 100644 index 000000000..6b0f2293b --- /dev/null +++ b/tests/compute/switch-stmt.slang.1.expected.txt @@ -0,0 +1,8 @@ +10 +0 +12 +0 +4 +15 +0 +0 diff --git a/tests/compute/switch-stmt.slang.expected.txt b/tests/compute/switch-stmt.slang.expected.txt new file mode 100644 index 000000000..6b0f2293b --- /dev/null +++ b/tests/compute/switch-stmt.slang.expected.txt @@ -0,0 +1,8 @@ +10 +0 +12 +0 +4 +15 +0 +0 |
