mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 07:48:07 +02:00
tu: bind aliased wsi image at memory offset zero
The vulkan spec says that we should ignore memoryOffset when
VkBindImageMemorySwapchainInfoKHR is present. wsi common assumes that we
bind the wsi image at offset 0, so set the offset to 0. This change
aligns with common wsi, and also obeys dedicated alloc requirement.
Fixes: f887116c49 ("turnip: adopt wsi_common_get_memory")
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37099>
This commit is contained in:
parent
ee7666e3df
commit
cef48af271
1 changed files with 8 additions and 3 deletions
|
|
@ -953,6 +953,7 @@ tu_BindImageMemory2(VkDevice _device,
|
|||
for (uint32_t i = 0; i < bindInfoCount; ++i) {
|
||||
VK_FROM_HANDLE(tu_image, image, pBindInfos[i].image);
|
||||
VK_FROM_HANDLE(tu_device_memory, mem, pBindInfos[i].memory);
|
||||
uint64_t offset = pBindInfos[i].memoryOffset;
|
||||
|
||||
if (!mem) {
|
||||
#if DETECT_OS_ANDROID
|
||||
|
|
@ -966,6 +967,10 @@ tu_BindImageMemory2(VkDevice _device,
|
|||
swapchain_info->swapchain != VK_NULL_HANDLE);
|
||||
mem = tu_device_memory_from_handle(wsi_common_get_memory(
|
||||
swapchain_info->swapchain, swapchain_info->imageIndex));
|
||||
/* memoryOffset is ignored when VkBindImageMemorySwapchainInfoKHR is
|
||||
* present, so we follow common wsi to set the offset to 0 here.
|
||||
*/
|
||||
offset = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -997,8 +1002,8 @@ tu_BindImageMemory2(VkDevice _device,
|
|||
}
|
||||
}
|
||||
image->bo = mem->bo;
|
||||
image->bo_offset = pBindInfos[i].memoryOffset;
|
||||
image->iova = mem->bo->iova + pBindInfos[i].memoryOffset;
|
||||
image->bo_offset = offset;
|
||||
image->iova = mem->bo->iova + offset;
|
||||
|
||||
if (image->vk.usage & (VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT |
|
||||
VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT)) {
|
||||
|
|
@ -1011,7 +1016,7 @@ tu_BindImageMemory2(VkDevice _device,
|
|||
}
|
||||
}
|
||||
|
||||
image->map = (char *) mem->bo->map + pBindInfos[i].memoryOffset;
|
||||
image->map = (char *) mem->bo->map + offset;
|
||||
} else {
|
||||
image->map = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue