Class DynamicBuffer
Dynamic GPU buffer that allows to update and use GPU data (index/vertex/other) during single frame (supports dynamic resizing).
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Graphics/DynamicBuffer.h
Syntax
public class DynamicBufferConstructors
~DynamicBuffer()
Destructor
Declaration
public virtual ~DynamicBuffer()DynamicBuffer(uint32 initialCapacity, uint32 stride, const String& name)
Init
Declaration
public DynamicBuffer(uint32 initialCapacity, uint32 stride, const String& name)Parameters
| uint32
        initialCapacity Initial capacity of the buffer (in bytes) | 
| uint32
        stride Stride in bytes | 
| String
        name Buffer name | 
Fields
_buffer
_name
_stride
Declaration
protected uint32 _strideField Value
| uint32 
 | 
Data
The data container (raw bytes storage).
Declaration
public Array<byte> DataField Value
| Array<byte> 
 | 
Usage
GPU usage of the resource. Use Dynamic for resources that can be updated multiple timers per-frame.
Declaration
public GPUResourceUsage Usage = GPUResourceUsage::DynamicField Value
| GPUResourceUsage 
 | 
Methods
Clear()
Clear data (begin for writing)
Declaration
public void Clear()Returns
| void 
 | 
Dispose()
Disposes the buffer resource and clears the used memory.
Declaration
public void Dispose()Flush()
Unlock buffer and flush data with a buffer (it will be ready for an immediate draw).
Declaration
public void Flush()Flush(class GPUContext* context)
Unlock buffer and flush data with a buffer (it will be ready for a during next frame draw).
Declaration
public void Flush(class GPUContext* context)Parameters
| class GPUContext
        context The GPU command list context to use for data uploading. | 
GetBuffer()
Gets buffer (can be null due to 'late init' feature).
Declaration
public GPUBuffer* GetBuffer() constReturns
| GPUBuffer 
 | 
InitDesc(GPUBufferDescription& desc, int32 numElements)
Declaration
protected virtual void InitDesc(GPUBufferDescription& desc, int32 numElements) = 0Parameters
| GPUBufferDescription
        desc 
 | 
| int32
        numElements 
 | 
Write(const T& data)
Write bytes to the buffer
Declaration
public void Write(const T& data)Parameters
| T
        data Data to write | 
Returns
| void 
 | 
Type Parameters
| typename T 
 | 
Write(const void* bytes, int32 size)
Write bytes to the buffer
Declaration
public void Write(const void* bytes, int32 size)Parameters
| void
        bytes Pointer to data to write | 
| int32
        size Amount of data to write (in bytes) | 
Returns
| void 
 | 
WriteReserve(int32 size)
Allocates bytes in the buffer by resizing the buffer for new memory and returns the pointer to the start of the allocated space.
Declaration
public byte* WriteReserve(int32 size)Parameters
| int32
        size Amount of data to allocate (in bytes) | 
Returns
| byte 
 |