You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement DebugBreak and IsDebuggerPresent (#8106)
## Add `DebugBreak()` and `dx::IsDebuggerPresent()` intrinsics for
shader debugging
### Description
This PR adds two new intrinsics for shader debugging in experimental
Shader Model 6.10:
- **`DebugBreak()`** - Triggers a breakpoint if a debugger is attached
- **`dx::IsDebuggerPresent()`** - Returns `true` if a debugger is
attached
### Changes
**HLSL Intrinsic Definitions:**
- Added `DebugBreak()` to the base `Intrinsics` namespace in
`gen_intrin_main.txt`
- Added `IsDebuggerPresent()` to the `DxIntrinsics` namespace
- Both require minimum shader model 6.10
**DXIL Operations:**
- Added `DebugBreak` and `IsDebuggerPresent` DXIL opcodes in `hctdb.py`
- `DebugBreak`: void return, no overload
- `IsDebuggerPresent`: i1 (bool) return, no overload
**Code Generation:**
- Added HLSL to DXIL lowering in `HLOperationLower.cpp`
- Added `LICOMPTYPE_BOOL` handling in `SemaHLSL.cpp` for `dx::`
namespace intrinsic type resolution
**SPIR-V Support:**
- `DebugBreak()` emits `NonSemantic.DebugBreak` extended instruction
- Added `SPV_KHR_non_semantic_info` extension enablement in
`CapabilityVisitor.cpp`
- `dx::IsDebuggerPresent()` produces an error (no Vulkan equivalent)
**Tests:**
- `debugbreak.hlsl` - DXIL codegen test
- `debugbreak_sm69_error.hlsl` - Shader model version error test
- `isdebugerpresent.hlsl` - DXIL codegen test
- `intrinsics.debugbreak.hlsl` - SPIR-V codegen test
- `intrinsics.isdebugerpresent.error.hlsl` - SPIR-V unsupported error
test
### Related
https://github.com/microsoft/hlsl-specs/blob/main/proposals/0039-debugbreak.md
0 commit comments