Mesa (staging/22.0): zink: fix sparse texture depth calcs for arrayed textures

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 16 19:33:37 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: cf34bbd908c3c48e116381d34212533a89a5b3f0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf34bbd908c3c48e116381d34212533a89a5b3f0

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed May 11 16:59:31 2022 -0400

zink: fix sparse texture depth calcs for arrayed textures

use the array, not the depth

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16456>
(cherry picked from commit 1126f42781d87162eb827794b7446b3619e067af)

---

 .pick_status.json                  | 2 +-
 src/gallium/drivers/zink/zink_bo.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9ad472c519d..e8ede95c5ec 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1860,7 +1860,7 @@
         "description": "zink: fix sparse texture depth calcs for arrayed textures",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": null
     },
     {
diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index 9ba8e8e7cb5..8dc5c3f5585 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -917,7 +917,7 @@ zink_bo_commit(struct zink_screen *screen, struct zink_resource *res, unsigned l
    for (unsigned l = 0; l < level; l++) {
       unsigned mipwidth = DIV_ROUND_UP(MAX2(res->base.b.width0 >> l, 1), gwidth);
       unsigned mipheight = DIV_ROUND_UP(MAX2(res->base.b.height0 >> l, 1), gheight);
-      unsigned mipdepth = DIV_ROUND_UP(MAX2(res->base.b.depth0 >> l, 1), gdepth);
+      unsigned mipdepth = DIV_ROUND_UP(res->base.b.array_size > 1 ? res->base.b.array_size : MAX2(res->base.b.depth0 >> l, 1), gdepth);
       va_page_offset += mipwidth * mipheight * mipdepth;
    }
    for (unsigned d = 0; d < ndepth; d++) {



More information about the mesa-commit mailing list