class TGpuBufferMappedScope

template<bool IsRenderProxy>

RAII wrapper returned by GpuBuffer::Map operation.

Allows you to access the mapped memory, and automatically flushes the memory on destruction, if needed. Prevents the mapped buffer from being destructed while the scope is active. As a helper can also be constructed back into a TGpuBufferSuballocation referencing the mapped range. Templated to support both main thread and render thread variants.

Public

Constructors

TGpuBufferMappedScope<IsRenderProxy>

TGpuBufferMappedScope<IsRenderProxy>() = default

TGpuBufferMappedScope<IsRenderProxy>

TGpuBufferMappedScope<IsRenderProxy>(void *mappedMemory, GpuSuballocationType suballocation, u32 size, GpuMapOptions options)

TGpuBufferMappedScope<IsRenderProxy>

TGpuBufferMappedScope<IsRenderProxy>(TGpuBufferMappedScope<IsRenderProxy> &&other) noexcept

Methods

~TGpuBufferMappedScope<IsRenderProxy>

~TGpuBufferMappedScope<IsRenderProxy>()

Unmap

void Unmap()

Explicitly releases the mapping.

Safe to call multiple times. Flushes if write mapping (render proxy) or marks dirty (main thread).

GetMappedMemory

void *GetMappedMemory() const

GetSuballocation

const GpuSuballocationType &GetSuballocation() const

GetBuffer

const SPtr<GpuBufferType> &GetBuffer() const

IsValid

bool IsValid() const

Operators

operator=

TGpuBufferMappedScope<IsRenderProxy> &operator=(TGpuBufferMappedScope<IsRenderProxy> &&other) noexcept

operator bool

explicit operator bool() const

operator const TGpuBufferSuballocation<IsRenderProxy> &

operator const GpuSuballocationType &() const

Implicit conversion to TGpuBufferSuballocation.

Private

Fields

mMappedMemory

void * mMappedMemory

mSuballocation

GpuSuballocationType mSuballocation

mSize

u32 mSize

mOptions

GpuMapOptions mOptions