mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
lavapipe: ensure to use zero memoryOffset for wsi image alias binding
Per spec of VkBindImageMemorySwapchainInfoKHR: > If swapchain is not NULL, the swapchain and imageIndex are used to determine the memory that the image is bound to, instead of memory and memoryOffset. Meanwhile, common wsi is doing dedicated allocation for swapchain image memory, so it's required to use zero memoryOffset by the spec. Then here we can safely set to zero memoryOffset before passing to the actual binding call. In practice, when the struct is initialized with proper sType and memory being VK_NULL_HANDLE, the memoryOffset is most likely left being zero initialized. Not a critical must fix but still a bug. Fixes:ace49d9e52("lavapipe: adopt wsi_common_get_memory") Reviewed-by: Lucas Fryzek <lfryzek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36335> (cherry picked from commit74f53a9293)
This commit is contained in:
parent
d4500d9b56
commit
b187952593
2 changed files with 5 additions and 3 deletions
|
|
@ -2084,7 +2084,7 @@
|
|||
"description": "lavapipe: ensure to use zero memoryOffset for wsi image alias binding",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "ace49d9e52a6156f114ee00eec759d734bd84fc0",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2379,6 +2379,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_BindImageMemory2(VkDevice _device,
|
|||
const VkBindImageMemoryInfo *bind_info = &pBindInfos[i];
|
||||
LVP_FROM_HANDLE(lvp_device_memory, mem, bind_info->memory);
|
||||
LVP_FROM_HANDLE(lvp_image, image, bind_info->image);
|
||||
uint64_t mem_offset = bind_info->memoryOffset;
|
||||
VkBindMemoryStatusKHR *status = (void*)vk_find_struct_const(&pBindInfos[i], BIND_MEMORY_STATUS_KHR);
|
||||
|
||||
if (!mem) {
|
||||
|
|
@ -2392,6 +2393,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_BindImageMemory2(VkDevice _device,
|
|||
assert(swapchain_info && swapchain_info->swapchain != VK_NULL_HANDLE);
|
||||
mem = lvp_device_memory_from_handle(wsi_common_get_memory(
|
||||
swapchain_info->swapchain, swapchain_info->imageIndex));
|
||||
mem_offset = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -2403,7 +2405,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_BindImageMemory2(VkDevice _device,
|
|||
vk_find_struct_const(pBindInfos[i].pNext, BIND_IMAGE_PLANE_MEMORY_INFO);
|
||||
uint8_t plane = lvp_image_aspects_to_plane(image, plane_info->planeAspect);
|
||||
result = lvp_image_plane_bind(device, &image->planes[plane],
|
||||
mem, bind_info->memoryOffset, &offset_B);
|
||||
mem, mem_offset, &offset_B);
|
||||
if (status)
|
||||
*status->pResult = result;
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
@ -2412,7 +2414,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_BindImageMemory2(VkDevice _device,
|
|||
VkResult fail = VK_SUCCESS;
|
||||
for (unsigned plane = 0; plane < image->plane_count; plane++) {
|
||||
result = lvp_image_plane_bind(device, &image->planes[plane],
|
||||
mem, bind_info->memoryOffset + image->offset, &offset_B);
|
||||
mem, mem_offset + image->offset, &offset_B);
|
||||
if (status)
|
||||
*status->pResult = res;
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue