UgBuffer
Generic GPU buffer allocation and upload
It
GPU buffer with its backing device memory
struct It {
VkBuffer handle;
VkDeviceMemory memory;
};create
Allocate a GPU buffer with the specified usage
UgBuffer.It create(UgContext.It& ctx, U32 size, VkBufferUsageFlagBits usage);Parameters
ctx— Vulkan contextsize— Size in bytesusage— Buffer usage flags
Returns — Allocated buffer object
upload
Upload data from CPU memory into a GPU buffer
U0 upload(UgContext.It& ctx, UgBuffer.It& buffer, U0* data, U32 size);Parameters
ctx— Vulkan contextbuffer— Destination bufferdata— Pointer to source datasize— Number of bytes to upload
destroy
Destroy a GPU buffer and free its device memory
U0 destroy(UgContext.It& ctx, UgBuffer.It& buffer);Parameters
ctx— Vulkan contextbuffer— Buffer to destroy