summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-compiler-tu.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-compiler-tu.cpp b/source/slang/slang-compiler-tu.cpp
index 8bfe9a9ab..f82e50347 100644
--- a/source/slang/slang-compiler-tu.cpp
+++ b/source/slang/slang-compiler-tu.cpp
@@ -95,6 +95,18 @@ Module::precompileForTarget(SlangCompileTarget target, slang::IBlob** outDiagnos
{
CodeGenTarget targetEnum = CodeGenTarget(target);
+ // Don't precompile twice for the same target
+ for (auto globalInst : getIRModule()->getModuleInst()->getChildren())
+ {
+ if (auto inst = as<IREmbeddedDownstreamIR>(globalInst))
+ {
+ if (inst->getTarget() == targetEnum)
+ {
+ return SLANG_OK;
+ }
+ }
+ }
+
auto module = getIRModule();
auto linkage = getLinkage();
auto builder = IRBuilder(module);