v3dv: fix slice size for miplevels >= 2
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 22 Jun 2023 06:18:35 +0000 (08:18 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 27 Jun 2023 07:04:20 +0000 (09:04 +0200)
We want to store the slice size in pixels not the level size
after padding to a power of 2 we use miplevels >= 2.

Fixes: 1cb2d2a5ee ('v3dv: store slice dimensions in pixels')
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23739>

src/broadcom/vulkan/v3dv_image.c

index 5474d37..ebbd60e 100644 (file)
@@ -140,18 +140,18 @@ v3d_setup_plane_slices(struct v3dv_image *image, uint8_t plane,
    for (int32_t i = image->vk.mip_levels - 1; i >= 0; i--) {
       struct v3d_resource_slice *slice = &image->planes[plane].slices[i];
 
+      slice->width = u_minify(width, i);
+      slice->height = u_minify(height, i);
+
       uint32_t level_width, level_height, level_depth;
       if (i < 2) {
-         level_width = u_minify(width, i);
-         level_height = u_minify(height, i);
+         level_width = slice->width;
+         level_height = slice->height;
       } else {
          level_width = u_minify(pot_width, i);
          level_height = u_minify(pot_height, i);
       }
 
-      slice->width = level_width;
-      slice->height = level_height;
-
       if (i < 1)
          level_depth = u_minify(depth, i);
       else