diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-03-26 14:42:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-26 12:42:30 -0700 |
| commit | b3deec2001ea34e20e9a6af8ddf5cf3866cafac0 (patch) | |
| tree | 68052183f6c2d3b610a34027e5911113c1506414 /source/slang/slang-ir-legalize-types.cpp | |
| parent | 05f24d294917a2599d635fe2e53b75cdca26cfdd (diff) | |
Eliminate empty struct on metal target (#6603)
* Eliminate empty struct on metal target
Close 6573.
We previously disabled the type legalization for ParameterBlock on
Metal, but Metal doesn't allow empty struct in the argument buffer
which is mapped from ParameterBlock, so we will need legalizeEmptyTypes
on Metal target.
* update test
* update function name
Diffstat (limited to 'source/slang/slang-ir-legalize-types.cpp')
| -rw-r--r-- | source/slang/slang-ir-legalize-types.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp index 197cd93c5..837193abc 100644 --- a/source/slang/slang-ir-legalize-types.cpp +++ b/source/slang/slang-ir-legalize-types.cpp @@ -4123,6 +4123,11 @@ struct IREmptyTypeLegalizationContext : IRTypeLegalizationContext bool isSimpleType(IRType* type) override { + if (isMetalTarget(targetProgram->getTargetReq())) + { + return false; + } + // If type is used as public interface, then treat it as simple. for (auto decor : type->getDecorations()) { @@ -4145,6 +4150,11 @@ struct IREmptyTypeLegalizationContext : IRTypeLegalizationContext { return LegalType(); } + + virtual bool shouldLegalizeParameterBlockElementType() override + { + return isMetalTarget(targetProgram->getTargetReq()); + } }; // The main entry points that are used when transforming IR code |
