summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index af870d02b..74b11079d 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -849,7 +849,13 @@ SlangResult emitEntryPointsSourceFromIR(
}
// There may be global-scope modifiers that we should emit now
+ // Supress emitting line directives when emitting preprocessor directives since
+ // these preprocessor directives may be required to appear in the first line
+ // of the output. An example is that the "#version" line in a GLSL source must
+ // appear before anything else.
+ sourceWriter.supressLineDirective();
sourceEmitter->emitPreprocessorDirectives();
+ sourceWriter.resumeLineDirective();
RefObject* extensionTracker = sourceEmitter->getExtensionTracker();