From b3deec2001ea34e20e9a6af8ddf5cf3866cafac0 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Wed, 26 Mar 2025 14:42:30 -0500 Subject: 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 --- source/slang/slang-emit.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/slang-emit.cpp') 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"); -- cgit v1.2.3