Mesa (main): zink: more accurately clamp 3d fb surfaces to corresponding 2d target

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 28 17:54:11 UTC 2022


Module: Mesa
Branch: main
Commit: 8e67928862de069d3e6892a1ecbb7ca8d1a648b6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e67928862de069d3e6892a1ecbb7ca8d1a648b6

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Feb 22 16:10:05 2022 -0500

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 <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15172>

---

 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 8c95aacc218..e305a19d19f 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)



More information about the mesa-commit mailing list