diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-05-22 23:19:39 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-05-22 23:19:39 +0000 |
| commit | 8151bc6df37372eb91011edede9ffbb258ebeab6 (patch) | |
| tree | c26b3f1cb425ff5069b04c02b8e36b106bea4549 /Graphics/GraphicsEngineVulkan | |
| parent | Removed workarounds for GS, HS and DS in Vulkan tests (diff) | |
| download | DiligentCore-8151bc6df37372eb91011edede9ffbb258ebeab6.tar.gz DiligentCore-8151bc6df37372eb91011edede9ffbb258ebeab6.zip | |
Unified VULKAN shader define in VK and GL backends
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index 11385ae6..74293d1b 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -61,15 +61,19 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, DEV_CHECK_ERR(CreationAttribs.ByteCode == nullptr, "'ByteCode' must be null when shader is created from source code or a file"); DEV_CHECK_ERR(CreationAttribs.ByteCodeSize == 0, "'ByteCodeSize' must be 0 when shader is created from source code or a file"); + static constexpr char* VulkanDefine = + "#ifndef VULKAN\n" + "# define VULKAN 1\n" + "#endif\n"; if (CreationAttribs.SourceLanguage == SHADER_SOURCE_LANGUAGE_HLSL) { - m_SPIRV = HLSLtoSPIRV(CreationAttribs, CreationAttribs.ppCompilerOutput); + m_SPIRV = HLSLtoSPIRV(CreationAttribs, VulkanDefine, CreationAttribs.ppCompilerOutput); } else { auto GLSLSource = BuildGLSLSourceString(CreationAttribs, pRenderDeviceVk->GetDeviceCaps(), TargetGLSLCompiler::glslang, - "#define TARGET_API_VULKAN 1\n"); + VulkanDefine); m_SPIRV = GLSLtoSPIRV(m_Desc.ShaderType, GLSLSource.c_str(), static_cast<int>(GLSLSource.length()), |
