Diligent::DynamicBuffer class

Dynamically resizable buffer.

Constructors, destructors, conversion operators

DynamicBuffer(IRenderDevice* pDevice, const BufferDesc& Desc)
Initialies the dynamic buffer.

Public functions

auto Resize(IRenderDevice* pDevice, IDeviceContext* pContext, Uint32 NewSize) -> IBuffer*
Resizes the buffer to the new size.
auto GetBuffer(IRenderDevice* pDevice, IDeviceContext* pContext) -> IBuffer*
Returns the pointer to the buffer object, initializing it if necessary.
auto PendingUpdate() const -> bool
Returns true if the buffer buffer must be updated before use (e.g. it has been resized, but internal buffer has not been initialized or updated). When update is not pending, GetBuffer() may be called with null device and context.
auto GetDesc() -> const BufferDesc&
Returns the buffer description.
auto GetVersion() const -> Uint32
Returns dynamic buffer version. The version is incremented every time a new internal buffer is created.

Function documentation

Diligent::DynamicBuffer::DynamicBuffer(IRenderDevice* pDevice, const BufferDesc& Desc)

Initialies the dynamic buffer.

Parameters
pDevice in - Render device that will be used to create the buffer. This parameter may be null (see remarks).
Desc in - Buffer description.

IBuffer* Diligent::DynamicBuffer::Resize(IRenderDevice* pDevice, IDeviceContext* pContext, Uint32 NewSize)

Resizes the buffer to the new size.

Parameters
pDevice in - Render device that will be used create a new internal buffer. This parameter may be null (see remarks).
pContext in - Device context that will be used to copy existing contents to the new buffer. This parameter may be null (see remarks).
NewSize in - New buffer size. Can be zero.
Returns Pointer to the new buffer.

Typically pDevice and pContext should be null when the method is called from a worker thread.

If NewSize is zero, internal buffer will be released.

IBuffer* Diligent::DynamicBuffer::GetBuffer(IRenderDevice* pDevice, IDeviceContext* pContext)

Returns the pointer to the buffer object, initializing it if necessary.

Parameters
pDevice in - Render device that will be used to create the new buffer, if necessary (see remarks).
pContext in - Device context that will be used to copy existing buffer contents, if necessary (see remarks).
Returns The pointer to the buffer object.

If buffer does not need to be updated (PendingUpdate() returns false), both pDevice and pContext may be null.