| 10767 | } |
| 10768 | |
| 10769 | VkResult 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 | |
| 10810 | void VmaDeviceMemoryBlock::Unmap(VmaAllocator hAllocator, uint32_t count) |
| 10811 | { |
no test coverage detected