Mesa (main): vulkan/overlay: Fix violation of VUID-VkMappedMemoryRange-size-01389

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 30 12:03:01 UTC 2021


Module: Mesa
Branch: main
Commit: 4374e7fb4598dcf09a6a8c137db854fc4f5ab328
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4374e7fb4598dcf09a6a8c137db854fc4f5ab328

Author: Pavel Asyutchenko <sventeam at yandex.ru>
Date:   Sun Jul 25 20:11:16 2021 +0300

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 at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12131>

---

 src/vulkan/overlay-layer/overlay.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp
index fb0f52912f9..270dd9b39e1 100644
--- a/src/vulkan/overlay-layer/overlay.cpp
+++ b/src/vulkan/overlay-layer/overlay.cpp
@@ -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,



More information about the mesa-commit mailing list