vulkan/overlay: Fix violation of VUID-VkMappedMemoryRange-size-01389

Mapping lentgh must be a multiple of 'nonCoherentAtomSize' bytes
when using VK_WHOLE_SIZE in vkFlushMappedMemoryRanges.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12131>
This commit is contained in:
Pavel Asyutchenko 2021-07-25 20:11:16 +03:00 committed by Marge Bot
parent 175bc33da7
commit 4374e7fb45

View file

@ -41,6 +41,7 @@
#include "util/os_time.h"
#include "util/os_socket.h"
#include "util/simple_mtx.h"
#include "util/u_math.h"
#include "vk_enum_to_str.h"
#include "vk_dispatch_table.h"
@ -1217,8 +1218,8 @@ static struct overlay_draw *render_swapchain_display(struct swapchain_data *data
VK_SUBPASS_CONTENTS_INLINE);
/* Create/Resize vertex & index buffers */
size_t vertex_size = draw_data->TotalVtxCount * sizeof(ImDrawVert);
size_t index_size = draw_data->TotalIdxCount * sizeof(ImDrawIdx);
size_t vertex_size = ALIGN(draw_data->TotalVtxCount * sizeof(ImDrawVert), device_data->properties.limits.nonCoherentAtomSize);
size_t index_size = ALIGN(draw_data->TotalIdxCount * sizeof(ImDrawIdx), device_data->properties.limits.nonCoherentAtomSize);
if (draw->vertex_buffer_size < vertex_size) {
CreateOrResizeBuffer(device_data,
&draw->vertex_buffer,