From b92a75db2aab1adffe08ae0103cafb080f9795e2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 14 Feb 2023 16:21:07 -0500 Subject: Preliminary debugBreak support (#2647) * #include an absolute path didn't work - because paths were taken to always be relative. * Preliminary support for debug break. * Add C++ debug break support. Add details about usage. * Improve debug break test details. * Make HLSL output a comment about no support. * Handle specialize for target assert, without a body if it has spv_instruction/target intrinsic --- tests/hlsl-intrinsic/debug-break.slang | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/hlsl-intrinsic/debug-break.slang (limited to 'tests/hlsl-intrinsic/debug-break.slang') diff --git a/tests/hlsl-intrinsic/debug-break.slang b/tests/hlsl-intrinsic/debug-break.slang new file mode 100644 index 000000000..e46c42004 --- /dev/null +++ b/tests/hlsl-intrinsic/debug-break.slang @@ -0,0 +1,23 @@ +//TEST:SIMPLE:-stage compute -entry computeMain -target glsl -line-directive-mode none +// We can't enable because output source includes path to prelude. +//DISABLE_TEST:SIMPLE:-stage compute -entry computeMain -target cpp -line-directive-mode none +//DISABLE_TEST:SIMPLE:-stage compute -entry computeMain -target cuda -line-directive-mode none +// Not currently supported on HLSL +//DISABLE_TEST:SIMPLE:-stage compute -entry computeMain -target hlsl -line-directive-mode none +// With `slang-llvm` this will crash, but the call stack isn't really usable. +// With downstream host compilers this should break into the debugger. It's not enabled as that isn't testable. +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -Xslang... -O0 -g -X. + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer + +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + const int idx = int(dispatchThreadID.x); + + debugBreak(); + + outputBuffer[idx] = idx; +} \ No newline at end of file -- cgit v1.2.3