| 13634 | } |
| 13635 | |
| 13636 | VkResult VmaAllocator_T::AllocateDedicatedMemory( |
| 13637 | VmaPool pool, |
| 13638 | VkDeviceSize size, |
| 13639 | VmaSuballocationType suballocType, |
| 13640 | VmaDedicatedAllocationList& dedicatedAllocations, |
| 13641 | uint32_t memTypeIndex, |
| 13642 | bool map, |
| 13643 | bool isUserDataString, |
| 13644 | bool isMappingAllowed, |
| 13645 | bool canAliasMemory, |
| 13646 | void* pUserData, |
| 13647 | float priority, |
| 13648 | VkBuffer dedicatedBuffer, |
| 13649 | VkImage dedicatedImage, |
| 13650 | VmaBufferImageUsage dedicatedBufferImageUsage, |
| 13651 | size_t allocationCount, |
| 13652 | VmaAllocation* pAllocations, |
| 13653 | const void* pNextChain) |
| 13654 | { |
| 13655 | VMA_ASSERT(allocationCount > 0 && pAllocations); |
| 13656 | |
| 13657 | VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO }; |
| 13658 | allocInfo.memoryTypeIndex = memTypeIndex; |
| 13659 | allocInfo.allocationSize = size; |
| 13660 | allocInfo.pNext = pNextChain; |
| 13661 | |
| 13662 | #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000 |
| 13663 | VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR }; |
| 13664 | if(!canAliasMemory) |
| 13665 | { |
| 13666 | if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) |
| 13667 | { |
| 13668 | if(dedicatedBuffer != VK_NULL_HANDLE) |
| 13669 | { |
| 13670 | VMA_ASSERT(dedicatedImage == VK_NULL_HANDLE); |
| 13671 | dedicatedAllocInfo.buffer = dedicatedBuffer; |
| 13672 | VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo); |
| 13673 | } |
| 13674 | else if(dedicatedImage != VK_NULL_HANDLE) |
| 13675 | { |
| 13676 | dedicatedAllocInfo.image = dedicatedImage; |
| 13677 | VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo); |
| 13678 | } |
| 13679 | } |
| 13680 | } |
| 13681 | #endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000 |
| 13682 | |
| 13683 | #if VMA_BUFFER_DEVICE_ADDRESS |
| 13684 | VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR }; |
| 13685 | if(m_UseKhrBufferDeviceAddress) |
| 13686 | { |
| 13687 | bool canContainBufferWithDeviceAddress = true; |
| 13688 | if(dedicatedBuffer != VK_NULL_HANDLE) |
| 13689 | { |
| 13690 | canContainBufferWithDeviceAddress = dedicatedBufferImageUsage == VmaBufferImageUsage::UNKNOWN || |
| 13691 | dedicatedBufferImageUsage.Contains(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT); |
| 13692 | } |
| 13693 | else if(dedicatedImage != VK_NULL_HANDLE) |
nothing calls this directly
no test coverage detected