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

Author: Corentin Noël <corentin.n...@collabora.com>
Date:   Thu Nov  2 11:10:39 2023 +0100

virgl/texture: Align destination box to block depth

In the case of a 3D texture, make sure to align to the block depth.

Signed-off-by: Corentin Noël <corentin.n...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26005>

---

 src/gallium/drivers/virgl/virgl_texture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/virgl/virgl_texture.c 
b/src/gallium/drivers/virgl/virgl_texture.c
index 3f9542cc0bd..cde0b21e65a 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -151,6 +151,9 @@ static void *texture_transfer_map_resolve(struct 
pipe_context *ctx,
             util_format_get_blockwidth(resource->format));
       dst_box.height = align(dst_box.height,
             util_format_get_blockheight(resource->format));
+      if (resource->target == PIPE_TEXTURE_3D)
+         dst_box.depth = align(dst_box.depth,
+               util_format_get_blockdepth(resource->format));
    }
 
    virgl_init_temp_resource_from_box(&templ, resource, &dst_box, level, 0, 
fmt);

Reply via email to