mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +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> (cherry picked from commitcef48af271)
This commit is contained in:
parent
ec27b06cf6
commit
46d835f823
2 changed files with 9 additions and 4 deletions
|
|
@ -9704,7 +9704,7 @@
|
||||||
"description": "tu: bind aliased wsi image at memory offset zero",
|
"description": "tu: bind aliased wsi image at memory offset zero",
|
||||||
"nominated": true,
|
"nominated": true,
|
||||||
"nomination_type": 2,
|
"nomination_type": 2,
|
||||||
"resolution": 0,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": "f887116c499e658604aef933f142ba00233950ae",
|
"because_sha": "f887116c499e658604aef933f142ba00233950ae",
|
||||||
"notes": null
|
"notes": null
|
||||||
|
|
|
||||||
|
|
@ -912,6 +912,7 @@ tu_BindImageMemory2(VkDevice _device,
|
||||||
for (uint32_t i = 0; i < bindInfoCount; ++i) {
|
for (uint32_t i = 0; i < bindInfoCount; ++i) {
|
||||||
VK_FROM_HANDLE(tu_image, image, pBindInfos[i].image);
|
VK_FROM_HANDLE(tu_image, image, pBindInfos[i].image);
|
||||||
VK_FROM_HANDLE(tu_device_memory, mem, pBindInfos[i].memory);
|
VK_FROM_HANDLE(tu_device_memory, mem, pBindInfos[i].memory);
|
||||||
|
uint64_t offset = pBindInfos[i].memoryOffset;
|
||||||
|
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
#if DETECT_OS_ANDROID
|
#if DETECT_OS_ANDROID
|
||||||
|
|
@ -925,6 +926,10 @@ tu_BindImageMemory2(VkDevice _device,
|
||||||
swapchain_info->swapchain != VK_NULL_HANDLE);
|
swapchain_info->swapchain != VK_NULL_HANDLE);
|
||||||
mem = tu_device_memory_from_handle(wsi_common_get_memory(
|
mem = tu_device_memory_from_handle(wsi_common_get_memory(
|
||||||
swapchain_info->swapchain, swapchain_info->imageIndex));
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -956,8 +961,8 @@ tu_BindImageMemory2(VkDevice _device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
image->bo = mem->bo;
|
image->bo = mem->bo;
|
||||||
image->bo_offset = pBindInfos[i].memoryOffset;
|
image->bo_offset = offset;
|
||||||
image->iova = mem->bo->iova + pBindInfos[i].memoryOffset;
|
image->iova = mem->bo->iova + offset;
|
||||||
|
|
||||||
if (image->vk.usage & (VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT |
|
if (image->vk.usage & (VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT |
|
||||||
VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT)) {
|
VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT)) {
|
||||||
|
|
@ -970,7 +975,7 @@ tu_BindImageMemory2(VkDevice _device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
image->map = (char *) mem->bo->map + pBindInfos[i].memoryOffset;
|
image->map = (char *) mem->bo->map + offset;
|
||||||
} else {
|
} else {
|
||||||
image->map = NULL;
|
image->map = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue