turnip: minify image_view extent
authorJonathan Marek <jonathan@marek.ca>
Wed, 12 Feb 2020 03:16:22 +0000 (22:16 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Feb 2020 14:04:20 +0000 (14:04 +0000)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3979>

src/freedreno/vulkan/tu_image.c

index 9f22c93e0ed1d369e67039c782f5bcb6187735d4..d77f3c8df43354e8818f5ba15ed508d2d42ba3ca 100644 (file)
@@ -265,14 +265,15 @@ tu_image_view_init(struct tu_image_view *iview,
    iview->vk_format = pCreateInfo->format;
    iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
 
-   // should we minify?
-   iview->extent = image->extent;
-
    iview->base_layer = range->baseArrayLayer;
    iview->layer_count = tu_get_layerCount(image, range);
    iview->base_mip = range->baseMipLevel;
    iview->level_count = tu_get_levelCount(image, range);
 
+   iview->extent.width = u_minify(image->extent.width, iview->base_mip);
+   iview->extent.height = u_minify(image->extent.height, iview->base_mip);
+   iview->extent.depth = u_minify(image->extent.depth, iview->base_mip);
+
    memset(iview->descriptor, 0, sizeof(iview->descriptor));
 
    struct tu_native_format fmt =
@@ -282,10 +283,10 @@ tu_image_view_init(struct tu_image_view *iview,
 
    uint32_t pitch = tu_image_stride(image, iview->base_mip) / vk_format_get_blockwidth(iview->vk_format);
    enum a6xx_tile_mode tile_mode = tu6_get_image_tile_mode(image, iview->base_mip);
-   uint32_t width = u_minify(image->extent.width, iview->base_mip);
-   uint32_t height = u_minify(image->extent.height, iview->base_mip);
+   uint32_t width = iview->extent.width;
+   uint32_t height = iview->extent.height;
    uint32_t depth = pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D ?
-      u_minify(image->extent.depth, iview->base_mip) : iview->layer_count;
+      iview->extent.depth : iview->layer_count;
 
    unsigned fmt_tex = fmt.fmt;
    if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT &&