From 8e67928862de069d3e6892a1ecbb7ca8d1a648b6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 22 Feb 2022 16:10:05 -0500 Subject: [PATCH] zink: more accurately clamp 3d fb surfaces to corresponding 2d target if more than 1 layer is being bound, this is an array, otherwise it's just regular 2d Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_surface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index 8c95aac..e305a19 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -228,11 +228,11 @@ zink_create_surface(struct pipe_context *pctx, struct pipe_resource *pres, const struct pipe_surface *templ) { - - VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen), - zink_resource(pres), templ, pres->target); - if (pres->target == PIPE_TEXTURE_3D) - ivci.viewType = VK_IMAGE_VIEW_TYPE_2D; + struct zink_resource *res = zink_resource(pres); + bool is_array = templ->u.tex.last_layer != templ->u.tex.first_layer; + enum pipe_texture_target target_2d[] = {PIPE_TEXTURE_2D, PIPE_TEXTURE_2D_ARRAY}; + VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen), res, templ, + pres->target == PIPE_TEXTURE_3D ? target_2d[is_array] : pres->target); struct pipe_surface *psurf = zink_get_surface(zink_context(pctx), pres, templ, &ivci); if (!psurf) -- 2.7.4