diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-09-02 12:51:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-02 12:51:12 -0700 |
| commit | 21693abbd0579107e3c03d1e5090b2653722b5de (patch) | |
| tree | d533198d4ae4096543e31f39b8f2765d4b431522 /source/slang | |
| parent | b46f46c5e8603fdafca258028227adf25f95807f (diff) | |
Emit DebugInfo for the legalized entry point parameters (#7703)
This commit is to emit the debug-info for the entry point parameters.
Two things are implemented/fixed in this PR:
- We were not emitting the `DebugVar` and `DebugValue` at the IR
lowering level when the type of the entry point parameter is `ConstRef`.
This commit handles the `ConstRef` case in a same way that the other
types are handled so that `DebugVar` and `DebugValues` are properly
emitted at the IR lowering level.
- Two types for Geometry shaders were incorrectly treated as not valid
types for the DebugInfo. They are `InputPatch` and `OutputPatch`. This
commit handles them as valid types for DebugInfo.
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/slang-ir-insert-debug-value-store.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/slang/slang-ir-insert-debug-value-store.cpp b/source/slang/slang-ir-insert-debug-value-store.cpp index 86ad377a2..25b9c03fa 100644 --- a/source/slang/slang-ir-insert-debug-value-store.cpp +++ b/source/slang/slang-ir-insert-debug-value-store.cpp @@ -51,6 +51,14 @@ bool DebugValueStoreContext::isDebuggableType(IRType* type) debuggable = isDebuggableType(arrayType->getElementType()); break; } + case kIROp_HLSLInputPatchType: + case kIROp_HLSLOutputPatchType: + case kIROp_HLSLTriangleStreamType: + { + auto elementType = as<IRType>(type->getOperand(0)); + debuggable = isDebuggableType(elementType); + break; + } case kIROp_VectorType: case kIROp_MatrixType: case kIROp_PtrType: @@ -115,6 +123,11 @@ void DebugValueStoreContext::insertDebugValueStore(IRFunc* func) isRefParam = true; paramType = outType->getValueType(); } + else if (auto ptrType = as<IRConstRefType>(param->getDataType())) + { + isRefParam = true; + paramType = ptrType->getValueType(); + } if (!isDebuggableType(paramType)) continue; auto debugVar = builder.emitDebugVar( @@ -130,9 +143,14 @@ void DebugValueStoreContext::insertDebugValueStore(IRFunc* func) // Store the initial value of the parameter into the debug var. IRInst* paramVal = nullptr; if (!isRefParam) + { paramVal = param; - else if (as<IRInOutType>(param->getDataType())) + } + else if (as<IRInOutType>(param->getDataType()) || as<IRConstRefType>(param->getDataType())) + { paramVal = builder.emitLoad(param); + } + if (paramVal) { builder.emitDebugValue(debugVar, paramVal); |
