summaryrefslogtreecommitdiff
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
authorRobert Stepinski <rob.stepinski@gmail.com>2019-11-22 18:20:18 -0500
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-11-22 15:20:18 -0800
commit63dcbe50d40afc15196eeca6ba0b04657adf6953 (patch)
tree05f63d4f83cdd34a5788f0c6d449a94fb3104d0b /source/slang/slang-compiler.cpp
parent1d51b01cc7a6ab5fa26e0eb109ca29ed0f24ebe1 (diff)
Add command line option to override language file extension (#1135)
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)