Foundation
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Foundation::Rendering::StagingBuffer Class Reference

Bump-only allocation buffer used for staging data to be transferred to GPU. More...

#include <StagingBuffer.hpp>

Public Member Functions

 StagingBuffer (RHIDevice *device, size_t size, Allocator *allocator)
 
size_t Write (Span< const char > data, size_t alignment)
 Writes data to the staging buffer, returning the offset of the data in the buffer.
 
void Seek (size_t offset, size_t alignment)
 Seeks the current offset to the given offset, aligned to the given alignment.
 
size_t Tell () const
 Resets the staging buffer, allowing it to be reused. No GPU-side data transfer is performed.
 
size_t Size () const
 
size_t FreeSize () const
 
void Reset ()
 
RHIBufferGetBuffer () const
 

Private Attributes

AllocatormAllocator
 
RHIDevicemDevice
 
RHIDeviceScopedObjectHandle< RHIBuffermBuffer
 
voidmMapped
 
size_t mSize
 
size_t mOffset = 0
 

Detailed Description

Bump-only allocation buffer used for staging data to be transferred to GPU.

Constructor & Destructor Documentation

◆ StagingBuffer()

Foundation::Rendering::StagingBuffer::StagingBuffer ( RHIDevice device,
size_t  size,
Allocator allocator 
)

Member Function Documentation

◆ FreeSize()

size_t Foundation::Rendering::StagingBuffer::FreeSize ( ) const
inline

◆ GetBuffer()

RHIBuffer * Foundation::Rendering::StagingBuffer::GetBuffer ( ) const
inline

◆ Reset()

void Foundation::Rendering::StagingBuffer::Reset ( )

◆ Seek()

void Foundation::Rendering::StagingBuffer::Seek ( size_t  offset,
size_t  alignment 
)

Seeks the current offset to the given offset, aligned to the given alignment.

◆ Size()

size_t Foundation::Rendering::StagingBuffer::Size ( ) const
inline

◆ Tell()

size_t Foundation::Rendering::StagingBuffer::Tell ( ) const
inline

Resets the staging buffer, allowing it to be reused. No GPU-side data transfer is performed.

◆ Write()

size_t Foundation::Rendering::StagingBuffer::Write ( Span< const char data,
size_t  alignment 
)

Writes data to the staging buffer, returning the offset of the data in the buffer.

Returns
Offset of the data in the buffer. Throws std::bad_alloc if there's not enough space.

Member Data Documentation

◆ mAllocator

Allocator* Foundation::Rendering::StagingBuffer::mAllocator
private

◆ mBuffer

RHIDeviceScopedObjectHandle<RHIBuffer> Foundation::Rendering::StagingBuffer::mBuffer
private

◆ mDevice

RHIDevice* Foundation::Rendering::StagingBuffer::mDevice
private

◆ mMapped

void* Foundation::Rendering::StagingBuffer::mMapped
private

◆ mOffset

size_t Foundation::Rendering::StagingBuffer::mOffset = 0
private

◆ mSize

size_t Foundation::Rendering::StagingBuffer::mSize
private

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