From 769c7fdd19ea579770baac7b6d5e16d6406a8013 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 22 Jun 2023 15:07:31 -0400 Subject: [branch] and [flatten] support (#2928) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes and improvements around reflection tool. * Make PrettyWriter printing a class. * Add HLSL output support for [flatten] and [branch] * Handle [branch] on switch. --- tests/bugs/branch-switch-attribute.slang | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/bugs/branch-switch-attribute.slang (limited to 'tests/bugs/branch-switch-attribute.slang') diff --git a/tests/bugs/branch-switch-attribute.slang b/tests/bugs/branch-switch-attribute.slang new file mode 100644 index 000000000..761b80e9e --- /dev/null +++ b/tests/bugs/branch-switch-attribute.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile cs_5_0 -entry computeMain + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer outputBuffer; + +// CHECK: [branch] + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = dispatchThreadID.x; + + int v = idx; + + [branch] + switch (idx) + { + case 0: v ++; break; + case 2: v -= 7; break; + default: v--; + } + + outputBuffer[dispatchThreadID.x] = v; +} \ No newline at end of file -- cgit v1.2.3