From 884a9bcafc5fb9ae47245fa3ea9a6e64cb65a482 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 20 Mar 2020 16:59:15 -0400 Subject: Handling of switch with empty body (#1284) * Added handling for empty switch body. Added test for empty switch. * Fix testing for case in switch. --- tests/bugs/empty-switch.slang | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/bugs/empty-switch.slang (limited to 'tests/bugs/empty-switch.slang') diff --git a/tests/bugs/empty-switch.slang b/tests/bugs/empty-switch.slang new file mode 100644 index 000000000..104c63367 --- /dev/null +++ b/tests/bugs/empty-switch.slang @@ -0,0 +1,29 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -slang -compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = int(dispatchThreadID.x); + + int a = index; + + // This is kind of silly - but it is a valid construct. + // We want to check condition expression is executed though + switch (++a) + { + } + + switch (index) + { + // This should not be executed + a += 10; + } + + outputBuffer[index] = a; +} \ No newline at end of file -- cgit v1.2.3