pvr: fix mipmap size calculation for bc formats

The block size given by vk_format_get_blocksize is in blocks, not
texels.

dEQP tests affected:
  dEQP-VK.pipeline.monolithic.image_view.view_type*
    .format.eac*lod_base_mip_level

Fixes: 8991e6464 ("pvr: Add a Vulkan driver for Imagination Technologies PowerVR Rogue GPUs")
Signed-off-by: SoroushIMG <soroush.kashani@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25344>
This commit is contained in:
SoroushIMG
2023-06-17 13:59:00 +01:00
committed by Marge Bot
parent e037761a2f
commit 3808cb0696

View File

@@ -85,6 +85,8 @@ static void pvr_image_setup_mip_levels(struct pvr_image *image)
const uint32_t extent_alignment =
image->vk.image_type == VK_IMAGE_TYPE_3D ? 4 : 1;
const unsigned int cpp = vk_format_get_blocksize(image->vk.format);
VkExtent3D extent =
vk_image_extent_to_elements(&image->vk, image->physical_extent);
/* Mip-mapped textures that are non-dword aligned need dword-aligned levels
* so they can be TQd from.
@@ -96,9 +98,9 @@ static void pvr_image_setup_mip_levels(struct pvr_image *image)
image->layer_size = 0;
for (uint32_t i = 0; i < image->vk.mip_levels; i++) {
const uint32_t height = u_minify(image->physical_extent.height, i);
const uint32_t width = u_minify(image->physical_extent.width, i);
const uint32_t depth = u_minify(image->physical_extent.depth, i);
const uint32_t height = u_minify(extent.height, i);
const uint32_t width = u_minify(extent.width, i);
const uint32_t depth = u_minify(extent.depth, i);
struct pvr_mip_level *mip_level = &image->mip_levels[i];
mip_level->pitch = cpp * ALIGN(width, extent_alignment);