VideoBackends:Vulkan: Allow use of GetPhysicalDevicePropertiesKHR if VK1.1 isn't supported

This commit is contained in:
TellowKrinkle 2025-08-17 23:06:59 -05:00
parent 59a9f13042
commit 4a8381284f
2 changed files with 15 additions and 6 deletions

View File

@ -109,7 +109,8 @@ VulkanContext::PhysicalDeviceInfo::PhysicalDeviceInfo(VkPhysicalDevice device)
}
}
if (apiVersion >= VK_API_VERSION_1_1)
const bool vk11 = apiVersion >= VK_API_VERSION_1_1;
if (vk11 || vkGetPhysicalDeviceProperties2KHR)
{
VkPhysicalDeviceSubgroupProperties properties_subgroup = {};
VkPhysicalDeviceVulkan12Properties properties_vk12 = {};
@ -117,8 +118,12 @@ VulkanContext::PhysicalDeviceInfo::PhysicalDeviceInfo(VkPhysicalDevice device)
features2.pNext = nullptr;
properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
properties2.pNext = nullptr;
properties_subgroup.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
InsertIntoChain(&properties2, &properties_subgroup);
if (apiVersion >= VK_API_VERSION_1_1)
{
properties_subgroup.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
InsertIntoChain(&properties2, &properties_subgroup);
}
if (apiVersion >= VK_API_VERSION_1_2)
{
@ -126,8 +131,10 @@ VulkanContext::PhysicalDeviceInfo::PhysicalDeviceInfo(VkPhysicalDevice device)
InsertIntoChain(&properties2, &properties_vk12);
}
vkGetPhysicalDeviceProperties2(device, &properties2);
vkGetPhysicalDeviceFeatures2(device, &features2);
auto getProps = vk11 ? vkGetPhysicalDeviceProperties2 : vkGetPhysicalDeviceProperties2KHR;
getProps(device, &properties2);
auto getFeatures = vk11 ? vkGetPhysicalDeviceFeatures2 : vkGetPhysicalDeviceFeatures2KHR;
getFeatures(device, &features2);
if (apiVersion >= VK_API_VERSION_1_2)
{
@ -890,7 +897,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
WarnMissingDeviceFeatures();
DeviceFeatures device_features(m_device_info);
if (m_device_info.apiVersion >= VK_API_VERSION_1_1)
if (m_device_info.apiVersion >= VK_API_VERSION_1_1 || vkGetPhysicalDeviceProperties2KHR)
ConcatenateChains(&device_info, &device_features.features2);
else
device_info.pEnabledFeatures = &device_features.features2.features;

View File

@ -67,7 +67,9 @@ VULKAN_INSTANCE_ENTRY_POINT(vkQueueEndDebugUtilsLabelEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkQueueInsertDebugUtilsLabelEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkSetDebugUtilsObjectTagEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkSubmitDebugUtilsMessageEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceFeatures2KHR, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceFeatures2, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceProperties2KHR, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceProperties2, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceSurfaceCapabilities2KHR, false)
VULKAN_INSTANCE_ENTRY_POINT(vkSetDebugUtilsObjectNameEXT, false)