From a2d2018a8be41aecd2c1810db8556e0c07595fb9 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 31 Jan 2024 23:53:28 -0800 Subject: 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 --- source/slang/slang-check-modifier.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-modifier.cpp') diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp index 96ec0acc8..1a7f64944 100644 --- a/source/slang/slang-check-modifier.cpp +++ b/source/slang/slang-check-modifier.cpp @@ -1125,7 +1125,11 @@ namespace Slang if (auto decl = as(syntaxNode)) { - if (!isModifierAllowedOnDecl(getLinkage()->getAllowGLSLInput(), m->astNodeType, decl)) + auto moduleDecl = getModuleDecl(decl); + bool isGLSLInput = getLinkage()->getAllowGLSLInput(); + if (!isGLSLInput && moduleDecl && moduleDecl->findModifier()) + isGLSLInput = true; + if (!isModifierAllowedOnDecl(isGLSLInput, m->astNodeType, decl)) { getSink()->diagnose(m, Diagnostics::modifierNotAllowed, m); return m; -- cgit v1.2.3