summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2020-09-08 14:38:56 +0000
committerazhirnov <zh1dron@gmail.com>2020-09-08 19:18:54 +0000
commitead1635c3c142f7af259dc0af83d244b24c7dfb9 (patch)
treee1e59012ba02d685ce1c2dd99151b2255bb76fca /Graphics/GraphicsEngineVulkan
parentfixed message text and docs (diff)
downloadDiligentCore-ead1635c3c142f7af259dc0af83d244b24c7dfb9.tar.gz
DiligentCore-ead1635c3c142f7af259dc0af83d244b24c7dfb9.zip
removed DILIGENT_HAS_SPIRV_DXCOMPILER, it not needed because used dynamic loading and user can specify path to library
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/CMakeLists.txt75
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp6
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp6
3 files changed, 34 insertions, 53 deletions
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
index 90aa7991..40a0f219 100644
--- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt
+++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
@@ -179,12 +179,9 @@ set(PRIVATE_DEPENDENCIES
Diligent-TargetPlatform
Diligent-GraphicsEngineNextGenBase
Diligent-GLSLTools
+ Diligent-HLSLTools
)
-if(NOT ${DILIGENT_NO_DXC_SPIRV})
- list(APPEND PRIVATE_DEPENDENCIES Diligent-HLSLTools)
-endif()
-
if (${DILIGENT_NO_HLSL})
message("HLSL support is disabled. Vulkan backend may not be able to consume SPIRV bytecode generated from HLSL.")
else()
@@ -194,51 +191,43 @@ endif()
# Use DirectX shader compiler for SPIRV.
# This is another implementation of DXC that can compile only to SPIRV.
# DXC for D3D12 can compile only to DXIL.
-if(NOT ${DILIGENT_NO_DXC_SPIRV})
- if(PLATFORM_WIN32)
- # find Vulkan SDK
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.7")
- find_package(Vulkan)
- if(Vulkan_FOUND)
- get_filename_component(VulkanSDKPath ${Vulkan_LIBRARY} DIRECTORY)
- set(VulkanSDKPath "${VulkanSDKPath}/..")
- if(NOT EXISTS "${VulkanSDKPath}")
- message(STATUS "can't get Vulkan SDK path")
- endif()
- if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
- set(DXC_SPIRV_PATH "${VulkanSDKPath}/Bin/dxcompiler.dll")
- else()
- set(DXC_SPIRV_PATH "${VulkanSDKPath}/Bin32/dxcompiler.dll")
- endif()
+if(PLATFORM_WIN32)
+ # find Vulkan SDK
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.7")
+ find_package(Vulkan)
+ if(Vulkan_FOUND)
+ get_filename_component(VulkanSDKPath ${Vulkan_LIBRARY} DIRECTORY)
+ set(VulkanSDKPath "${VulkanSDKPath}/..")
+ if(NOT EXISTS "${VulkanSDKPath}")
+ message(STATUS "can't get Vulkan SDK path")
+ endif()
+ if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+ set(DXC_SPIRV_PATH "${VulkanSDKPath}/Bin/dxcompiler.dll")
+ else()
+ set(DXC_SPIRV_PATH "${VulkanSDKPath}/Bin32/dxcompiler.dll")
endif()
endif()
- # Try to find Vulkan SDK from environment variable
- if(NOT Vulkan_FOUND)
- if(EXISTS "$ENV{VULKAN_SDK}")
- if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
- set(DXC_SPIRV_PATH "$ENV{VULKAN_SDK}/Bin/dxcompiler.dll")
- else()
- set(DXC_SPIRV_PATH "$ENV{VULKAN_SDK}/Bin32/dxcompiler.dll")
- endif()
+ endif()
+ # Try to find Vulkan SDK from environment variable
+ if(NOT Vulkan_FOUND)
+ if(EXISTS "$ENV{VULKAN_SDK}")
+ if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+ set(DXC_SPIRV_PATH "$ENV{VULKAN_SDK}/Bin/dxcompiler.dll")
+ else()
+ set(DXC_SPIRV_PATH "$ENV{VULKAN_SDK}/Bin32/dxcompiler.dll")
endif()
endif()
- endif(PLATFORM_WIN32)
-
- if(PLATFORM_LINUX)
- # VulkanSDK installs dxc to this path
- set(DXC_SPIRV_PATH "/usr/lib/dxc/libdxcompiler.so")
endif()
+endif(PLATFORM_WIN32)
- if(EXISTS ${DXC_SPIRV_PATH})
- set(DILIGENT_HAS_SPIRV_DXCOMPILER TRUE CACHE INTERNAL "" FORCE)
- set(DILIGENT_DXCOMPILER_FOR_SPIRV_PATH "${DXC_SPIRV_PATH}" CACHE INTERNAL "" FORCE)
- target_compile_definitions(Diligent-GraphicsEngineVk-static PRIVATE DILIGENT_HAS_SPIRV_DXCOMPILER)
- message(STATUS "Found DXCompiler for Vulkan")
- else()
- set(DILIGENT_HAS_SPIRV_DXCOMPILER FALSE CACHE INTERNAL "" FORCE)
- endif()
-else()
- set(DILIGENT_HAS_SPIRV_DXCOMPILER FALSE CACHE INTERNAL "" FORCE)
+if(PLATFORM_LINUX)
+ # VulkanSDK installs dxc to this path
+ set(DXC_SPIRV_PATH "/usr/lib/dxc/libdxcompiler.so")
+endif()
+
+if(EXISTS ${DXC_SPIRV_PATH})
+ set(DILIGENT_DXCOMPILER_FOR_SPIRV_PATH "${DXC_SPIRV_PATH}" CACHE INTERNAL "" FORCE)
+ message(STATUS "Found DXCompiler for Vulkan")
endif()
if(PLATFORM_WIN32)
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index b03a5c0e..9a17c9e2 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -39,13 +39,11 @@
#include "VulkanUtilities/VulkanInstance.hpp"
#include "VulkanUtilities/VulkanPhysicalDevice.hpp"
#include "EngineFactoryBase.hpp"
+#include "DXILUtils.hpp"
#if PLATFORM_ANDROID
# include "FileSystem.hpp"
#endif
-#ifdef DILIGENT_HAS_SPIRV_DXCOMPILER
-# include "DXILUtils.hpp"
-#endif
namespace Diligent
{
@@ -251,9 +249,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E
std::array<ICommandQueueVk*, 1> CommandQueues = {{pCmdQueueVk}};
AttachToVulkanDevice(Instance, std::move(PhysicalDevice), LogicalDevice, CommandQueues.size(), CommandQueues.data(), EngineCI, ppDevice, ppContexts);
-#ifdef DILIGENT_HAS_SPIRV_DXCOMPILER
DxcLoadLibrary(DXCompilerTarget::Vulkan, EngineCI.pDxCompilerPath);
-#endif
}
catch (std::runtime_error&)
{
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
index 708458da..cafa7303 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
@@ -33,13 +33,11 @@
#include "RenderDeviceVkImpl.hpp"
#include "DataBlobImpl.hpp"
#include "GLSLSourceBuilder.hpp"
+#include "DXILUtils.hpp"
#if !DILIGENT_NO_GLSLANG
# include "SPIRVUtils.hpp"
#endif
-#ifdef DILIGENT_HAS_SPIRV_DXCOMPILER
-# include "DXILUtils.hpp"
-#endif
namespace Diligent
{
@@ -68,11 +66,9 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters,
switch (CreationAttribs.ShaderCompiler)
{
-#ifdef DILIGENT_HAS_SPIRV_DXCOMPILER
case SHADER_COMPILER_DXC:
m_SPIRV = DXILtoSPIRV(CreationAttribs, VulkanDefine, CreationAttribs.ppCompilerOutput);
break;
-#endif
case SHADER_COMPILER_DEFAULT:
case SHADER_COMPILER_GLSLANG: