summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-02-20 16:34:59 -0500
committerYong He <yonghe@outlook.com>2018-02-20 16:34:59 -0500
commit61a6d18c4870eb55b804d36a30608a34c55e801d (patch)
treed2b5f7c7da2d6a9065a9b2d59f79d0c1cab7f436 /source/slang/emit.cpp
parent5de62bbe4dddc64895ddb17c4eb3572c3c9be248 (diff)
make CompileRequest retain specailized IR module.
This is to workaround with the issue that the Types returned in ProgramLayout may reference to IRWitnessTables via GlobalGenericParamSubstitution.
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 46c0b20a9..d2ed1c7c3 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -8158,6 +8158,10 @@ String emitEntryPoint(
// TODO: do we want to emit directly from IR, or translate the
// IR back into AST for emission?
visitor.emitIRModule(&context, irModule);
+
+ // retain the specialized ir module, because the current
+ // GlobalGenericParamSubstitution implementation may reference ir objects
+ targetRequest->compileRequest->compiledModules.Add(irModule);
}
destroyIRSpecializationState(irSpecializationState);
@@ -8167,8 +8171,6 @@ String emitEntryPoint(
// Now that we've emitted the code for all the declaratiosn in the file,
// it is time to stich together the final output.
-
-
// There may be global-scope modifiers that we should emit now
visitor.emitGLSLPreprocessorDirectives(translationUnitSyntax);
String prefix = sharedContext.sb.ProduceString();