Class ConstantBuffer
Represents a constant buffer.
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public class ConstantBuffer : IDisposable
Constructors
ConstantBuffer(Buffer, ConstantBufferInfo)
Initializes a new instance of the ConstantBuffer class.
Declaration
public ConstantBuffer(Buffer buffer, ConstantBufferInfo cbufferInfo)
Parameters
Type | Name | Description |
---|---|---|
Buffer | buffer | The buffer. |
ConstantBufferInfo | cbufferInfo | The constant buffer info. |
ConstantBuffer(GraphicsContext, ConstantBuffer)
Initializes a new instance of the ConstantBuffer class.
Declaration
public ConstantBuffer(GraphicsContext graphicsContext, ConstantBuffer proxyCBuffer)
Parameters
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | The graphics context. |
ConstantBuffer | proxyCBuffer | The proxy constant buffer.. |
ConstantBuffer(GraphicsContext, ConstantBufferInfo, bool)
Initializes a new instance of the ConstantBuffer class.
Declaration
public ConstantBuffer(GraphicsContext graphicsContext, ConstantBufferInfo cbufferInfo, bool setDefaultValues = true)
Parameters
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | The graphics context. |
ConstantBufferInfo | cbufferInfo | The constant buffer info. |
bool | setDefaultValues | If true the default values specified in cbufferInfo will be applied. |
ConstantBuffer(ConstantBufferInfo, bool)
Initializes a new instance of the ConstantBuffer class.
Declaration
public ConstantBuffer(ConstantBufferInfo cbufferInfo, bool setDefaultValues = true)
Parameters
Type | Name | Description |
---|---|---|
ConstantBufferInfo | cbufferInfo | The constant buffer info. |
bool | setDefaultValues | Set the default values. |
Fields
AllowDynamicOffset
Indicates if this buffer allow dynamic offsets.
Declaration
public readonly bool AllowDynamicOffset
Field Value
Type | Description |
---|---|
bool |
CBufferInfo
The constant buffer information.
Declaration
public readonly ConstantBufferInfo CBufferInfo
Field Value
Type | Description |
---|---|
ConstantBufferInfo |
Capacity
The constant buffer capacity.
Declaration
public uint Capacity
Field Value
Type | Description |
---|---|
uint |
Data
The stagging buffer.
Declaration
public IntPtr Data
Field Value
Type | Description |
---|---|
IntPtr |
Dirty
Indicates whether is necessary update graphics card buffer.
Declaration
public bool Dirty
Field Value
Type | Description |
---|---|
bool |
Size
The constant buffer size in bytes.
Declaration
public uint Size
Field Value
Type | Description |
---|---|
uint |
StartOffset
The start offset in bytes.
Declaration
public uint StartOffset
Field Value
Type | Description |
---|---|
uint |
UpdatePolicy
Indicates the constant Buffer type by its field tags (PerFrame, PerCamera, PerPass, PerDrawCall).
Declaration
public UpdatePolicy UpdatePolicy
Field Value
Type | Description |
---|---|
UpdatePolicy |
Properties
Buffer
Gets the buffer.
Declaration
public Buffer Buffer { get; }
Property Value
Type | Description |
---|---|
Buffer |
ProxyCBuffer
Gets the proxy constant buffer.
Declaration
public ConstantBuffer ProxyCBuffer { get; }
Property Value
Type | Description |
---|---|
ConstantBuffer |
Methods
Dispose()
Public implementation of Dispose pattern callable by consumers.
Declaration
public void Dispose()
Dispose(bool)
Protected implementation of Dispose pattern.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Dispose native elements. |
EnsureBufferCapacity(uint)
Ensure the capacity of this constant buffer.
Declaration
public void EnsureBufferCapacity(uint newCapacity)
Parameters
Type | Name | Description |
---|---|---|
uint | newCapacity | The new capacity. |
~ConstantBuffer()
Finalizes an instance of the ConstantBuffer class.
Declaration
protected ~ConstantBuffer()
GetBufferData<T>(int)
Gets a buffer data.
Declaration
public T GetBufferData<T>(int offset = 0)
Parameters
Type | Name | Description |
---|---|---|
int | offset | The offset in the buffer. |
Returns
Type | Description |
---|---|
T | The readed data. |
Type Parameters
Name | Description |
---|---|
T | The type of data to read. |
Prepare(CommandBuffer)
Prepare this buffer.
Declaration
public void Prepare(CommandBuffer commandBuffer)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | commandBuffer | The command buffer. |
Reset()
Reset this buffer.
Declaration
public void Reset()
SetBufferData(void*, uint, int)
Set buffer content using data pointer.
Declaration
public void SetBufferData(void* data, uint byteCount, int offset = 0)
Parameters
Type | Name | Description |
---|---|---|
void* | data | The data. |
uint | byteCount | The byte count to copy. |
int | offset | The offset. |
SetBufferData<T>(T, int)
Set buffer with a struct.
Declaration
public void SetBufferData<T>(T instance, int offset = 0)
Parameters
Type | Name | Description |
---|---|---|
T | instance | Struct instance. |
int | offset | The offset. |
Type Parameters
Name | Description |
---|---|
T | Struct type. |
SetDefaultParameters()
Sets the default parameters.
Declaration
public void SetDefaultParameters()
Update(CBufferEngineData, IEngineShaderParameters, bool, bool)
Sets the engine shader parameters in the constant buffers of the material.
Declaration
public void Update(CBufferEngineData cBufferEntgineData, IEngineShaderParameters engineShaderParameters, bool append = false, bool align = true)
Parameters
Type | Name | Description |
---|---|---|
CBufferEngineData | cBufferEntgineData | The cbuffer engine data. |
IEngineShaderParameters | engineShaderParameters | Parameters provides by engine. |
bool | append | Append the buffer to the end of the buffer. |
bool | align | Align the buffer offset. |
Events
BufferRefreshed
Events that is fired when the buffer is refreshed.
Declaration
public event EventHandler<Buffer> BufferRefreshed
Event Type
Type | Description |
---|---|
EventHandler<Buffer> |