diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-02-14 16:21:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-14 13:21:07 -0800 |
| commit | b92a75db2aab1adffe08ae0103cafb080f9795e2 (patch) | |
| tree | f8d27bcd76a78f5d66e40a2f2f970b0335b74e97 /tests | |
| parent | ec49215d711fff9356663390a31182e811e27467 (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')
| -rw-r--r-- | tests/hlsl-intrinsic/debug-break.slang | 23 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/debug-break.slang.expected | 24 |
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; +} + +} |
