zink: check format compatibility up front when creating framebuffer surface
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 6 Sep 2022 16:14:01 +0000 (12:14 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 22 Sep 2022 20:42:04 +0000 (20:42 +0000)
this avoids an assert in create_ivci while enforcing correct behavior

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18446>

src/gallium/drivers/zink/zink_surface.c

index 837853f..b9723ea 100644 (file)
@@ -263,6 +263,9 @@ zink_create_surface(struct pipe_context *pctx,
       /* mutable not set by default */
       zink_resource_object_init_mutable(zink_context(pctx), res);
 
+   if (!zink_get_format(zink_screen(pctx->screen), templ->format))
+      return NULL;
+
    VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen), res, templ,
                                             pres->target == PIPE_TEXTURE_3D ? target_2d[is_array] : pres->target);