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-emit.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-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 841f44a80..8d7577b52 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -1278,6 +1278,15 @@ Result linkAndOptimizeIR( // legalizeResourceTypes(targetProgram, irModule, sink); + // We also need to legalize empty types for Metal targets. + switch (target) + { + case CodeGenTarget::Metal: + case CodeGenTarget::MetalLib: + case CodeGenTarget::MetalLibAssembly: + legalizeEmptyTypes(targetProgram, irModule, sink); + break; + } // Debugging output of legalization #if 0 dumpIRIfEnabled(codeGenContext, irModule, "LEGALIZED"); |
