Check Vulkan header version for macro compatibility, improve VkPhysicalDeviceProperties2 variable names

(cherry picked from commit 6399dc2a48829ea25be649213cc059d5bfd1b379)
This commit is contained in:
Stephen Saunders 2022-03-30 17:01:56 -04:00
parent 23044c8e43
commit 511e18d9fd

View file

@ -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();