summaryrefslogtreecommitdiff
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index a1235f03a..49eaf917b 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -4,9 +4,12 @@
#include "../core/slang-writer.h"
#include "ir-dce.h"
#include "ir-existential.h"
+#include "ir-glsl-legalize.h"
#include "ir-insts.h"
+#include "ir-link.h"
#include "ir-restructure.h"
#include "ir-restructure-scoping.h"
+#include "ir-specialize.h"
#include "ir-specialize-resources.h"
#include "ir-ssa.h"
#include "ir-validate.h"
@@ -6517,10 +6520,9 @@ String emitEntryPoint(
session,
irModule);
- specializeIRForEntryPoint(
+ auto irEntryPoint = specializeIRForEntryPoint(
irSpecializationState,
- entryPoint,
- &sharedContext.extensionUsageTracker);
+ entryPoint);
#if 0
dumpIRIfEnabled(compileRequest, irModule, "CLONED");
@@ -6533,6 +6535,38 @@ String emitEntryPoint(
// un-specialized IR.
dumpIRIfEnabled(compileRequest, irModule);
+
+
+ // For GLSL only, we will need to perform "legalization" of
+ // the entry point and any entry-point parameters.
+ //
+ // TODO: We should consider moving this legalization work
+ // as late as possible, so that it doesn't affect how other
+ // optimization passes need to work.
+ //
+ switch (target)
+ {
+ case CodeGenTarget::GLSL:
+ {
+ legalizeEntryPointForGLSL(
+ session,
+ irModule,
+ irEntryPoint,
+ &compileRequest->mSink,
+ &sharedContext.extensionUsageTracker);
+ }
+ break;
+
+ default:
+ break;
+ }
+#if 0
+ dumpIRIfEnabled(compileRequest, irModule, "GLSL LEGALIZED");
+#endif
+ validateIRModuleIfEnabled(compileRequest, irModule);
+
+
+
// Any code that makes use of existential (interface) types
// needs to be simplified to use concrete types instead,
// wherever this is possible.
@@ -6559,7 +6593,7 @@ String emitEntryPoint(
// none of our target supports generics, or interfaces,
// so we need to specialize those away.
//
- specializeGenerics(irModule, sharedContext.target);
+ specializeGenerics(irModule);