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

Function vmaCreateAliasingBuffer2

include/vk_mem_alloc.h:16453–16497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16451}
16452
16453VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAliasingBuffer2(
16454 VmaAllocator VMA_NOT_NULL allocator,
16455 VmaAllocation VMA_NOT_NULL allocation,
16456 VkDeviceSize allocationLocalOffset,
16457 const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,
16458 VkBuffer VMA_NULLABLE_NON_DISPATCHABLE* VMA_NOT_NULL pBuffer)
16459{
16460 VMA_ASSERT(allocator && pBufferCreateInfo && pBuffer && allocation);
16461 VMA_ASSERT(allocationLocalOffset + pBufferCreateInfo->size <= allocation->GetSize());
16462
16463 VMA_DEBUG_LOG("vmaCreateAliasingBuffer2");
16464
16465 *pBuffer = VK_NULL_HANDLE;
16466
16467 if (pBufferCreateInfo->size == 0)
16468 {
16469 return VK_ERROR_INITIALIZATION_FAILED;
16470 }
16471 if ((pBufferCreateInfo->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY) != 0 &&
16472 !allocator->m_UseKhrBufferDeviceAddress)
16473 {
16474 VMA_ASSERT(0 && "Creating a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT is not valid if VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT was not used.");
16475 return VK_ERROR_INITIALIZATION_FAILED;
16476 }
16477
16478 VMA_DEBUG_GLOBAL_MUTEX_LOCK
16479
16480 // 1. Create VkBuffer.
16481 VkResult res = (*allocator->GetVulkanFunctions().vkCreateBuffer)(
16482 allocator->m_hDevice,
16483 pBufferCreateInfo,
16484 allocator->GetAllocationCallbacks(),
16485 pBuffer);
16486 if (res >= 0)
16487 {
16488 // 2. Bind buffer with memory.
16489 res = allocator->BindBufferMemory(allocation, allocationLocalOffset, *pBuffer, VMA_NULL);
16490 if (res >= 0)
16491 {
16492 return VK_SUCCESS;
16493 }
16494 (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());
16495 }
16496 return res;
16497}
16498
16499VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(
16500 VmaAllocator allocator,

Callers 1

vmaCreateAliasingBufferFunction · 0.85

Calls 3

BindBufferMemoryMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected