Implement DebugBreak and IsDebuggerPresent#8106
Merged
JoeCitizen merged 13 commits intomicrosoft:mainfrom Feb 3, 2026
Merged
Conversation
Contributor
|
✅ With the latest revision this PR passed the Python code formatter. |
bob80905
reviewed
Jan 28, 2026
tools/clang/test/HLSLFileCheckLit/hlsl/intrinsics/basic/isdebugerpresent.hlsl
Outdated
Show resolved
Hide resolved
damyanp
reviewed
Jan 28, 2026
alsepkow
reviewed
Jan 29, 2026
alsepkow
reviewed
Jan 30, 2026
alsepkow
reviewed
Jan 30, 2026
| break; | ||
| case hlsl::IntrinsicOp::IOP_DebugBreak: | ||
| retVal = spvBuilder.createNonSemanticDebugBreakExtInst(srcLoc); | ||
| break; |
Contributor
There was a problem hiding this comment.
Is the ordering of the cases arbitrary?
tex3d
reviewed
Jan 30, 2026
Contributor
tex3d
left a comment
There was a problem hiding this comment.
In intrinsic tests, we should add run lines and checks for -fcgl and -ast-dump. We also need lowering tests (dxilgen pass).
As pointed out in another comment, the opcodes should be in the IR checks, and updated when we move the ops to release. We should include the full arg list in those CHECKs (to verify all expected arguments - just the opcode in this case).
tools/clang/test/CodeGenSPIRV/intrinsics.isdebugerpresent.error.hlsl
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
DebugBreak()anddx::IsDebuggerPresent()intrinsics for shader debuggingDescription
This PR adds two new intrinsics for shader debugging in experimental Shader Model 6.10:
DebugBreak()- Triggers a breakpoint if a debugger is attacheddx::IsDebuggerPresent()- Returnstrueif a debugger is attachedChanges
HLSL Intrinsic Definitions:
DebugBreak()to the baseIntrinsicsnamespace ingen_intrin_main.txtIsDebuggerPresent()to theDxIntrinsicsnamespaceDXIL Operations:
DebugBreakandIsDebuggerPresentDXIL opcodes inhctdb.pyDebugBreak: void return, no overloadIsDebuggerPresent: i1 (bool) return, no overloadCode Generation:
HLOperationLower.cppLICOMPTYPE_BOOLhandling inSemaHLSL.cppfordx::namespace intrinsic type resolutionSPIR-V Support:
DebugBreak()emitsNonSemantic.DebugBreakextended instructionSPV_KHR_non_semantic_infoextension enablement inCapabilityVisitor.cppdx::IsDebuggerPresent()produces an error (no Vulkan equivalent)Tests:
debugbreak.hlsl- DXIL codegen testdebugbreak_sm69_error.hlsl- Shader model version error testisdebugerpresent.hlsl- DXIL codegen testintrinsics.debugbreak.hlsl- SPIR-V codegen testintrinsics.isdebugerpresent.error.hlsl- SPIR-V unsupported error testRelated
https://github.com/microsoft/hlsl-specs/blob/main/proposals/0039-debugbreak.md