summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-02-03 17:28:48 -0500
committerMarge Bot <eric+marge@anholt.net>2021-04-05 22:14:26 +0000
commit6433661cdad06ef24ebc48566bb7b24443efeab2 (patch)
treef6715bca51c15ec2f608ea33aec35cf34c5e6422 /src/gallium
parent733e07565f8dd68d6bd83b33fe722d97ae7c4ddb (diff)
zink: use 2 variant to check image format props during create
just to be pedantic Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9984>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/zink/zink_instance.py3
-rw-r--r--src/gallium/drivers/zink/zink_resource.c19
-rw-r--r--src/gallium/drivers/zink/zink_screen.h1
3 files changed, 20 insertions, 3 deletions
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;