MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / CommitAllocationRequest

Method CommitAllocationRequest

include/vk_mem_alloc.h:11764–11815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11762}
11763
11764VkResult VmaBlockVector::CommitAllocationRequest(
11765 VmaAllocationRequest& allocRequest,
11766 VmaDeviceMemoryBlock* pBlock,
11767 VkDeviceSize alignment,
11768 VmaAllocationCreateFlags allocFlags,
11769 void* pUserData,
11770 VmaSuballocationType suballocType,
11771 VmaAllocation* pAllocation)
11772{
11773 const bool mapped = (allocFlags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
11774 const bool isUserDataString = (allocFlags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;
11775 const bool isMappingAllowed = (allocFlags &
11776 (VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT)) != 0;
11777
11778 pBlock->PostAlloc(m_hAllocator);
11779 // Allocate from pCurrBlock.
11780 if (mapped)
11781 {
11782 VkResult res = pBlock->Map(m_hAllocator, 1, VMA_NULL);
11783 if (res != VK_SUCCESS)
11784 {
11785 return res;
11786 }
11787 }
11788
11789 *pAllocation = m_hAllocator->m_AllocationObjectAllocator.Allocate(isMappingAllowed);
11790 pBlock->m_pMetadata->Alloc(allocRequest, suballocType, *pAllocation);
11791 (*pAllocation)->InitBlockAllocation(
11792 pBlock,
11793 allocRequest.allocHandle,
11794 alignment,
11795 allocRequest.size, // Not size, as actual allocation size may be larger than requested!
11796 m_MemoryTypeIndex,
11797 suballocType,
11798 mapped);
11799 VMA_HEAVY_ASSERT(pBlock->Validate());
11800 if (isUserDataString)
11801 (*pAllocation)->SetName(m_hAllocator, (const char*)pUserData);
11802 else
11803 (*pAllocation)->SetUserData(m_hAllocator, pUserData);
11804 m_hAllocator->m_Budget.AddAllocation(m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), allocRequest.size);
11805 if (VMA_DEBUG_INITIALIZE_ALLOCATIONS)
11806 {
11807 m_hAllocator->FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);
11808 }
11809 if (IsCorruptionDetectionEnabled())
11810 {
11811 VkResult res = pBlock->WriteMagicValueAfterAllocation(m_hAllocator, (*pAllocation)->GetOffset(), allocRequest.size);
11812 VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
11813 }
11814 return VK_SUCCESS;
11815}
11816
11817VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)
11818{

Callers 3

ReallocWithinBlockMethod · 0.80

Calls 13

AllocateMethod · 0.80
AllocMethod · 0.80
InitBlockAllocationMethod · 0.80
SetNameMethod · 0.80
SetUserDataMethod · 0.80
AddAllocationMethod · 0.80
FillAllocationMethod · 0.80
GetOffsetMethod · 0.80
PostAllocMethod · 0.45
MapMethod · 0.45

Tested by

no test coverage detected