diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2020-06-18 13:40:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-18 13:40:08 -0700 |
| commit | 82ba914db9c3823ad7a0834d46b7fccedfe0acee (patch) | |
| tree | a2361c042e6a03ff957bd4a921f73efbb89dc1b7 /source/slang/slang-compiler.cpp | |
| parent | 8c6e02bd094bbc0c9afb141265be9675f99ddb61 (diff) | |
| parent | 5952e3b3d7f505a7e6d71ecd0793911224f5bac3 (diff) | |
Merge branch 'master' into dyndispatch
Diffstat (limited to 'source/slang/slang-compiler.cpp')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index a15d7f945..fe0f7d69c 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -320,7 +320,7 @@ namespace Slang // - Profile Profile::LookUp(char const* name) + Profile Profile::lookUp(char const* name) { #define PROFILE(TAG, NAME, STAGE, VERSION) if(strcmp(name, #NAME) == 0) return Profile::TAG; #define PROFILE_ALIAS(TAG, DEF, NAME) if(strcmp(name, #NAME) == 0) return Profile::TAG; @@ -408,27 +408,57 @@ namespace Slang return session->getOrLoadDownstreamCompiler(passThrough, nullptr) ? SLANG_OK: SLANG_E_NOT_FOUND; } - PassThroughMode getDownstreamCompilerRequiredForTarget(CodeGenTarget target) + SourceLanguage getDefaultSourceLanguageForDownstreamCompiler(PassThroughMode compiler) { - switch (target) + switch (compiler) { - case CodeGenTarget::None: + case PassThroughMode::None: { - return PassThroughMode::None; + return SourceLanguage::Unknown; } - case CodeGenTarget::GLSL: + case PassThroughMode::Fxc: + case PassThroughMode::Dxc: + { + return SourceLanguage::HLSL; + } + case PassThroughMode::Glslang: { - // Can always output GLSL - return PassThroughMode::None; + return SourceLanguage::GLSL; } + case PassThroughMode::Clang: + case PassThroughMode::VisualStudio: + case PassThroughMode::Gcc: + case PassThroughMode::GenericCCpp: + { + // These could ingest C, but we only have this function to work out a + // 'default' language to ingest. + return SourceLanguage::CPP; + } + case PassThroughMode::NVRTC: + { + return SourceLanguage::CUDA; + } + default: break; + } + SLANG_ASSERT(!"Unknown compiler"); + return SourceLanguage::Unknown; + } + + PassThroughMode getDownstreamCompilerRequiredForTarget(CodeGenTarget target) + { + switch (target) + { + // Don't *require* a downstream compiler for source output + case CodeGenTarget::GLSL: case CodeGenTarget::HLSL: + case CodeGenTarget::CUDASource: + case CodeGenTarget::CPPSource: + case CodeGenTarget::CSource: { - // Can always output HLSL return PassThroughMode::None; } - case CodeGenTarget::CUDASource: + case CodeGenTarget::None: { - // Can always output CUDA return PassThroughMode::None; } case CodeGenTarget::SPIRVAssembly: @@ -451,12 +481,6 @@ namespace Slang { return PassThroughMode::Glslang; } - case CodeGenTarget::CPPSource: - case CodeGenTarget::CSource: - { - // Don't need an external compiler to output C and C++ code - return PassThroughMode::None; - } case CodeGenTarget::HostCallable: case CodeGenTarget::SharedLibrary: case CodeGenTarget::Executable: @@ -607,7 +631,7 @@ namespace Slang } char const* stagePrefix = nullptr; - switch( profile.GetStage() ) + switch( profile.getStage() ) { // Note: All of the raytracing-related stages require // compiling for a `lib_*` profile, even when only a @@ -642,7 +666,7 @@ namespace Slang } char const* versionSuffix = nullptr; - switch(profile.GetVersion()) + switch(profile.getVersion()) { #define CASE(TAG, SUFFIX) case ProfileVersion::TAG: versionSuffix = #SUFFIX; break CASE(DX_4_0, _4_0); |
