diff --git a/src/gallium/drivers/zink/zink_instance.py b/src/gallium/drivers/zink/zink_instance.py index c4d597106ab..2146510d8e4 100644 --- a/src/gallium/drivers/zink/zink_instance.py +++ b/src/gallium/drivers/zink/zink_instance.py @@ -43,7 +43,8 @@ import sys EXTENSIONS = [ Extension("VK_EXT_debug_utils"), Extension("VK_KHR_get_physical_device_properties2", - functions=["GetPhysicalDeviceFeatures2", "GetPhysicalDeviceProperties2", "GetPhysicalDeviceFormatProperties2"]), + functions=["GetPhysicalDeviceFeatures2", "GetPhysicalDeviceProperties2", + "GetPhysicalDeviceFormatProperties2", "GetPhysicalDeviceImageFormatProperties2"]), Extension("VK_MVK_moltenvk", nonstandard=True), ] diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 2cf907bb974..82ef081e3d8 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -392,8 +392,23 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t *optimal_tiling = ici.tiling != VK_IMAGE_TILING_LINEAR; VkImageFormatProperties image_props; - if (vkGetPhysicalDeviceImageFormatProperties(screen->pdev, ici.format, ici.imageType, - ici.tiling, ici.usage, ici.flags, &image_props) != VK_SUCCESS) { + VkResult ret; + if (screen->vk_GetPhysicalDeviceImageFormatProperties2) { + VkImageFormatProperties2 props2 = {}; + props2.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2; + VkPhysicalDeviceImageFormatInfo2 info = {}; + info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2; + info.format = ici.format; + info.type = ici.imageType; + info.tiling = ici.tiling; + info.usage = ici.usage; + info.flags = ici.flags; + ret = screen->vk_GetPhysicalDeviceImageFormatProperties2(screen->pdev, &info, &props2); + image_props = props2.imageFormatProperties; + } else + ret = vkGetPhysicalDeviceImageFormatProperties(screen->pdev, ici.format, ici.imageType, + ici.tiling, ici.usage, ici.flags, &image_props); + if (ret != VK_SUCCESS) { FREE(obj); return NULL; } diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index 4af321d41e4..72fbeae8d0b 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -105,6 +105,7 @@ struct zink_screen { PFN_vkGetPhysicalDeviceFeatures2 vk_GetPhysicalDeviceFeatures2; PFN_vkGetPhysicalDeviceProperties2 vk_GetPhysicalDeviceProperties2; PFN_vkGetPhysicalDeviceFormatProperties2 vk_GetPhysicalDeviceFormatProperties2; + PFN_vkGetPhysicalDeviceImageFormatProperties2 vk_GetPhysicalDeviceImageFormatProperties2; PFN_vkCmdDrawIndirectCount vk_CmdDrawIndirectCount; PFN_vkCmdDrawIndexedIndirectCount vk_CmdDrawIndexedIndirectCount;