diff options
| author | cheneym2 <acheney@nvidia.com> | 2025-03-11 14:12:33 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-11 11:12:33 -0700 |
| commit | 5d6578b9d58d7ad46503d9124cccf8a68ecd5902 (patch) | |
| tree | 4582cea2e4f47d63b39c2afc34c7497fc54c8bf5 /source/slang/slang-compiler-tu.cpp | |
| parent | f59e0ef409844f2514435a8df8ceeff3663e5db3 (diff) | |
Don't crash when precompiling twice (#6576)
Abort precompileForTarget if it's already done.
Fixes #6516
Diffstat (limited to 'source/slang/slang-compiler-tu.cpp')
| -rw-r--r-- | source/slang/slang-compiler-tu.cpp | 12 |
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); |
