mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-23 08:20:25 +01:00
radv: return per plane requirements for disjoint images
Returning the whole image size/alignment isn't wrong but it's wasteful for disjoint images which requires a separate bound memory object per plane. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10997 Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28808>
This commit is contained in:
parent
e18cc3b39b
commit
54b08d6bbf
1 changed files with 17 additions and 2 deletions
|
|
@ -1385,12 +1385,27 @@ radv_GetImageMemoryRequirements2(VkDevice _device, const VkImageMemoryRequiremen
|
|||
VK_FROM_HANDLE(radv_device, device, _device);
|
||||
VK_FROM_HANDLE(radv_image, image, pInfo->image);
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
uint32_t alignment;
|
||||
uint64_t size;
|
||||
|
||||
const VkImagePlaneMemoryRequirementsInfo *plane_info =
|
||||
vk_find_struct_const(pInfo->pNext, IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO);
|
||||
|
||||
if (plane_info) {
|
||||
const uint32_t plane = radv_plane_from_aspect(plane_info->planeAspect);
|
||||
|
||||
size = image->planes[plane].surface.total_size;
|
||||
alignment = 1 << image->planes[plane].surface.alignment_log2;
|
||||
} else {
|
||||
size = image->size;
|
||||
alignment = image->alignment;
|
||||
}
|
||||
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits =
|
||||
((1u << pdev->memory_properties.memoryTypeCount) - 1u) & ~pdev->memory_types_32bit;
|
||||
|
||||
pMemoryRequirements->memoryRequirements.size = image->size;
|
||||
pMemoryRequirements->memoryRequirements.alignment = image->alignment;
|
||||
pMemoryRequirements->memoryRequirements.size = size;
|
||||
pMemoryRequirements->memoryRequirements.alignment = alignment;
|
||||
|
||||
vk_foreach_struct (ext, pMemoryRequirements->pNext) {
|
||||
switch (ext->sType) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue