From d7e2bac2df176af4cd3955e6df02e2ddcbc059d8 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Wed, 13 Aug 2025 08:37:22 -0700 Subject: Remove the semantic decoration from the original entry struct (#8146) When we legalize the entry point param, there are cases where we need to reconstruct a struct for the parameter and the original struct wouldn't be used. But if the user tries to use the origianl struct as a type for a function parameter, we will end up using both the original struct and the synthesized struct at the same time. On Metal and WGSL, it causes an error when an identical semtaic is used on more than one variable. This commit removes the semantics from the original struct after cloning the type. Fixes https://github.com/shader-slang/slang/issues/8141 Related to https://github.com/shader-slang/slang/issues/7693 --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --- source/slang/slang-ir-legalize-varying-params.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/slang') diff --git a/source/slang/slang-ir-legalize-varying-params.cpp b/source/slang/slang-ir-legalize-varying-params.cpp index ca65a37c1..bd1648513 100644 --- a/source/slang/slang-ir-legalize-varying-params.cpp +++ b/source/slang/slang-ir-legalize-varying-params.cpp @@ -1908,6 +1908,9 @@ private: field->getKey(), fieldParam); + // Remove the sementic info from the original struct + semanticInfoToRemove.add(field); + IRVarLayout* fieldLayout = structTypeLayout ? structTypeLayout->getFieldLayout(fieldIndex) : nullptr; if (varLayout) -- cgit v1.2.3