diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-06 10:07:02 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-06 10:07:02 -0800 |
| commit | e893a831d7f64eb52e76df087190247f43b150ae (patch) | |
| tree | 1cf91d943741ed25ad057a1bf34f47ee03b5229b /tests/bugs | |
| parent | a12c5511a9003efb23b265a7f2f613cf49aa9f07 (diff) | |
Fix crash when processing nested switch. (#2624)
* Fix crash when processing nested switch.
* Clean up.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/nested-switch.slang | 37 | ||||
| -rw-r--r-- | tests/bugs/nested-switch.slang.expected.txt | 4 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/bugs/nested-switch.slang b/tests/bugs/nested-switch.slang new file mode 100644 index 000000000..3cfc0758b --- /dev/null +++ b/tests/bugs/nested-switch.slang @@ -0,0 +1,37 @@ +// nested-switch.slang + +//TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE:-vk -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj + +int test(int t, int r) +{ + int result = 0; + switch (t) + { + case 0: + switch (r) + { + case 0: + return 1; + case 2: + return 2; + } + default: + result = 3; + break; + } + return result; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + outputBuffer[0] = test(dispatchThreadID.x, 0); + outputBuffer[1] = test(dispatchThreadID.x, 1); + outputBuffer[2] = test(dispatchThreadID.x, 2); + outputBuffer[3] = 0; +} diff --git a/tests/bugs/nested-switch.slang.expected.txt b/tests/bugs/nested-switch.slang.expected.txt new file mode 100644 index 000000000..e5716bdfa --- /dev/null +++ b/tests/bugs/nested-switch.slang.expected.txt @@ -0,0 +1,4 @@ +1 +3 +2 +0 |
