summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-01-31 23:53:28 -0800
committerGitHub <noreply@github.com>2024-02-01 15:53:28 +0800
commita2d2018a8be41aecd2c1810db8556e0c07595fb9 (patch)
tree747494c7c56cc50a47eca57dbcc200ebf6280b36 /source/slang/slang-parser.cpp
parent2d0912bfe2de7799b32e80722fa5c8dc279a339b (diff)
Add slangc option to specialize entrypoint + auto glsl mode. (#3531)
* Add slangc option to specialize entrypoint. * Auto enable glsl mode when input file has glsl extension name. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index f5312e645..a086b3c7a 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -4650,6 +4650,8 @@ namespace Slang
importDecl->scope = currentScope;
AddMember(currentScope, importDecl);
}
+ auto glslModuleModifier = astBuilder->create<GLSLModuleModifier>();
+ addModifier(currentModule, glslModuleModifier);
}
parseDecls(this, program, MatchedTokenType::File);
@@ -7360,7 +7362,8 @@ namespace Slang
{
ParserOptions options = {};
options.enableEffectAnnotations = translationUnit->compileRequest->getLinkage()->getEnableEffectAnnotations();
- options.allowGLSLInput = translationUnit->compileRequest->getLinkage()->getAllowGLSLInput();
+ options.allowGLSLInput = translationUnit->compileRequest->getLinkage()->getAllowGLSLInput() ||
+ translationUnit->sourceLanguage == SourceLanguage::GLSL;
options.isInLanguageServer = translationUnit->compileRequest->getLinkage()->isInLanguageServer();
Parser parser(astBuilder, tokens, sink, outerScope, options);