Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mapped memory Vulkan validation error #3957

Closed
wants to merge 1 commit into from

Commits on Mar 21, 2021

  1. Fix mapped memory Vulkan validation error

    If using Vulkan backend and either vertex_size or index_size is not
    aligned to VkPhysicalDeviceLimits::nonCoherentAtomSize, then the call to
    vkFlushMappedMemoryRanges in ImGui_ImplVulkan_RenderDrawData will result
    in the following validation error (on some drivers/cards):
    
    Validation Error: [ VUID-VkMappedMemoryRange-size-01389 ] Object 0:
    handle = 0xb200000000b2, type = VK_OBJECT_TYPE_DEVICE_MEMORY; |
    MessageID = 0xee4872d | vkFlushMappedMemoryRanges: Size in
    pMemRanges[1] is VK_WHOLE_SIZE and the mapping end (0x792 = 0x0 + 0x792)
    not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x40) and
    not equal to the end of the memory object (0x800). The Vulkan spec
    states: If size is equal to VK_WHOLE_SIZE, the end of the current
    mapping of memory must either be a multiple of
    VkPhysicalDeviceLimits::nonCoherentAtomSize bytes from the beginning of
    the memory object, or be equal to the end of the memory object
    (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkMappedMemoryRange-size-01389)
    
    Fix this by setting rb->VertexBufferSize and rb->IndexBufferSize to the
    aligned size in CreateOrResizeBuffer, and then using them as the size
    parameter in the calls to vkMapMemory.
    AgentX1994 committed Mar 21, 2021
    Configuration menu
    Copy the full SHA
    a9fabf4 View commit details
    Browse the repository at this point in the history