From ed9b6f0d3ff0e7261503a0bcdc88db21867b42d8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 12 Jan 2022 21:43:00 +1000 Subject: [PATCH] Vulkan/Context: Get driver properties --- common/Vulkan/Context.cpp | 18 ++++++++++++++++++ common/Vulkan/Context.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/common/Vulkan/Context.cpp b/common/Vulkan/Context.cpp index 9d4235cbd5..7940c0e3e9 100644 --- a/common/Vulkan/Context.cpp +++ b/common/Vulkan/Context.cpp @@ -462,6 +462,8 @@ namespace Vulkan SupportsExtension(VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME, false); m_optional_extensions.vk_ext_memory_budget = SupportsExtension(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME, false); + m_optional_extensions.vk_khr_driver_properties = + SupportsExtension(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME, false); return true; } @@ -665,6 +667,22 @@ namespace Vulkan m_optional_extensions.vk_ext_provoking_vertex &= (provoking_vertex_features.provokingVertexLast == VK_TRUE); } + if (vkGetPhysicalDeviceProperties2) + { + VkPhysicalDeviceProperties2 properties2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; + void** pNext = &properties2.pNext; + + if (m_optional_extensions.vk_khr_driver_properties) + { + m_device_driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; + *pNext = &m_device_driver_properties; + pNext = &m_device_driver_properties.pNext; + } + + // query + vkGetPhysicalDeviceProperties2(m_physical_device, &properties2); + } + Console.WriteLn("VK_EXT_provoking_vertex is %s", m_optional_extensions.vk_ext_provoking_vertex ? "supported" : "NOT supported"); } diff --git a/common/Vulkan/Context.h b/common/Vulkan/Context.h index a51b77ddf5..ae20edb713 100644 --- a/common/Vulkan/Context.h +++ b/common/Vulkan/Context.h @@ -50,6 +50,7 @@ namespace Vulkan { bool vk_ext_provoking_vertex : 1; bool vk_ext_memory_budget : 1; + bool vk_khr_driver_properties : 1; }; ~Context(); @@ -95,6 +96,7 @@ namespace Vulkan __fi const VkPhysicalDeviceProperties& GetDeviceProperties() const { return m_device_properties; } __fi const VkPhysicalDeviceFeatures& GetDeviceFeatures() const { return m_device_features; } __fi const VkPhysicalDeviceLimits& GetDeviceLimits() const { return m_device_properties.limits; } + __fi const VkPhysicalDeviceDriverProperties& GetDeviceDriverProperties() const { return m_device_driver_properties; } __fi const OptionalExtensions& GetOptionalExtensions() const { return m_optional_extensions; } // Helpers for getting constants @@ -331,6 +333,7 @@ namespace Vulkan VkPhysicalDeviceFeatures m_device_features = {}; VkPhysicalDeviceProperties m_device_properties = {}; VkPhysicalDeviceMemoryProperties m_device_memory_properties = {}; + VkPhysicalDeviceDriverPropertiesKHR m_device_driver_properties = {}; OptionalExtensions m_optional_extensions = {}; };