summaryrefslogtreecommitdiff
path: root/tests/hlsl-intrinsic/debug-break.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-02-14 16:21:07 -0500
committerGitHub <noreply@github.com>2023-02-14 13:21:07 -0800
commitb92a75db2aab1adffe08ae0103cafb080f9795e2 (patch)
treef8d27bcd76a78f5d66e40a2f2f970b0335b74e97 /tests/hlsl-intrinsic/debug-break.slang
parentec49215d711fff9356663390a31182e811e27467 (diff)
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
Diffstat (limited to 'tests/hlsl-intrinsic/debug-break.slang')
-rw-r--r--tests/hlsl-intrinsic/debug-break.slang23
1 files changed, 23 insertions, 0 deletions
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<int> 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