| 10887 | } |
| 10888 | |
| 10889 | VkResult VmaDeviceMemoryBlock::BindImageMemory( |
| 10890 | VmaAllocator hAllocator, |
| 10891 | VmaAllocation hAllocation, |
| 10892 | VkDeviceSize allocationLocalOffset, |
| 10893 | VkImage hImage, |
| 10894 | const void* pNext) |
| 10895 | { |
| 10896 | VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK && |
| 10897 | hAllocation->GetBlock() == this); |
| 10898 | VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() && |
| 10899 | "Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?"); |
| 10900 | const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset; |
| 10901 | // This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads. |
| 10902 | VmaMutexLock lock(m_MapAndBindMutex, hAllocator->m_UseMutex); |
| 10903 | return hAllocator->BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext); |
| 10904 | } |
| 10905 | |
| 10906 | #if VMA_EXTERNAL_MEMORY_WIN32 |
| 10907 | VkResult VmaDeviceMemoryBlock::CreateWin32Handle(const VmaAllocator hAllocator, PFN_vkGetMemoryWin32HandleKHR pvkGetMemoryWin32HandleKHR, HANDLE hTargetProcess, HANDLE* pHandle) noexcept |