From 511e18d9fd23c4e09184376495b12a388d5319cd Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Wed, 30 Mar 2022 17:01:56 -0400 Subject: [PATCH] Check Vulkan header version for macro compatibility, improve VkPhysicalDeviceProperties2 variable names (cherry picked from commit 6399dc2a48829ea25be649213cc059d5bfd1b379) --- neo/renderer/Vulkan/RenderBackend_VK.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index 0e47dad8..1c26b34c 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -750,7 +750,12 @@ static void SelectPhysicalDevice() static idStr version_string; version_string.Clear(); +#if VK_HEADER_VERSION >= 176 version_string.Append( va( "Vulkan API %i.%i.%i", VK_API_VERSION_MAJOR( gpu.props.apiVersion ), VK_API_VERSION_MINOR( gpu.props.apiVersion ), VK_API_VERSION_PATCH( gpu.props.apiVersion ) ) ); +#else + // SRS - Allow deprecated version macros on older Vulkan SDKs < 1.2.176 + version_string.Append( va( "Vulkan API %i.%i.%i", VK_VERSION_MAJOR( gpu.props.apiVersion ), VK_VERSION_MINOR( gpu.props.apiVersion ), VK_VERSION_PATCH( gpu.props.apiVersion ) ) ); +#endif static idStr extensions_string; extensions_string.Clear(); @@ -768,13 +773,13 @@ static void SelectPhysicalDevice() if( vkcontext.deviceProperties2Available && driverPropertiesAvailable ) { - VkPhysicalDeviceProperties2 pProperties = {}; - VkPhysicalDeviceDriverProperties pDriverProperties = {}; - pProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; - pProperties.pNext = &pDriverProperties; - pDriverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; - vkGetPhysicalDeviceProperties2( vkcontext.physicalDevice, &pProperties ); - version_string.Append( va( " (%s %s)", pDriverProperties.driverName, pDriverProperties.driverInfo ) ); + VkPhysicalDeviceProperties2 deviceProperties = {}; + VkPhysicalDeviceDriverProperties driverProperties = {}; + deviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + deviceProperties.pNext = &driverProperties; + driverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; + vkGetPhysicalDeviceProperties2( vkcontext.physicalDevice, &deviceProperties ); + version_string.Append( va( " (%s %s)", driverProperties.driverName, driverProperties.driverInfo ) ); } glConfig.version_string = version_string.c_str();