Skip to content

Detect DEVICE_LOCAL | HOST_VISIBLE machines and apply VMA_ALLOCATION_CREATE_HOST_ACCESS_* automatically #515

@spencer-lunarg

Description

@spencer-lunarg

Something I have found is some drivers (like Lavapipe or Intel's new Metor Lake chip) will have all their memory types as DEVICE_LOCAL | HOST_VISIBLE

What this leads to is going

VmaAllocationCreateInfo alloc_ci = {};
alloc_ci.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
alloc_ci.flags = 0;

and then later our code will go

VkMemoryPropertyFlags mem_prop_flags = {};
vmaGetAllocationMemoryProperties(vma_allocator, allocation, &mem_prop_flags);
if (mem_prop_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
    vmaMapMemory(gpuav.vma_allocator_, allocation, &mapped_ptr);

and hit a

vk_mem_alloc.h:11057: void VmaAllocation_T::BlockAllocMap(): Assertion `IsMappingAllowed() && "Mapping is not allowed on this allocation! Please use one of the new VMA_ALLOCATION_CREATE_HOST_ACCESS_* flags when creating it."' failed.


Our work around is detecting if there is no dedicated device local machine and then setting

alloc_ci.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;

Raising this issue as not sure if this is a feature request to have VMA detect everything is mappable and set FLAG_MAPPING_ALLOWED for us

... or if this is us not using VMA correctly and there is a better pattern to this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions