From 147ceb1991454b7a5ba6f3ec0c149dd40360a31d Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:06:17 -0500 Subject: Fix issue with raw default constructors in SPIRV emit (#5556) --- source/slang/slang-emit.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 05bb12ecc..010b4bc92 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -89,6 +89,7 @@ #include "slang-ir-ssa.h" #include "slang-ir-string-hash.h" #include "slang-ir-strip-cached-dict.h" +#include "slang-ir-strip-default-construct.h" #include "slang-ir-strip-witness-tables.h" #include "slang-ir-strip.h" #include "slang-ir-synthesize-active-mask.h" @@ -1419,6 +1420,19 @@ Result linkAndOptimizeIR( // we will need to disable this pass. stripWitnessTables(irModule); + switch (target) + { + // On targets that don't support default initialization, remove 'raw' default construct + // insts because our code-gen will not have any way to emit them. + // + case CodeGenTarget::SPIRV: + if (targetProgram->shouldEmitSPIRVDirectly()) + removeRawDefaultConstructors(irModule); + break; + default: + break; + } + #if 0 dumpIRIfEnabled(codeGenContext, irModule, "AFTER STRIP WITNESS TABLES"); #endif -- cgit v1.2.3