mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-21 11:50:04 +00:00
VmaAllocator_T::AllocateMemoryOfType: Fixed major bug when VMA_ALLOCATION_CREATE_PERSISTENT_MAP_BIT is used with VMA_MEMORY_USAGE_GPU_ONLY.
This commit is contained in:
parent
0fcf86292b
commit
ee92a03f59
Binary file not shown.
@ -6496,12 +6496,19 @@ VkResult VmaAllocator_T::AllocateMemoryOfType(
|
||||
VMA_ASSERT(pAllocation != VMA_NULL);
|
||||
VMA_DEBUG_LOG(" AllocateMemory: MemoryTypeIndex=%u, Size=%llu", memTypeIndex, vkMemReq.size);
|
||||
|
||||
uint32_t blockVectorType = VmaAllocationCreateFlagsToBlockVectorType(createInfo.flags);
|
||||
VmaAllocationCreateInfo finalCreateInfo = createInfo;
|
||||
|
||||
// If memory type is not HOST_VISIBLE, disable PERSISTENT_MAP.
|
||||
if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_PERSISTENT_MAP_BIT) != 0 &&
|
||||
(m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
|
||||
{
|
||||
finalCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_PERSISTENT_MAP_BIT;
|
||||
}
|
||||
|
||||
uint32_t blockVectorType = VmaAllocationCreateFlagsToBlockVectorType(finalCreateInfo.flags);
|
||||
VmaBlockVector* const blockVector = m_pBlockVectors[memTypeIndex][blockVectorType];
|
||||
VMA_ASSERT(blockVector);
|
||||
|
||||
VmaAllocationCreateInfo finalCreateInfo = createInfo;
|
||||
|
||||
const VkDeviceSize preferredBlockSize = blockVector->GetPreferredBlockSize();
|
||||
bool preferDedicatedMemory =
|
||||
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ||
|
||||
@ -6516,13 +6523,6 @@ VkResult VmaAllocator_T::AllocateMemoryOfType(
|
||||
finalCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
|
||||
}
|
||||
|
||||
// If memory type is not HOST_VISIBLE, disable PERSISTENT_MAP.
|
||||
if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_PERSISTENT_MAP_BIT) != 0 &&
|
||||
(m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
|
||||
{
|
||||
finalCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_PERSISTENT_MAP_BIT;
|
||||
}
|
||||
|
||||
if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT) != 0)
|
||||
{
|
||||
if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user