Hymn to Beauty
C++ 3D Engine
Video::BufferAllocator Class Referenceabstract

Responsible for allocating buffers. More...

#include <BufferAllocator.hpp>

Inheritance diagram for Video::BufferAllocator:
Video::OpenGLBufferAllocator Video::VulkanBufferAllocator Video::WebGPUBufferAllocator

Public Member Functions

 BufferAllocator (uint32_t frames)
 Create a new buffer allocator. More...
 
virtual ~BufferAllocator ()
 Destructor. More...
 
void BeginFrame ()
 Call at the beginning of each frame. More...
 
BufferCreateBuffer (Buffer::BufferUsage bufferUsage, uint32_t size, const void *data)
 Create a GPU buffer. More...
 
BufferCreateTemporaryBuffer (Buffer::BufferUsage bufferUsage, uint32_t size, const void *data)
 Create a temporary GPU buffer. More...
 

Static Protected Attributes

static const uint32_t poolSize = 1024 * 1024
 The size of each buffer in the pool. More...
 

Detailed Description

Responsible for allocating buffers.

Constructor & Destructor Documentation

◆ BufferAllocator()

Video::BufferAllocator::BufferAllocator ( uint32_t  frames)
explicit

Create a new buffer allocator.

Parameters
framesHow many frames before re-using buffers.

◆ ~BufferAllocator()

Video::BufferAllocator::~BufferAllocator ( )
virtual

Destructor.

Member Function Documentation

◆ BeginFrame()

void Video::BufferAllocator::BeginFrame ( )

Call at the beginning of each frame.

◆ CreateBuffer()

Buffer * Video::BufferAllocator::CreateBuffer ( Buffer::BufferUsage  bufferUsage,
uint32_t  size,
const void *  data 
)

Create a GPU buffer.

Parameters
bufferUsageHow the buffer will be used.
sizeThe size of the buffer in bytes.
dataData to upload to the buffer. Can be nullptr if no data should be uploaded.
Returns
The created buffer.

◆ CreateTemporaryBuffer()

Buffer * Video::BufferAllocator::CreateTemporaryBuffer ( Buffer::BufferUsage  bufferUsage,
uint32_t  size,
const void *  data 
)

Create a temporary GPU buffer.

Parameters
bufferUsageHow the buffer will be used.
sizeThe size of the buffer in bytes.
dataData to upload to the buffer. Can be nullptr if no data should be uploaded.
Returns
The created buffer.

Member Data Documentation

◆ poolSize

const uint32_t Video::BufferAllocator::poolSize = 1024 * 1024
staticprotected

The size of each buffer in the pool.


The documentation for this class was generated from the following files: