summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-11-14 12:06:17 -0500
committerGitHub <noreply@github.com>2024-11-14 12:06:17 -0500
commit147ceb1991454b7a5ba6f3ec0c149dd40360a31d (patch)
treef290109f71a4cca9337537ddb42a58ba1fcd6d94 /source/slang/slang-emit.cpp
parente58ba6b23cb3ee04d69452bfe7e1f8274956ce7d (diff)
Fix issue with raw default constructors in SPIRV emit (#5556)
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