From a00fccce0c68ab64158c371fcdfcce2846f2648d Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 25 Aug 2021 23:46:18 +0200 Subject: [PATCH] zink: reduce scope of version-struct hack Without this, we'll end up checking against the wrong version when enabling core features in the next commit. Reviewed-by: Hoe Hao Cheng Part-of: --- src/gallium/drivers/zink/zink_device_info.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_device_info.py b/src/gallium/drivers/zink/zink_device_info.py index 39880169505..ba9d9f760ea 100644 --- a/src/gallium/drivers/zink/zink_device_info.py +++ b/src/gallium/drivers/zink/zink_device_info.py @@ -194,9 +194,7 @@ EXTENSIONS = [ # # - struct_version: Vulkan version, as tuple, to use with structures and macros VERSIONS = [ - # VkPhysicalDeviceVulkan11Properties and VkPhysicalDeviceVulkan11Features is new from Vk 1.2, not Vk 1.1 - # https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#_new_structures - Version((1,2,0), (1,1)), + Version((1,1,0), (1,1)), Version((1,2,0), (1,2)), ] @@ -371,7 +369,12 @@ zink_get_physical_device_info(struct zink_screen *screen) info->feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; %for version in versions: +%if version.device_version < (1,2,0): + if (VK_MAKE_VERSION(1,2,0) <= screen->vk_version) { + /* VkPhysicalDeviceVulkan11Features was added in 1.2, not 1.1 as one would think */ +%else: if (${version.version()} <= screen->vk_version) { +%endif info->feats${version.struct()}.sType = ${version.stype("FEATURES")}; info->feats${version.struct()}.pNext = info->feats.pNext; info->feats.pNext = &info->feats${version.struct()}; @@ -402,7 +405,12 @@ zink_get_physical_device_info(struct zink_screen *screen) props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; %for version in versions: +%if version.device_version < (1,2,0): + if (VK_MAKE_VERSION(1,2,0) <= screen->vk_version) { + /* VkPhysicalDeviceVulkan11Properties was added in 1.2, not 1.1 as one would think */ +%else: if (${version.version()} <= screen->vk_version) { +%endif info->props${version.struct()}.sType = ${version.stype("PROPERTIES")}; info->props${version.struct()}.pNext = props.pNext; props.pNext = &info->props${version.struct()};