An image can be suballocated from a larger memory allocation, in which
case we get a memory offset for the start of the bound region at
vkBindImageMemory. Take that offset into account when doing image
addressing calculations.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
const struct v3d_resource_slice *slice = &image->slices[level];
if (image->type == VK_IMAGE_TYPE_3D)
- return slice->offset + layer * slice->size;
+ return image->mem_offset + slice->offset + layer * slice->size;
else
- return slice->offset + layer * image->cube_map_stride;
+ return image->mem_offset + slice->offset + layer * image->cube_map_stride;
}
VkResult