summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp14
1 files changed, 14 insertions, 0 deletions
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