Mesa (master): zink: check image format props before creating image

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 29 02:27:05 UTC 2021


Module: Mesa
Branch: master
Commit: aac88f49e5f2831a4abc8a90e92fc6321ba4d430
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aac88f49e5f2831a4abc8a90e92fc6321ba4d430

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Feb  3 15:34:58 2021 -0500

zink: check image format props before creating image

ensure that these attrs are viable before failing silently later on

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9788>

---

 src/gallium/drivers/zink/zink_resource.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 0b1bcde4976..b49e6c3a609 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -374,6 +374,13 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       if (optimal_tiling)
          *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) {
+         FREE(obj);
+         return NULL;
+      }
+
       struct wsi_image_create_info image_wsi_info = {
          VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
          NULL,



More information about the mesa-commit mailing list