summaryrefslogtreecommitdiff
path: root/source/slang/slang-legalize-types.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-04-02 12:34:58 -0500
committerGitHub <noreply@github.com>2025-04-02 10:34:58 -0700
commitc1f69ca1e29811919dbd2f08a6e2dd498b80aab2 (patch)
tree7e41262b8bd04ebd38d388cf84ba45553db44d4d /source/slang/slang-legalize-types.cpp
parente44479c88806a711f6d5f821a4acff030f9a558b (diff)
Metal remove void field (#6725)
* Reapply "Eliminate empty struct on metal target (#6603)" (#6711) This reverts commit bc9dc6557fc0cc3a4c0c2ff27e636940e361cf5d. * Remove argument in make_struct call corresponding to void field This is a follow-up of #6543, where we leave the VoidType field as it in make_struct call during legalization pass. So during cleaning_void IR pass, when we remove "VoidType" from struct, we will have to also clean up the argument corresponding to the "VoidType" field.
Diffstat (limited to 'source/slang/slang-legalize-types.cpp')
-rw-r--r--source/slang/slang-legalize-types.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/slang/slang-legalize-types.cpp b/source/slang/slang-legalize-types.cpp
index e26475522..cc2c12d42 100644
--- a/source/slang/slang-legalize-types.cpp
+++ b/source/slang/slang-legalize-types.cpp
@@ -1211,11 +1211,15 @@ LegalType legalizeTypeImpl(TypeLegalizationContext* context, IRType* type)
LegalType legalElementType;
if (isMetalTarget(context->targetProgram->getTargetReq()) &&
- as<IRParameterBlockType>(uniformBufferType))
+ as<IRParameterBlockType>(uniformBufferType) &&
+ !context->shouldLegalizeParameterBlockElementType())
{
// On Metal, we do not need to legalize the element type of
// a parameter block because we can translate it directly into
// an argument buffer.
+ //
+ // But we do need empty type legalized for Metal, because Metal doesn't
+ // allow empty struct in argument buffer.
legalElementType = LegalType::simple(originalElementType);
}
else