MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / DedicatedAllocMap

Method DedicatedAllocMap

include/vk_mem_alloc.h:11468–11502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11466}
11467
11468VkResult VmaAllocation_T::DedicatedAllocMap(VmaAllocator hAllocator, void** ppData)
11469{
11470 VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);
11471 VMA_ASSERT(IsMappingAllowed() && "Mapping is not allowed on this allocation! Please use one of the new VMA_ALLOCATION_CREATE_HOST_ACCESS_* flags when creating it.");
11472
11473 EnsureExtraData(hAllocator);
11474
11475 if (m_MapCount != 0 || IsPersistentMap())
11476 {
11477 if (m_MapCount < 0xFF)
11478 {
11479 VMA_ASSERT(m_DedicatedAllocation.m_ExtraData->m_pMappedData != VMA_NULL);
11480 *ppData = m_DedicatedAllocation.m_ExtraData->m_pMappedData;
11481 ++m_MapCount;
11482 return VK_SUCCESS;
11483 }
11484
11485 VMA_ASSERT(0 && "Dedicated allocation mapped too many times simultaneously.");
11486 return VK_ERROR_MEMORY_MAP_FAILED;
11487 }
11488
11489 VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(
11490 hAllocator->m_hDevice,
11491 m_DedicatedAllocation.m_hMemory,
11492 0, // offset
11493 VK_WHOLE_SIZE,
11494 0, // flags
11495 ppData);
11496 if (result == VK_SUCCESS)
11497 {
11498 m_DedicatedAllocation.m_ExtraData->m_pMappedData = *ppData;
11499 m_MapCount = 1;
11500 }
11501 return result;
11502}
11503
11504void VmaAllocation_T::DedicatedAllocUnmap(VmaAllocator hAllocator)
11505{

Callers 1

MapMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected