From 21693abbd0579107e3c03d1e5090b2653722b5de Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:51:12 -0700 Subject: 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. --- source/slang/slang-ir-insert-debug-value-store.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source') 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(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(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(param->getDataType())) + } + else if (as(param->getDataType()) || as(param->getDataType())) + { paramVal = builder.emitLoad(param); + } + if (paramVal) { builder.emitDebugValue(debugVar, paramVal); -- cgit v1.2.3