summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-compiler.cpp')
-rw-r--r--source/slang/slang-compiler.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index a5c078dc4..64be1505e 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -460,6 +460,32 @@ namespace Slang
}
}
+ static const struct
+ {
+ char const* name;
+ SourceLanguage sourceLanguage;
+ } kSourceLanguages[] =
+ {
+ { "slang", SourceLanguage::Slang },
+ { "hlsl", SourceLanguage::HLSL },
+ { "glsl", SourceLanguage::GLSL },
+ { "c", SourceLanguage::C },
+ { "cxx", SourceLanguage::CPP },
+ };
+
+ SourceLanguage findSourceLanguageByName(String const& name)
+ {
+ for (auto entry : kSourceLanguages)
+ {
+ if (name == entry.name)
+ {
+ return entry.sourceLanguage;
+ }
+ }
+
+ return SourceLanguage::Unknown;
+ };
+
SlangResult checkExternalCompilerSupport(Session* session, PassThroughMode passThrough)
{
switch (passThrough)