Class GPUMemoryBuffer

Inheritance Relationships

Derived Types

Class Documentation

class inexor::vulkan_renderer::wrapper::GPUMemoryBuffer

RAII wrapper class for GPU Memory buffers. Uniform buffers or vertex/index buffers use this as a base class.

Note

The core of Inexor’s memory management is Vulkan Memory Allocator library (VMA).

Subclassed by inexor::vulkan_renderer::wrapper::StagingBuffer, inexor::vulkan_renderer::wrapper::UniformBuffer

Public Functions

GPUMemoryBuffer(const Device &device, const std::string &name, const VkDeviceSize &size, const VkBufferUsageFlags &buffer_usage, const VmaMemoryUsage &memory_usage)

Construct the GPU memory buffer without specifying the actual data to fill in, only the memory size.

Parameters
  • device – The const reference to a device RAII wrapper instance.

  • name – The internal debug marker name of the GPU memory buffer.

  • buffer_size – The size of the memory buffer in bytes.

  • buffer_usage – The buffer usage flags.

  • memory_usage – The VMA memory usage flags which specify the required memory allocation.

GPUMemoryBuffer(const Device &device, const std::string &name, const VkDeviceSize &buffer_size, void *data, std::size_t data_size, const VkBufferUsageFlags &buffer_usage, const VmaMemoryUsage &memory_usage)

Construct the GPU memory buffer and specifies the actual data to fill it in.

Parameters
  • device – The const reference to a device RAII wrapper instance.

  • name – The internal debug marker name of the GPU memory buffer.

  • buffer_size – The size of the memory buffer in bytes.

  • data – A pointer to the data to fill the GPU memory buffer with.

  • data_size – The size of the memory to copy from data pointer.

  • buffer_usage – The buffer usage flags.

  • memory_usage – The VMA memory usage flags which specify the required memory allocation.

GPUMemoryBuffer(const GPUMemoryBuffer&) = delete
GPUMemoryBuffer(GPUMemoryBuffer&&) noexcept
virtual ~GPUMemoryBuffer()
GPUMemoryBuffer &operator=(const GPUMemoryBuffer&) = delete
GPUMemoryBuffer &operator=(GPUMemoryBuffer&&) = delete
inline const std::string &name() const
inline VkBuffer buffer() const
inline VmaAllocation allocation() const
inline VmaAllocationInfo allocation_info() const
inline VmaAllocationCreateInfo allocation_create_info() const

Protected Attributes

std::string m_name
const Device &m_device
VkBuffer m_buffer = {VK_NULL_HANDLE}
VkDeviceSize m_buffer_size = {0}
VmaAllocation m_allocation = {VK_NULL_HANDLE}
VmaAllocationInfo m_allocation_info = {}
VmaAllocationCreateInfo m_allocation_ci = {}