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

Author: Mike Blumenkrantz <[email protected]>
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16456>

---

 src/gallium/drivers/zink/zink_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_bo.c 
b/src/gallium/drivers/zink/zink_bo.c
index 47075f394d3..5afa5ec413e 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -920,7 +920,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++) {

Reply via email to