v3dv: store base mip level in the image view
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 16 Dec 2019 13:21:29 +0000 (14:21 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:25 +0000 (21:21 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_image.c
src/broadcom/vulkan/v3dv_private.h

index d4badd4..e149ae9 100644 (file)
@@ -358,16 +358,18 @@ v3dv_CreateImageView(VkDevice _device,
 
    iview->image = image;
    iview->aspects = range->aspectMask;
+
+   iview->base_level = range->baseMipLevel;
    iview->extent = (VkExtent3D) {
-      .width  = u_minify(image->extent.width , range->baseMipLevel),
-      .height = u_minify(image->extent.height, range->baseMipLevel),
-      .depth  = u_minify(image->extent.depth , range->baseMipLevel),
+      .width  = u_minify(image->extent.width , iview->base_level),
+      .height = u_minify(image->extent.height, iview->base_level),
+      .depth  = u_minify(image->extent.depth , iview->base_level),
    };
 
    iview->first_layer = range->baseArrayLayer;
    iview->last_layer = range->baseArrayLayer +
                        v3dv_layer_count(image, range) - 1;
-   iview->offset = layer_offset(image, range->baseMipLevel, iview->first_layer);
+   iview->offset = layer_offset(image, iview->base_level, iview->first_layer);
 
    iview->tiling = image->slices[0].tiling;
 
index 616fc75..7d00e17 100644 (file)
@@ -281,6 +281,7 @@ struct v3dv_image_view {
    uint32_t internal_bpp;
    uint32_t internal_type;
 
+   uint32_t base_level;
    uint32_t first_layer;
    uint32_t last_layer;
    uint32_t offset;