| 15804 | } |
| 15805 | |
| 15806 | VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer( |
| 15807 | VmaAllocator allocator, |
| 15808 | VkBuffer buffer, |
| 15809 | const VmaAllocationCreateInfo* pCreateInfo, |
| 15810 | VmaAllocation* pAllocation, |
| 15811 | VmaAllocationInfo* pAllocationInfo) |
| 15812 | { |
| 15813 | VMA_ASSERT(allocator && buffer != VK_NULL_HANDLE && pCreateInfo && pAllocation); |
| 15814 | |
| 15815 | VMA_DEBUG_LOG("vmaAllocateMemoryForBuffer"); |
| 15816 | |
| 15817 | VMA_DEBUG_GLOBAL_MUTEX_LOCK |
| 15818 | |
| 15819 | VkMemoryRequirements vkMemReq = {}; |
| 15820 | bool requiresDedicatedAllocation = false; |
| 15821 | bool prefersDedicatedAllocation = false; |
| 15822 | allocator->GetBufferMemoryRequirements(buffer, vkMemReq, |
| 15823 | requiresDedicatedAllocation, |
| 15824 | prefersDedicatedAllocation); |
| 15825 | |
| 15826 | VkResult result = allocator->AllocateMemory( |
| 15827 | vkMemReq, |
| 15828 | requiresDedicatedAllocation, |
| 15829 | prefersDedicatedAllocation, |
| 15830 | buffer, // dedicatedBuffer |
| 15831 | VK_NULL_HANDLE, // dedicatedImage |
| 15832 | VmaBufferImageUsage::UNKNOWN, // dedicatedBufferImageUsage |
| 15833 | *pCreateInfo, |
| 15834 | VMA_SUBALLOCATION_TYPE_BUFFER, |
| 15835 | 1, // allocationCount |
| 15836 | pAllocation); |
| 15837 | |
| 15838 | if(pAllocationInfo && result == VK_SUCCESS) |
| 15839 | { |
| 15840 | allocator->GetAllocationInfo(*pAllocation, pAllocationInfo); |
| 15841 | } |
| 15842 | |
| 15843 | return result; |
| 15844 | } |
| 15845 | |
| 15846 | VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage( |
| 15847 | VmaAllocator allocator, |