diff options
| author | azhirnov <zh1dron@gmail.com> | 2020-08-25 01:57:56 +0000 |
|---|---|---|
| committer | azhirnov <zh1dron@gmail.com> | 2020-08-25 01:57:56 +0000 |
| commit | a47f1b7abeb300c0b3ea618df2dec234a3d29cfa (patch) | |
| tree | 719b579ab428cd1df4ddf97d0317f354ec05e95a /Graphics/GraphicsEngineVulkan | |
| parent | added HLSLTools, HLSL shader compiler refactoring (diff) | |
| download | DiligentCore-a47f1b7abeb300c0b3ea618df2dec234a3d29cfa.tar.gz DiligentCore-a47f1b7abeb300c0b3ea618df2dec234a3d29cfa.zip | |
disable vulkan extensions if disabled volk
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
5 files changed, 19 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h index c99145dd..84b4408c 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h @@ -34,6 +34,10 @@ #if DILIGENT_USE_VOLK # include "volk/volk.h" +#else +// Don't use extensions when statically linked with Vulkan +# undef VK_KHR_get_physical_device_properties2 +# undef VK_NV_mesh_shader #endif #if defined(VK_USE_PLATFORM_XLIB_KHR) || defined(_X11_XLIB_H_) diff --git a/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h b/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h index 389a6ba5..ec459db9 100644 --- a/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h @@ -30,8 +30,6 @@ /// \file /// Definition of the Diligent::ISwapChainVk interface -#include "../../../ThirdParty/vulkan/vulkan.h" - #include "../../GraphicsEngine/interface/SwapChain.h" #include "TextureViewVk.h" diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp index 89895ad0..f0dafcff 100644 --- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp @@ -206,6 +206,9 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E bool SupportsFeatures2 = Instance->IsExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); void** NextExt = const_cast<void**>(&DeviceCreateInfo.pNext); + // Variables may be unused if extensions are disabled. + (void)(SupportsFeatures2, NextExt); + // Enable mesh shader extension. #ifdef VK_NV_mesh_shader VkPhysicalDeviceMeshShaderFeaturesNV MeshShaderFeats = PhysicalDevice->GetExtFeatures().MeshShader; diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 80c03e49..56a8ebca 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -162,6 +162,9 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters* const auto& vkDeviceFeatures = m_PhysicalDevice->GetFeatures(); const auto& vkExtFeatures = m_PhysicalDevice->GetExtFeatures(); + // May be unused if extensions are disabled. + (void)(vkExtFeatures); + Features.SeparablePrograms = True; Features.IndirectRendering = True; Features.WireframeFill = vkDeviceFeatures.fillModeNonSolid != VK_FALSE; @@ -184,8 +187,12 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters* Features.PixelUAVWritesAndAtomics = vkDeviceFeatures.fragmentStoresAndAtomics != VK_FALSE; Features.TextureUAVExtendedFormats = vkDeviceFeatures.shaderStorageImageExtendedFormats != VK_FALSE; +#ifdef VK_NV_mesh_shader // All devices that supports mesh shader also supports task shader, so it is not necessary to use two separate features. Features.MeshShaders = vkExtFeatures.MeshShader.meshShader != VK_FALSE && vkExtFeatures.MeshShader.taskShader != VK_FALSE; +#else + Features.MeshShaders = False; +#endif const auto& vkDeviceLimits = m_PhysicalDevice->GetProperties().limits; auto& TexCaps = m_DeviceCaps.TexCaps; diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp index a4f99102..366b539d 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp @@ -68,28 +68,30 @@ VulkanPhysicalDevice::VulkanPhysicalDevice(VkPhysicalDevice vkDev VERIFY_EXPR(ExtensionCount == m_SupportedExtensions.size()); } +#ifdef VK_KHR_get_physical_device_properties2 if (Instance->IsExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { VkPhysicalDeviceFeatures2 Feats2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; VkPhysicalDeviceProperties2 Props2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; void** NextFeat = &Feats2.pNext; - //void** NextProp = &Props2.pNext; + //void** NextProp = &Props2.pNext; // not used yet // Enable mesh shader extension. -#ifdef VK_NV_mesh_shader +# ifdef VK_NV_mesh_shader if (IsExtensionSupported(VK_NV_MESH_SHADER_EXTENSION_NAME)) { *NextFeat = &m_ExtFeatures.MeshShader; NextFeat = &m_ExtFeatures.MeshShader.pNext; m_ExtFeatures.MeshShader.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV; } -#endif +# endif // Initialize device extension features by current physical device features. // Some flags may not be supported by hardware. vkGetPhysicalDeviceFeatures2KHR(m_VkDevice, &Feats2); vkGetPhysicalDeviceProperties2KHR(m_VkDevice, &Props2); } +#endif } uint32_t VulkanPhysicalDevice::FindQueueFamily(VkQueueFlags QueueFlags) const |
