| 11143 | } |
| 11144 | |
| 11145 | VkResult VmaAllocation_T::DedicatedAllocMap(VmaAllocator hAllocator, void** ppData) |
| 11146 | { |
| 11147 | VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED); |
| 11148 | 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."); |
| 11149 | |
| 11150 | EnsureExtraData(hAllocator); |
| 11151 | |
| 11152 | if (m_MapCount != 0 || IsPersistentMap()) |
| 11153 | { |
| 11154 | if (m_MapCount < 0xFF) |
| 11155 | { |
| 11156 | VMA_ASSERT(m_DedicatedAllocation.m_ExtraData->m_pMappedData != VMA_NULL); |
| 11157 | *ppData = m_DedicatedAllocation.m_ExtraData->m_pMappedData; |
| 11158 | ++m_MapCount; |
| 11159 | return VK_SUCCESS; |
| 11160 | } |
| 11161 | |
| 11162 | VMA_ASSERT(0 && "Dedicated allocation mapped too many times simultaneously."); |
| 11163 | return VK_ERROR_MEMORY_MAP_FAILED; |
| 11164 | } |
| 11165 | |
| 11166 | VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)( |
| 11167 | hAllocator->m_hDevice, |
| 11168 | m_DedicatedAllocation.m_hMemory, |
| 11169 | 0, // offset |
| 11170 | VK_WHOLE_SIZE, |
| 11171 | 0, // flags |
| 11172 | ppData); |
| 11173 | if (result == VK_SUCCESS) |
| 11174 | { |
| 11175 | m_DedicatedAllocation.m_ExtraData->m_pMappedData = *ppData; |
| 11176 | m_MapCount = 1; |
| 11177 | } |
| 11178 | return result; |
| 11179 | } |
| 11180 | |
| 11181 | void VmaAllocation_T::DedicatedAllocUnmap(VmaAllocator hAllocator) |
| 11182 | { |