v3dv: be more precise in vkGetImageSubresourceLayout

Only return non-zero values for arrayPitch and depthPitch if
they make sense for the image type.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25074>
This commit is contained in:
Iago Toral Quiroga 2023-09-05 12:39:42 +02:00 committed by Marge Bot
parent 8019a1b929
commit 717fbda536

View file

@ -565,8 +565,10 @@ v3dv_GetImageSubresourceLayout(VkDevice device,
v3dv_layer_offset(image, subresource->mipLevel, subresource->arrayLayer,
plane) - image->planes[plane].mem_offset;
layout->rowPitch = slice->stride;
layout->depthPitch = image->planes[plane].cube_map_stride;
layout->arrayPitch = image->planes[plane].cube_map_stride;
layout->depthPitch = image->vk.image_type == VK_IMAGE_TYPE_3D ?
image->planes[plane].cube_map_stride : 0;
layout->arrayPitch = image->vk.array_layers > 1 ?
image->planes[plane].cube_map_stride : 0;
if (image->vk.image_type != VK_IMAGE_TYPE_3D) {
layout->size = slice->size;