Mesa (master): zink: use 2 variant to check image format props during create
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 5 22:23:38 UTC 2021
Module: Mesa
Branch: master
Commit: 6433661cdad06ef24ebc48566bb7b24443efeab2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6433661cdad06ef24ebc48566bb7b24443efeab2
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed Feb 3 17:28:48 2021 -0500
zink: use 2 variant to check image format props during create
just to be pedantic
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9984>
---
src/gallium/drivers/zink/zink_instance.py | 3 ++-
src/gallium/drivers/zink/zink_resource.c | 19 +++++++++++++++++--
src/gallium/drivers/zink/zink_screen.h | 1 +
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;
More information about the mesa-commit
mailing list