diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-09-15 00:45:59 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-09-15 00:45:59 +0000 |
| commit | a88ff24e94bba0efaa44efe6263bd1b698e58849 (patch) | |
| tree | 87ff71de5f567dec8303eb9aadefb38a63759099 /Graphics/GraphicsEngineVulkan | |
| parent | Refactoring shader compilation - part III (diff) | |
| download | DiligentCore-a88ff24e94bba0efaa44efe6263bd1b698e58849.tar.gz DiligentCore-a88ff24e94bba0efaa44efe6263bd1b698e58849.zip | |
Completed shader compilation refactoring (fixed https://github.com/DiligentGraphics/DiligentCore/issues/160)
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index 033f711a..c16010d8 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -64,19 +64,24 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, "# define VULKAN 1\n" "#endif\n"; - switch (CreationAttribs.ShaderCompiler) + auto ShaderCompiler = CreationAttribs.ShaderCompiler; + if (ShaderCompiler == SHADER_COMPILER_DXC) + { + auto* pDXComiler = pRenderDeviceVk->GetDxCompiler(); + if (pDXComiler == nullptr || !pDXComiler->IsLoaded()) + { + LOG_WARNING_MESSAGE("DX Compiler is not loaded. Using default shader compiler"); + ShaderCompiler = SHADER_COMPILER_DEFAULT; + } + } + + switch (ShaderCompiler) { case SHADER_COMPILER_DXC: { auto* pDXComiler = pRenderDeviceVk->GetDxCompiler(); - if (pDXComiler != nullptr && pDXComiler->IsLoaded()) - { - pDXComiler->Compile(CreationAttribs, VulkanDefine, nullptr, &m_SPIRV, CreationAttribs.ppCompilerOutput); - } - else - { - LOG_ERROR_AND_THROW("DX Compiler is not loaded"); - } + VERIFY_EXPR(pDXComiler != nullptr && pDXComiler->IsLoaded()); + pDXComiler->Compile(CreationAttribs, VulkanDefine, nullptr, &m_SPIRV, CreationAttribs.ppCompilerOutput); } break; @@ -84,7 +89,7 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, case SHADER_COMPILER_GLSLANG: { #if DILIGENT_NO_GLSLANG - LOG_ERROR_AND_THROW("Diligent engine was not linked with glslang, use DXIL compiler or precompiled SPIRV bytecode."); + LOG_ERROR_AND_THROW("Diligent engine was not linked with glslang, use DXC or precompiled SPIRV bytecode."); #else if (CreationAttribs.SourceLanguage == SHADER_SOURCE_LANGUAGE_HLSL) { |
