diff options
| author | Yong He <yonghe@outlook.com> | 2025-10-09 23:27:57 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 06:27:57 +0000 |
| commit | cd50974490b82dd7e0f9ac0dd5ce9c17e390ff1f (patch) | |
| tree | 3206340b7c970e2d50f36c91af858c5277a17427 /source/slang/slang-ir-strip.cpp | |
| parent | a3372605363cfe511b5248cb1393f59b25cb2483 (diff) | |
Update debug var when in-param proxy var is being updated. (#8671)
Closes #8664.
The problem is that when there is an `in` parameter, Slang will create a
local variable to proxy the parameter, copy the value of the parameter
into the proxy variable, and replace all uses of the parameter in the
function body to use the proxy variable instead. This way all writes to
the parameter become writes to the proxy variable.
However, when there is debug info enabled, we are also going to create a
"debugVariable" corresponding to the parameter, but this debugVariable
isn't updated when the proxy variable is updated. The fix is to map the
proxy var instead of the original param to the debug var during the
`insertDebugValueStore` pass, so that any changes to the proxy var will
result in additional stores being inserted to the debug var.
Allowing function body to modify an `in` parameter is a bad legacy
behavior we inherited from HLSL that we should really be moving away
from. I would like us to completely treat an `in` parameter as immutable
by default in the next language version (Slang 2026), and make it an
error if the user tries to do so. This will allow us to generate much
cleaner code and in many cases would help with performance.
Diffstat (limited to 'source/slang/slang-ir-strip.cpp')
| -rw-r--r-- | source/slang/slang-ir-strip.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/slang/slang-ir-strip.cpp b/source/slang/slang-ir-strip.cpp index 6c64bfca2..85fd2da2b 100644 --- a/source/slang/slang-ir-strip.cpp +++ b/source/slang/slang-ir-strip.cpp @@ -16,6 +16,7 @@ static bool _shouldStripInst(IRInst* inst, IRStripOptions const& options) return false; case kIROp_HighLevelDeclDecoration: + case kIROp_InParamProxyVarDecoration: return true; case kIROp_NameHintDecoration: |
