From 381f66352dfaefcdeaeba3c71183ad558bb70cd6 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Wed, 9 Sep 2020 12:25:47 +0300 Subject: added IDxCompilerLibrary interface. DXCompilerBase moved to platform specific files --- Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp | 5 +++++ .../include/VulkanUtilities/VulkanPhysicalDevice.hpp | 4 +--- Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp | 3 --- Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp | 3 ++- Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp index 1adf71ee..9f18c99c 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp @@ -48,6 +48,7 @@ #include "FramebufferCache.hpp" #include "RenderPassCache.hpp" #include "CommandPoolManager.hpp" +#include "DXILUtils.hpp" namespace Diligent { @@ -176,6 +177,8 @@ public: void FlushStaleResources(Uint32 CmdQueueIndex); + IDxCompilerLibrary* GetDxCompiler() const { return m_pDxCompiler.get(); } + private: virtual void TestTextureFormat(TEXTURE_FORMAT TexFormat) override final; @@ -205,6 +208,8 @@ private: VulkanUtilities::VulkanMemoryManager m_MemoryMgr; VulkanDynamicMemoryManager m_DynamicMemoryManager; + + std::unique_ptr m_pDxCompiler; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanPhysicalDevice.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanPhysicalDevice.hpp index 760099e2..57631b91 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanPhysicalDevice.hpp +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanPhysicalDevice.hpp @@ -39,9 +39,7 @@ class VulkanPhysicalDevice public: struct ExtensionFeatures { -#ifdef VK_NV_mesh_shader - VkPhysicalDeviceMeshShaderFeaturesNV MeshShader; -#endif + VkPhysicalDeviceMeshShaderFeaturesNV MeshShader = {}; }; struct ExtensionProperties diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp index 9a17c9e2..f0dafcff 100644 --- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp @@ -39,7 +39,6 @@ #include "VulkanUtilities/VulkanInstance.hpp" #include "VulkanUtilities/VulkanPhysicalDevice.hpp" #include "EngineFactoryBase.hpp" -#include "DXILUtils.hpp" #if PLATFORM_ANDROID # include "FileSystem.hpp" @@ -248,8 +247,6 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E std::array CommandQueues = {{pCmdQueueVk}}; AttachToVulkanDevice(Instance, std::move(PhysicalDevice), LogicalDevice, CommandQueues.size(), CommandQueues.data(), EngineCI, ppDevice, ppContexts); - - DxcLoadLibrary(DXCompilerTarget::Vulkan, EngineCI.pDxCompilerPath); } catch (std::runtime_error&) { diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index e9fae8e7..c619dc59 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -148,7 +148,8 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters* *this, EngineCI.DynamicHeapSize, ~Uint64{0} - } + }, + m_pDxCompiler{CreateDXCompiler(DXCompilerTarget::Vulkan, EngineCI.pDxCompilerPath)} // clang-format on { m_DeviceCaps.DevType = RENDER_DEVICE_TYPE_VULKAN; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index cafa7303..7cfa5f97 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -67,7 +67,7 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, switch (CreationAttribs.ShaderCompiler) { case SHADER_COMPILER_DXC: - m_SPIRV = DXILtoSPIRV(CreationAttribs, VulkanDefine, CreationAttribs.ppCompilerOutput); + m_SPIRV = DXILtoSPIRV(pRenderDeviceVk->GetDxCompiler(), CreationAttribs, VulkanDefine, CreationAttribs.ppCompilerOutput); break; case SHADER_COMPILER_DEFAULT: -- cgit v1.2.3