summaryrefslogtreecommitdiff
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-11-14 17:46:05 -0800
committerGitHub <noreply@github.com>2023-11-14 17:46:05 -0800
commit12f7237e4060388494c549623f4a640327b7ca08 (patch)
tree407c0f8d20b4ccd49ae5df57f84c8f9a310f7055 /source/slang/slang-options.cpp
parentc71b12775c8b13ea2b181e42c04b8db55b10fb2f (diff)
Add GLSL Compatibility. (#3321)
* Parse glsl buffer blocks to GLSLInterfaceBlockDecl * Parse glsl local size layout declarations * Parse (and ignore) glsl version directives * spelling * Better l-value interpretation for glsl interface blocks * Better l-value interpretation for glsl interface blocks * Add compile flag for enabling glsl * Parse and ignore precision modifiers. * Automatically import `glsl` module for compatiblity. * Complete vector and matrix types for glsl * Remove generated file from repo * Bump .gitignore * do not mark out globals as params * Synthesize entrypoint layout from global inout vars. * update test result. * Allow HLSL semantic on global variables. * Fix. * Fix test. * Fix win32 compile error. * Add more builtin input/output and texture intrinsics. * Add struct/array constructor syntax. * Skip `#extension` lines. * overide operator * for matrix/vector multiplication. * Add `matrixCompMult`. * Parse modifiers in for loop init var declr. * Add more glsl intrinsics, add stage into to var layout. * Allow `int[3] x` syntax. * Fix array type syntax. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 67f95df1e..1c1ad8f1c 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -141,6 +141,7 @@ enum class OptionKind
FileSystem,
Heterogeneous,
NoMangle,
+ AllowGLSL,
// Internal
@@ -621,7 +622,8 @@ void initCommandOptions(CommandOptions& options)
{ OptionKind::FileSystem, "-file-system", "-file-system <file-system-type>",
"Set the filesystem hook to use for a compile request."},
{ OptionKind::Heterogeneous, "-heterogeneous", nullptr, "Output heterogeneity-related code." },
- { OptionKind::NoMangle, "-no-mangle", nullptr, "Do as little mangling of names as possible." }
+ { OptionKind::NoMangle, "-no-mangle", nullptr, "Do as little mangling of names as possible." },
+ { OptionKind::AllowGLSL, "-allow-glsl", nullptr, "Enable GLSL as an input language." },
};
_addOptions(makeConstArrayView(experimentalOpts), options);
@@ -912,6 +914,8 @@ struct OptionsParser
String m_spirvCoreGrammarJSONPath;
+ bool m_allowGLSLInput = false;
+
CommandLineReader m_reader;
CommandOptionsWriter::Style m_helpStyle = CommandOptionsWriter::Style::Text;
@@ -1812,6 +1816,7 @@ SlangResult OptionsParser::_parse(
switch (optionKind)
{
case OptionKind::NoMangle: m_flags |= SLANG_COMPILE_FLAG_NO_MANGLING; break;
+ case OptionKind::AllowGLSL: m_allowGLSLInput = true; break;
case OptionKind::EmitIr: m_requestImpl->m_emitIr = true; break;
case OptionKind::LoadStdLib:
{
@@ -2152,7 +2157,7 @@ SlangResult OptionsParser::_parse(
m_compileRequest->setEnableEffectAnnotations(true);
break;
}
-
+
case OptionKind::EntryPointName:
{
CommandLineArg name;
@@ -2482,6 +2487,8 @@ SlangResult OptionsParser::_parse(
m_compileRequest->setCompileFlags(m_flags);
+ m_compileRequest->setAllowGLSLInput(m_allowGLSLInput);
+
// As a compatability feature, if the user didn't list any explicit entry
// point names, *and* they are compiling a single translation unit, *and* they
// have either specified a stage, or we can assume one from the naming