summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl-intrinsic/debug-break.slang23
-rw-r--r--tests/hlsl-intrinsic/debug-break.slang.expected24
2 files changed, 47 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
diff --git a/tests/hlsl-intrinsic/debug-break.slang.expected b/tests/hlsl-intrinsic/debug-break.slang.expected
new file mode 100644
index 000000000..fbd1faa9b
--- /dev/null
+++ b/tests/hlsl-intrinsic/debug-break.slang.expected
@@ -0,0 +1,24 @@
+result code = 0
+standard error = {
+}
+standard output = {
+#version 450
+#extension GL_EXT_spirv_intrinsics : require
+layout(row_major) uniform;
+layout(row_major) buffer;
+spirv_instruction(id = 1, set = "NonSemantic.DebugBreak")
+void debugBreak_0();
+
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
+layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
+void main()
+{
+ int idx_0 = int(gl_GlobalInvocationID.x);
+ debugBreak_0();
+ ((outputBuffer_0)._data[(uint(idx_0))]) = idx_0;
+ return;
+}
+
+}