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 context
  • size — Size in bytes
  • usage — 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 context
  • buffer — Destination buffer
  • data — Pointer to source data
  • size — 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 context
  • buffer — Buffer to destroy