Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CVertexBufferManager Class Reference

#include <VertexBufferManager.h>

Collaboration diagram for CVertexBufferManager:

Classes

class  Handle
 

Public Types

enum class  Group : u32 { DEFAULT , TERRAIN , WATER , COUNT }
 

Public Member Functions

 CVertexBufferManager (Renderer::Backend::IDevice *device)
 
Handle AllocateChunk (const size_t vertexSize, const size_t numberOfVertices, const Renderer::Backend::IBuffer::Type type, const uint32_t usage, void *backingStore=nullptr, Group group=Group::DEFAULT)
 Try to allocate a vertex buffer of the given size and type. More...
 
void Release (CVertexBuffer::VBChunk *chunk)
 Returns the given chunk to its owning buffer. More...
 
size_t GetBytesReserved () const
 
size_t GetBytesAllocated () const
 

Private Attributes

Renderer::Backend::IDevicem_Device {nullptr}
 
std::vector< std::unique_ptr< CVertexBuffer > > m_Buffers [static_cast< std::size_t >(Group::COUNT)]
 List of all known vertex buffers. More...
 

Member Enumeration Documentation

◆ Group

enum class CVertexBufferManager::Group : u32
strong
Enumerator
DEFAULT 
TERRAIN 
WATER 
COUNT 

Constructor & Destructor Documentation

◆ CVertexBufferManager()

CVertexBufferManager::CVertexBufferManager ( Renderer::Backend::IDevice device)
inline

Member Function Documentation

◆ AllocateChunk()

CVertexBufferManager::Handle CVertexBufferManager::AllocateChunk ( const size_t  vertexSize,
const size_t  numberOfVertices,
const Renderer::Backend::IBuffer::Type  type,
const uint32_t  usage,
void *  backingStore = nullptr,
Group  group = Group::DEFAULT 
)

Try to allocate a vertex buffer of the given size and type.

AllocateChunk: try to allocate a buffer of given number of vertices (each of given size), with the given type, and using the given texture - return null if no free chunks available.

Parameters
vertexSizesize of each vertex in the buffer
numberOfVerticesnumber of vertices in the buffer
typebuffer type
dynamicwill be buffer updated frequently or not
backingStoreif not dynamic, this is nullptr; else for dynamic, this must be a copy of the vertex data that remains valid for the lifetime of the VBChunk
Returns
chunk, or empty handle if no free chunks available

◆ GetBytesAllocated()

size_t CVertexBufferManager::GetBytesAllocated ( ) const

◆ GetBytesReserved()

size_t CVertexBufferManager::GetBytesReserved ( ) const

◆ Release()

void CVertexBufferManager::Release ( CVertexBuffer::VBChunk chunk)

Returns the given chunk to its owning buffer.

Member Data Documentation

◆ m_Buffers

std::vector<std::unique_ptr<CVertexBuffer> > CVertexBufferManager::m_Buffers[static_cast< std::size_t >(Group::COUNT)]
private

List of all known vertex buffers.

◆ m_Device

Renderer::Backend::IDevice* CVertexBufferManager::m_Device {nullptr}
private

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