SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::RenderEngine::BufferBase Class Referenceabstract

Backend-agnostic GPU buffer: vertex, index, constant, or resource view target. More...

#include <BufferBase.hpp>

Inheritance diagram for Sleak::RenderEngine::BufferBase:

Public Member Functions

const void * GetCPUShadowCopy () const
size_t GetCPUShadowCopySize () const
virtual void * GetData ()=0
size_t GetSize ()
int GetSlot () const
BufferType GetType ()
uint32_t GetVertexFormat () const
 Registered custom vertex layout of this buffer; 0 means the engine default Vertex.
virtual bool Map ()=0
 Maps the buffer for CPU writes; returns false if already mapped or unmappable.
void SetSlot (int slot)
void SetVertexFormat (uint32_t handle)
 Tags the buffer with a VertexFormatRegistry handle so backends pick the matching pipeline.
void StoreCPUShadowCopy (const void *data, size_t size)
 Copies up to 128 bytes into the inline shadow-copy storage, clamping oversized input.
virtual void Unmap ()=0
virtual void Update ()=0
virtual void Update (void *data, size_t size)=0
 Overwrites the buffer contents with new data of a given size.
Public Member Functions inherited from Sleak::ResourceBase
virtual ~ResourceBase ()=default
virtual void Cleanup ()=0
virtual bool Initialize (void *Data)=0
 Allocates backend resources from backend-specific creation parameters.

Protected Attributes

bool bIsMapped = false
void * Data = nullptr
const void * m_cpuShadowCopy = nullptr
size_t m_cpuShadowCopySize = 0
char m_cpuShadowStorage [128] = {}
uint32_t m_vertexFormat = 0
size_t Size = 0
int Slot = 0
BufferType Type
Protected Attributes inherited from Sleak::ResourceBase
bool bIsInitialized
std::string Name

Detailed Description

Backend-agnostic GPU buffer: vertex, index, constant, or resource view target.

Definition at line 16 of file BufferBase.hpp.

Member Function Documentation

◆ GetCPUShadowCopy()

const void * Sleak::RenderEngine::BufferBase::GetCPUShadowCopy ( ) const
inline

Definition at line 46 of file BufferBase.hpp.

◆ GetCPUShadowCopySize()

size_t Sleak::RenderEngine::BufferBase::GetCPUShadowCopySize ( ) const
inline

Definition at line 47 of file BufferBase.hpp.

◆ GetData()

virtual void * Sleak::RenderEngine::BufferBase::GetData ( )
pure virtual

◆ GetSize()

size_t Sleak::RenderEngine::BufferBase::GetSize ( )
inline

Definition at line 27 of file BufferBase.hpp.

◆ GetSlot()

int Sleak::RenderEngine::BufferBase::GetSlot ( ) const
inline

Definition at line 33 of file BufferBase.hpp.

◆ GetType()

BufferType Sleak::RenderEngine::BufferBase::GetType ( )
inline

Definition at line 31 of file BufferBase.hpp.

◆ GetVertexFormat()

uint32_t Sleak::RenderEngine::BufferBase::GetVertexFormat ( ) const
inline

Registered custom vertex layout of this buffer; 0 means the engine default Vertex.

Definition at line 41 of file BufferBase.hpp.

◆ Map()

virtual bool Sleak::RenderEngine::BufferBase::Map ( )
pure virtual

Maps the buffer for CPU writes; returns false if already mapped or unmappable.

Implemented in Sleak::RenderEngine::DirectX11Buffer, Sleak::RenderEngine::DirectX12Buffer, Sleak::RenderEngine::OpenGLBuffer, and Sleak::RenderEngine::VulkanBuffer.

◆ SetSlot()

void Sleak::RenderEngine::BufferBase::SetSlot ( int slot)
inline

Definition at line 35 of file BufferBase.hpp.

◆ SetVertexFormat()

void Sleak::RenderEngine::BufferBase::SetVertexFormat ( uint32_t handle)
inline

Tags the buffer with a VertexFormatRegistry handle so backends pick the matching pipeline.

Definition at line 43 of file BufferBase.hpp.

◆ StoreCPUShadowCopy()

void Sleak::RenderEngine::BufferBase::StoreCPUShadowCopy ( const void * data,
size_t size )
inline

Copies up to 128 bytes into the inline shadow-copy storage, clamping oversized input.

Definition at line 49 of file BufferBase.hpp.

◆ Unmap()

virtual void Sleak::RenderEngine::BufferBase::Unmap ( )
pure virtual

◆ Update() [1/2]

virtual void Sleak::RenderEngine::BufferBase::Update ( )
pure virtual

◆ Update() [2/2]

virtual void Sleak::RenderEngine::BufferBase::Update ( void * data,
size_t size )
pure virtual

Member Data Documentation

◆ bIsMapped

bool Sleak::RenderEngine::BufferBase::bIsMapped = false
protected

Definition at line 61 of file BufferBase.hpp.

◆ Data

void* Sleak::RenderEngine::BufferBase::Data = nullptr
protected

Definition at line 60 of file BufferBase.hpp.

◆ m_cpuShadowCopy

const void* Sleak::RenderEngine::BufferBase::m_cpuShadowCopy = nullptr
protected

Definition at line 64 of file BufferBase.hpp.

◆ m_cpuShadowCopySize

size_t Sleak::RenderEngine::BufferBase::m_cpuShadowCopySize = 0
protected

Definition at line 65 of file BufferBase.hpp.

◆ m_cpuShadowStorage

char Sleak::RenderEngine::BufferBase::m_cpuShadowStorage[128] = {}
protected

Definition at line 66 of file BufferBase.hpp.

◆ m_vertexFormat

uint32_t Sleak::RenderEngine::BufferBase::m_vertexFormat = 0
protected

Definition at line 62 of file BufferBase.hpp.

◆ Size

size_t Sleak::RenderEngine::BufferBase::Size = 0
protected

Definition at line 58 of file BufferBase.hpp.

◆ Slot

int Sleak::RenderEngine::BufferBase::Slot = 0
protected

Definition at line 59 of file BufferBase.hpp.

◆ Type

BufferType Sleak::RenderEngine::BufferBase::Type
protected

Definition at line 57 of file BufferBase.hpp.