MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / Map

Method Map

include/vk_mem_alloc.h:10769–10808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10767}
10768
10769VkResult VmaDeviceMemoryBlock::Map(VmaAllocator hAllocator, uint32_t count, void** ppData)
10770{
10771 if (count == 0)
10772 {
10773 return VK_SUCCESS;
10774 }
10775
10776 VmaMutexLock lock(m_MapAndBindMutex, hAllocator->m_UseMutex);
10777 const uint32_t oldTotalMapCount = m_MapCount + m_MappingHysteresis.GetExtraMapping();
10778 if (oldTotalMapCount != 0)
10779 {
10780 VMA_ASSERT(m_pMappedData != VMA_NULL);
10781 m_MappingHysteresis.PostMap();
10782 m_MapCount += count;
10783 if (ppData != VMA_NULL)
10784 {
10785 *ppData = m_pMappedData;
10786 }
10787 return VK_SUCCESS;
10788 }
10789
10790 VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(
10791 hAllocator->m_hDevice,
10792 m_hMemory,
10793 0, // offset
10794 VK_WHOLE_SIZE,
10795 0, // flags
10796 &m_pMappedData);
10797 if (result == VK_SUCCESS)
10798 {
10799 VMA_ASSERT(m_pMappedData != VMA_NULL);
10800 m_MappingHysteresis.PostMap();
10801 m_MapCount = count;
10802 if (ppData != VMA_NULL)
10803 {
10804 *ppData = m_pMappedData;
10805 }
10806 }
10807 return result;
10808}
10809
10810void VmaDeviceMemoryBlock::Unmap(VmaAllocator hAllocator, uint32_t count)
10811{

Callers 2

DefragmentPassEndMethod · 0.45

Calls 7

GetExtraMappingMethod · 0.80
PostMapMethod · 0.80
GetOffsetMethod · 0.80
BlockAllocMapMethod · 0.80
DedicatedAllocMapMethod · 0.80
GetTypeMethod · 0.45
GetBlockMethod · 0.45

Tested by

no test coverage detected