vk/image: Fix the view extent of uncompressed views of compressed images
The view extent needs to be divided by the block width/height/depth in that case. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29333>
This commit is contained in:

committed by
Marge Bot

parent
6ff9b8c36b
commit
8ddc527ba4
@@ -535,6 +535,23 @@ vk_image_view_init(struct vk_device *device,
|
||||
image_view->extent =
|
||||
vk_image_mip_level_extent(image, image_view->base_mip_level);
|
||||
|
||||
if (vk_format_is_compressed(image->format) &&
|
||||
!vk_format_is_compressed(image_view->format)) {
|
||||
const struct util_format_description *fmt =
|
||||
vk_format_description(image_view->format);
|
||||
|
||||
/* Non-compressed view of compressed image only works for single MIP
|
||||
* views.
|
||||
*/
|
||||
assert(image_view->level_count == 1);
|
||||
image_view->extent.width =
|
||||
DIV_ROUND_UP(image_view->extent.width, fmt->block.width);
|
||||
image_view->extent.height =
|
||||
DIV_ROUND_UP(image_view->extent.height, fmt->block.height);
|
||||
image_view->extent.depth =
|
||||
DIV_ROUND_UP(image_view->extent.depth, fmt->block.depth);
|
||||
}
|
||||
|
||||
/* By default storage uses the same as the image properties, but it can be
|
||||
* overriden with VkImageViewSlicedCreateInfoEXT.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user