From 63dcbe50d40afc15196eeca6ba0b04657adf6953 Mon Sep 17 00:00:00 2001 From: Robert Stepinski Date: Fri, 22 Nov 2019 18:20:18 -0500 Subject: Add command line option to override language file extension (#1135) --- source/slang/slang-compiler.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source/slang/slang-compiler.cpp') 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) -- cgit v1.2.3