| 15844 | } |
| 15845 | |
| 15846 | VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage( |
| 15847 | VmaAllocator allocator, |
| 15848 | VkImage image, |
| 15849 | const VmaAllocationCreateInfo* pCreateInfo, |
| 15850 | VmaAllocation* pAllocation, |
| 15851 | VmaAllocationInfo* pAllocationInfo) |
| 15852 | { |
| 15853 | VMA_ASSERT(allocator && image != VK_NULL_HANDLE && pCreateInfo && pAllocation); |
| 15854 | |
| 15855 | VMA_DEBUG_LOG("vmaAllocateMemoryForImage"); |
| 15856 | |
| 15857 | VMA_DEBUG_GLOBAL_MUTEX_LOCK |
| 15858 | |
| 15859 | VkMemoryRequirements vkMemReq = {}; |
| 15860 | bool requiresDedicatedAllocation = false; |
| 15861 | bool prefersDedicatedAllocation = false; |
| 15862 | allocator->GetImageMemoryRequirements(image, vkMemReq, |
| 15863 | requiresDedicatedAllocation, prefersDedicatedAllocation); |
| 15864 | |
| 15865 | VkResult result = allocator->AllocateMemory( |
| 15866 | vkMemReq, |
| 15867 | requiresDedicatedAllocation, |
| 15868 | prefersDedicatedAllocation, |
| 15869 | VK_NULL_HANDLE, // dedicatedBuffer |
| 15870 | image, // dedicatedImage |
| 15871 | VmaBufferImageUsage::UNKNOWN, // dedicatedBufferImageUsage |
| 15872 | *pCreateInfo, |
| 15873 | VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN, |
| 15874 | 1, // allocationCount |
| 15875 | pAllocation); |
| 15876 | |
| 15877 | if(pAllocationInfo && result == VK_SUCCESS) |
| 15878 | { |
| 15879 | allocator->GetAllocationInfo(*pAllocation, pAllocationInfo); |
| 15880 | } |
| 15881 | |
| 15882 | return result; |
| 15883 | } |
| 15884 | |
| 15885 | VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory( |
| 15886 | VmaAllocator allocator, |