vkAllocateMemory
vkAllocateMemory is a Vulkan API function that allocates a VkDeviceMemory object from a logical device. It creates a memory object that can later be bound to buffers or images. The allocation is described by a VkMemoryAllocateInfo structure, which specifies the allocation size and the memory type index from which the memory is to be carved. The function returns the allocated handle in pMemory. The allocation is performed using the device’s memory heaps described by the physical device’s memory properties, and the allocation uses the optional allocator pAllocator if provided.
Prototype: VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
Parameters: device is the logical device used for the allocation; pAllocateInfo must specify allocationSize and memoryTypeIndex;
Usage: After a successful allocation, the VkDeviceMemory handle can be bound to a buffer with vkBindBufferMemory
Return values: VK_SUCCESS on success; common errors include VK_ERROR_OUT_OF_HOST_MEMORY, VK_ERROR_OUT_OF_DEVICE_MEMORY, and VK_ERROR_TOO_MANY_OBJECTS if resource limits are