Cogs.Core
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Cogs::ContextCommon Struct Referenceabstract
Inheritance diagram for Cogs::ContextCommon:
Cogs::IContext Cogs::ContextD3D11 Cogs::ContextD3D12 Cogs::ContextGL20 Cogs::ContextGLES30 Cogs::ContextVK

Classes

struct  TrackedState
 

Public Member Functions

virtual InputAssemblerStateCommongetIAState ()=0
 
virtual EffectHandle getCurrentEffect ()=0
 
virtual IEffectsgetEffects ()=0
 
const Cogs::FrameStatisticsgetLastFrameStatistics () override
 
const Cogs::UploadStatisticsgetLastUploadStatistics () override
 
void frameStatisticsConfigure (bool enable) override
 
void setMatrixVariable (const StringView &name, const float *value) override
 Sets the matrix variable with the given name in the current effect to value.
 
void setScalarVariable (const StringView &name, const float value) override
 Sets the scalar floating point variable with the given name to the given value.
 
void setScalarVariable (const StringView &name, int value) override
 Sets the scalar integer variable with the given name to the given value.
 
void setVector2Variable (const StringView &name, const float *value) override
 Sets the vector variable with the given name to the given two-component value.
 
void setVector3Variable (const StringView &name, const float *value) override
 Sets the vector variable with the given name to the given three-component value.
 
void setVector4Variable (const StringView &name, const float *value) override
 Sets the vector variable with the given name to the given four-component value.
 
void setVariable (const StringView &name, const uint8_t *data, size_t size)
 
void setVariable (const EffectVariableHandle index, const uint8_t *data, size_t size) override
 Sets the variable with the given name and size.
 
void setMatrixVariable (const EffectVariableHandle variableHandle, const float *value) override
 Sets the given matrix variable to value.
 
void setMatrixVariable (const EffectVariableHandle variableHandle, const float *value, size_t count) override
 Sets the given matrix variable to value.
 
void setScalarVariable (const EffectVariableHandle variableHandle, const float value) override
 Sets the given scalar floating point variable to the given value.
 
void setScalarVariable (const EffectVariableHandle variableHandle, const float *value, size_t count) override
 Sets the given scalar integer point variable to the given value.
 
void setScalarVariable (const EffectVariableHandle variableHandle, int value) override
 Sets the given scalar integer point variable to the given value.
 
void setScalarVariable (const EffectVariableHandle variableHandle, const int *value, size_t count) override
 Sets the given scalar integer point variable to the given value.
 
void setVector2Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1) override
 Sets the given vector variable to the given two-component value.
 
void setVector3Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1) override
 Sets the given vector variable to the given three-component value.
 
void setVector4Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1) override
 Sets the given vector variable to the given four-component value.
 
void setVector4Variable (const EffectVariableHandle variableHandle, const int *value, size_t count=1) override
 Sets the given vector variable to the given four-component value.
 
void setConstantBuffer (const StringView &name, const BufferHandle bufferHandle, const uint32_t offset, const uint32_t size) final
 Sets a constant buffer to be bound to the given name and slot.
 
void setBuffer (const StringView &name, BufferHandle bufferHandle) final
 Sets the given buffer to the buffer binding slot with the given name.
 
void setTexture (const StringView &name, unsigned int unit, TextureHandle textureHandle) final
 Sets the texture slot given by unit with the given name to contain the given texture.
 
void setTexture (const StringView &name, TextureViewHandle textureViewHandle) final
 
void setSamplerState (const StringView &name, unsigned int unit, SamplerStateHandle handle) final
 Sets the sampler slot given by unit with the given name to contain the given sampler state.
 
void setVertexArrayObject (VertexArrayObjectHandle vertexArrayObject) override
 
virtual void signal (FenceHandle) override
 Insert a fence in the command stream that will signal when all commands before the fence are completed.
 
void updateBuffer (BufferHandle bufferHandle, const void *data, size_t size) override
 Replace contents of buffer with new data.
 
void frameStatisticsBeginFrame ()
 
virtual void setConstantBuffer (const StringView &name, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0
 Sets a constant buffer to be bound to the given name and slot.
 
virtual void setConstantBuffer (const ConstantBufferBindingHandle bufferBindingHandle, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0
 Sets a constant buffer to the given constant buffer binding.
 
virtual void setBuffer (const StringView &name, BufferHandle bufferHandle)=0
 Sets the given buffer to the buffer binding slot with the given name.
 
virtual void setBuffer (const BufferBindingHandle bufferBindingHandle, BufferHandle bufferHandle)=0
 Sets a buffer to bind to the given binding.
 
virtual void setTexture (const StringView &name, unsigned int unit, TextureHandle textureHandle)=0
 Sets the texture slot given by unit with the given name to contain the given texture.
 
virtual void setTexture (const TextureBindingHandle textureBindingHandle, const TextureHandle textureHandle)=0
 Sets the texture given to the binding given by textureBindingHandle.
 
virtual void setTexture (const StringView &name, TextureViewHandle textureViewHandle)=0
 
virtual void setTexture (const TextureBindingHandle textureBindingHandle, TextureViewHandle textureViewHandle)=0
 
virtual void setSamplerState (const StringView &name, unsigned int unit, SamplerStateHandle samplerStateHandle)=0
 Sets the sampler slot given by unit with the given name to contain the given sampler state.
 
virtual void setSamplerState (const SamplerStateBindingHandle samplerStateBindingHandle, const SamplerStateHandle samplerStateHandle)=0
 Sets the sampler state binding given to the given sampler state.
 
- Public Member Functions inherited from Cogs::IContext
virtual const Cogs::FrameStatisticsgetLastFrameStatistics ()=0
 
virtual const Cogs::UploadStatisticsgetLastUploadStatistics ()=0
 
virtual void frameStatisticsConfigure (bool enable)=0
 
virtual void clearCachedState ()
 Prepare context for external manipulation of graphics device.
 
virtual void pushCommandGroupAnnotation (const StringView &name)
 Begin to tag a sequence of commands as a group in graphics debugger.
 
virtual void popCommandGroupAnnotation ()
 End to tag a sequence of commands as a group in graphics debugger.
 
virtual void setAnnotationMarker (const StringView &name)
 Add a tag in the sequence of commands in graphics debugger.
 
virtual void beginRenderPass (const RenderPassInfo &info)=0
 Begin a render pass.
 
virtual void endRenderPass ()=0
 End a render pass.
 
virtual void setRenderTarget (const RenderTargetHandle handle, const DepthStencilHandle depthStencilHandle)=0
 Sets the current render target and an associated depth stencil target.
 
virtual void setViewport (const float x, const float y, const float width, const float height)=0
 Sets the current viewport to the given location and dimensions.
 
virtual void setScissor (const int x, const int y, const int width, const int height)=0
 Sets the current scissor rectangle.
 
virtual void clearRenderTarget (const float *value)=0
 Clear the currently set render target to the given value (4 component floating point RGBA).
 
virtual void clearRenderTarget (const float **values, const int numvalues)=0
 Clear the currently set render target, setting the individual render target views to the given values (4 component floating point RGBA).
 
virtual void clearDepth (const float depth=1.0f)=0
 Clear the currently set depth/stencil target to the given depth.
 
virtual void setDepthStencilState (const DepthStencilStateHandle handle)=0
 Set the current depth stencil state.
 
virtual void setBlendState (const BlendStateHandle handle, const float *constant=nullptr)=0
 Set the current blend state.
 
virtual void setRasterizerState (const RasterizerStateHandle handle)=0
 Set the current rasterizer state.
 
virtual void setEffect (EffectHandle handle)=0
 Set the current effect.
 
virtual void setMatrixVariable (const StringView &name, const float *value)=0
 Sets the matrix variable with the given name in the current effect to value.
 
virtual void setScalarVariable (const StringView &name, const float value)=0
 Sets the scalar floating point variable with the given name to the given value.
 
virtual void setScalarVariable (const StringView &name, int value)=0
 Sets the scalar integer variable with the given name to the given value.
 
virtual void setVector2Variable (const StringView &name, const float *value)=0
 Sets the vector variable with the given name to the given two-component value.
 
virtual void setVector3Variable (const StringView &name, const float *value)=0
 Sets the vector variable with the given name to the given three-component value.
 
virtual void setVector4Variable (const StringView &name, const float *value)=0
 Sets the vector variable with the given name to the given four-component value.
 
virtual void setVariable (const EffectVariableHandle index, const uint8_t *data, size_t size)=0
 Sets the variable with the given name and size.
 
virtual void setMatrixVariable (const EffectVariableHandle variableHandle, const float *value)=0
 Sets the given matrix variable to value.
 
virtual void setMatrixVariable (const EffectVariableHandle variableHandle, const float *value, size_t count)=0
 Sets the given matrix variable to value.
 
virtual void setScalarVariable (const EffectVariableHandle variableHandle, const float value)=0
 Sets the given scalar floating point variable to the given value.
 
virtual void setScalarVariable (const EffectVariableHandle variableHandle, const float *value, size_t count)=0
 Sets the given scalar integer point variable to the given value.
 
virtual void setScalarVariable (const EffectVariableHandle variableHandle, int value)=0
 Sets the given scalar integer point variable to the given value.
 
virtual void setScalarVariable (const EffectVariableHandle variableHandle, const int *value, size_t count)=0
 Sets the given scalar integer point variable to the given value.
 
virtual void setVector2Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1)=0
 Sets the given vector variable to the given two-component value.
 
virtual void setVector3Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1)=0
 Sets the given vector variable to the given three-component value.
 
virtual void setVector4Variable (const EffectVariableHandle variableHandle, const float *value, size_t count=1)=0
 Sets the given vector variable to the given four-component value.
 
virtual void setVector4Variable (const EffectVariableHandle variableHandle, const int *value, size_t count=1)=0
 Sets the given vector variable to the given four-component value.
 
virtual void setTexture (const StringView &name, unsigned int unit, TextureHandle textureHandle)=0
 Sets the texture slot given by unit with the given name to contain the given texture.
 
virtual void setTexture (const TextureBindingHandle textureBindingHandle, const TextureHandle textureHandle)=0
 Sets the texture given to the binding given by textureBindingHandle.
 
virtual void setTexture (const StringView &name, TextureViewHandle textureViewHandle)=0
 
virtual void setTexture (const TextureBindingHandle textureBindingHandle, TextureViewHandle textureViewHandle)=0
 
virtual void setSamplerState (const StringView &name, unsigned int unit, SamplerStateHandle samplerStateHandle)=0
 Sets the sampler slot given by unit with the given name to contain the given sampler state.
 
virtual void setSamplerState (const SamplerStateBindingHandle samplerStateBindingHandle, const SamplerStateHandle samplerStateHandle)=0
 Sets the sampler state binding given to the given sampler state.
 
virtual void setInputLayout (const InputLayoutHandle inputLayoutHandle)=0
 Sets the current input layout.
 
virtual void setVertexBuffers (const VertexBufferHandle *vertexBufferHandles, const size_t count, const uint32_t *strides, const uint32_t *offsets)=0
 Sets the current vertex buffers.
 
virtual void setVertexBuffers (const VertexBufferHandle *vertexBufferHandles, const size_t count)=0
 Overload provided to support transitioning.
 
virtual void setIndexBuffer (IndexBufferHandle bufferHandle, uint32_t stride=4, uint32_t offset=0)=0
 Sets the current index buffer.
 
virtual void setVertexArrayObject (VertexArrayObjectHandle vertexArrayObject)=0
 Sets vertexBuffers and index buffers using a prevalidated vertex array object.
 
virtual void setConstantBuffer (const StringView &name, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0
 Sets a constant buffer to be bound to the given name and slot.
 
virtual void setConstantBuffer (const ConstantBufferBindingHandle bufferBindingHandle, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0
 Sets a constant buffer to the given constant buffer binding.
 
virtual void setBuffer (const StringView &name, BufferHandle bufferHandle)=0
 Sets the given buffer to the buffer binding slot with the given name.
 
virtual void setBuffer (const BufferBindingHandle bufferBindingHandle, BufferHandle bufferHandle)=0
 Sets a buffer to bind to the given binding.
 
virtual void setBufferCounter (BufferHandle bufferHandle, uint32_t value)=0
 Set the associated counter of a buffer.
 
virtual void setBufferCounter (BufferHandle bufferHandle, BufferHandle sourceBufferHandle)=0
 Set the associated counter of a buffer.
 
virtual void getBufferCounter (BufferHandle bufferHandle, BufferHandle destinationBufferHandle)=0
 Get the associated counter of a buffer.
 
virtual uint32_t getBufferCounter (BufferHandle bufferHandle)=0
 Get the associated counter of a buffer.
 
virtual void draw (PrimitiveType::EPrimitiveType primitiveType, const size_t startVertex, const size_t numVertexes)=0
 Draws non-indexed, non-instanced primitives.
 
virtual void drawIndexed (PrimitiveType::EPrimitiveType primitiveType, const size_t startIndex, const size_t numIndexes, const size_t startVertex=0)=0
 Draws indexed, non-instanced primitives.
 
virtual void drawInstanced (PrimitiveType::EPrimitiveType primitiveType, const size_t startVertex, const size_t numVertexes, const size_t startInstance, const size_t numInstances)=0
 Draws non-indexed, instanced primitives.
 
virtual void drawInstancedIndexed (PrimitiveType::EPrimitiveType primitiveType, const size_t startInstance, const size_t numInstances, const size_t startIndex, const size_t numIndexes)=0
 Draws indexed, instanced primitives.
 
virtual void dispatchCompute (const unsigned int threadGroupsX, const unsigned int threadGroupsY, const unsigned int threadGroupsZ)=0
 Dispatch computing work on the graphics device using the desired thread group count.
 
virtual void resolveResource (TextureHandle source, TextureHandle destination)=0
 Resolves the given source resource target into the given destination texture.
 
virtual void readDepthBuffer (BufferHandle bufferHandle, int x, int y, int width, int height, Framebuffer::EFrameBuffer framebuffer)=0
 Reads data from the current depth target into the given bufferHandle.
 
virtual void readColorBuffer (BufferHandle bufferHandle, int x, int y, int width, int height, Framebuffer::EFrameBuffer framebuffer)=0
 Reads data from the current render target into the given bufferHandle.
 
virtual void * map (BufferHandle bufferHandle, MapMode::EMapMode mapMode, uint32_t *stride=nullptr)=0
 Maps the given buffer so it can be accessed.
 
virtual void unmap (BufferHandle bufferHandle)=0
 Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memory.
 
virtual void updateBuffer (BufferHandle bufferHandle, const void *data, size_t size)=0
 Replace contents of buffer with new data.
 
virtual void * map (TextureHandle textureHandle, MapMode::EMapMode accessMode, uint32_t *rowPitch, uint32_t *depthPitch)=0
 Create host mapping of a staging texture.
 
virtual void unmap (TextureHandle textureHandle)=0
 Release a host mapping of a staging texture.
 
virtual void signal (FenceHandle fenceHandle)=0
 Insert a fence in the command stream that will signal when all commands before the fence are completed.
 
virtual void updateSubTexture (TextureHandle textureHandle, const size_t level, const void *data)=0
 Update the data of a level in the given texture.
 
virtual void updateSubBuffer (BufferHandle bufferHandle, const size_t offset, const size_t size, const void *data)=0
 Update a region of data in a buffer.
 
virtual void copyResource (BufferHandle destinationHandle, BufferHandle sourceHandle)=0
 
virtual void copyResource (TextureHandle destinationHandle, TextureHandle sourceHandle)=0
 
virtual void copyTexture (TextureHandle dstHandle, unsigned dstSub, unsigned dstX, unsigned dstY, unsigned dstZ, TextureHandle sourceHandle, unsigned srcSub)=0
 
virtual void clearResource (BufferHandle destinationHandle, uint32_t *Values)=0
 
virtual void clearResource (BufferHandle destinationHandle, float *Values)=0
 
virtual void reset ()
 Resets all state changes made to the GPU since the last call to beginFrame.
 

Protected Member Functions

void setCurrentEffect (Effect *currentEffect)
 
void updateConstantBuffers ()
 
void frameStatisticsAccountDrawCall (size_t count, bool indexed)
 
void uploadStatisticsBufferUpload (size_t size)
 
void uploadStatisticsTextureUpload (size_t size)
 

Protected Attributes

FrameStatistics prevStats {}
 
FrameStatistics currStats {}
 
UploadStatistics prevUploadStats {}
 
UploadStatistics currUploadStats {}
 
struct Cogs::ContextCommon::TrackedState state
 
Effecteffect = nullptr
 
bool constantBuffersUpdated = true
 
bool frameStatisticsEnabled = false
 
bool uploadStatisticsEnabled = true
 

Friends

struct BuffersD3D11
 
struct TexturesD3D11
 

Detailed Description

Definition at line 22 of file ContextCommon.h.

Member Function Documentation

◆ frameStatisticsAccountDrawCall()

void Cogs::ContextCommon::frameStatisticsAccountDrawCall ( size_t  count,
bool  indexed 
)
protected

Definition at line 30 of file ContextCommon.cpp.

◆ frameStatisticsBeginFrame()

void Cogs::ContextCommon::frameStatisticsBeginFrame ( )

Resets frame statistics for a new frame.

Invoked by graphics device's beginFrame.

Definition at line 22 of file ContextCommon.cpp.

◆ frameStatisticsConfigure()

void Cogs::ContextCommon::frameStatisticsConfigure ( bool  enable)
inlineoverridevirtual

Implements Cogs::IContext.

Definition at line 32 of file ContextCommon.h.

◆ getLastFrameStatistics()

const Cogs::FrameStatistics & Cogs::ContextCommon::getLastFrameStatistics ( )
overridevirtual

Implements Cogs::IContext.

Definition at line 12 of file ContextCommon.cpp.

◆ getLastUploadStatistics()

const Cogs::UploadStatistics & Cogs::ContextCommon::getLastUploadStatistics ( )
overridevirtual

Implements Cogs::IContext.

Definition at line 17 of file ContextCommon.cpp.

◆ setBuffer() [1/3]

virtual void Cogs::IContext::setBuffer ( const BufferBindingHandle  bufferBindingHandle,
BufferHandle  bufferHandle 
)
virtual

Sets a buffer to bind to the given binding.

Parameters
bufferBindingHandleHandle to a buffer binding.
bufferHandleHandle to a buffer to set.

Implements Cogs::IContext.

◆ setBuffer() [2/3]

void Cogs::ContextCommon::setBuffer ( const StringView name,
BufferHandle  bufferHandle 
)
finalvirtual

Sets the given buffer to the buffer binding slot with the given name.

Parameters
nameName of the buffer binding in the effect.
bufferHandleHandle to a buffer to set.

Implements Cogs::IContext.

Definition at line 122 of file ContextCommon.cpp.

◆ setBuffer() [3/3]

virtual void Cogs::IContext::setBuffer ( const StringView name,
BufferHandle  bufferHandle 
)
virtual

Sets the given buffer to the buffer binding slot with the given name.

Parameters
nameName of the buffer binding in the effect.
bufferHandleHandle to a buffer to set.

Implements Cogs::IContext.

◆ setConstantBuffer() [1/3]

virtual void Cogs::IContext::setConstantBuffer ( const ConstantBufferBindingHandle  bufferBindingHandle,
const BufferHandle  bufferHandle,
const uint32_t  offset = 0,
const uint32_t  size = ~0u 
)
virtual

Sets a constant buffer to the given constant buffer binding.

Parameters
bufferBindingHandleValid handle to a buffer binding previously created.
bufferHandleHandle to a buffer created with the BindFlags::ConstantBuffer flag, or NoHandle to remove any existing buffer from the binding.
See also
IEffects::getConstantBufferBinding

Implements Cogs::IContext.

◆ setConstantBuffer() [2/3]

void Cogs::ContextCommon::setConstantBuffer ( const StringView name,
const BufferHandle  bufferHandle,
const uint32_t  offset,
const uint32_t  size 
)
finalvirtual

Sets a constant buffer to be bound to the given name and slot.

Parameters
nameName of the constant buffer as defined in the shaders.
bufferHandleHandle to a buffer created with the BindFlags::ConstantBuffer flag, or NoHandle to remove any existing buffer bound.

Implements Cogs::IContext.

Definition at line 118 of file ContextCommon.cpp.

◆ setConstantBuffer() [3/3]

virtual void Cogs::IContext::setConstantBuffer ( const StringView name,
const BufferHandle  bufferHandle,
const uint32_t  offset = 0,
const uint32_t  size = ~0u 
)
virtual

Sets a constant buffer to be bound to the given name and slot.

Parameters
nameName of the constant buffer as defined in the shaders.
bufferHandleHandle to a buffer created with the BindFlags::ConstantBuffer flag, or NoHandle to remove any existing buffer bound.

Implements Cogs::IContext.

◆ setCurrentEffect()

void Cogs::ContextCommon::setCurrentEffect ( Effect currentEffect)
protected

Definition at line 141 of file ContextCommon.cpp.

◆ setMatrixVariable() [1/3]

void Cogs::ContextCommon::setMatrixVariable ( const EffectVariableHandle  variableHandle,
const float *  value 
)
overridevirtual

Sets the given matrix variable to value.

Value must point to a valid 16-element array of floating point values.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 68 of file ContextCommon.cpp.

◆ setMatrixVariable() [2/3]

void Cogs::ContextCommon::setMatrixVariable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count 
)
overridevirtual

Sets the given matrix variable to value.

Value must point to a valid 16-element array of floating point values.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 73 of file ContextCommon.cpp.

◆ setMatrixVariable() [3/3]

void Cogs::ContextCommon::setMatrixVariable ( const StringView name,
const float *  value 
)
overridevirtual

Sets the matrix variable with the given name in the current effect to value.

Value must point to a 16-element single precision floating point array.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 181 of file ContextCommon.cpp.

◆ setSamplerState() [1/3]

virtual void Cogs::IContext::setSamplerState ( const SamplerStateBindingHandle  samplerStateBindingHandle,
const SamplerStateHandle  samplerStateHandle 
)
virtual

Sets the sampler state binding given to the given sampler state.

If the sampler state is set to NoHandle the default sampler state is set for the binding.

Parameters
samplerStateBindingHandleValid handle to a previously created sampler state binding object.
samplerStateHandleHandle to a valid sampler state, or NoHandle to set the default sampler state.

Implements Cogs::IContext.

◆ setSamplerState() [2/3]

void Cogs::ContextCommon::setSamplerState ( const StringView name,
unsigned int  unit,
SamplerStateHandle  samplerStateHandle 
)
finalvirtual

Sets the sampler slot given by unit with the given name to contain the given sampler state.

If the sampler state is set to NoHandle the default sampler state is set.

Parameters
nameName of the sampler state object as used in shaders (only used where applicable).
unitTexture unit to bind the sampler state to. The sampler state object is used to sample textures bound to this unit.
samplerStateHandleHandle to a valid sampler state, or NoHandle to set the default sampler state for the given unit.

Implements Cogs::IContext.

Definition at line 136 of file ContextCommon.cpp.

◆ setSamplerState() [3/3]

virtual void Cogs::IContext::setSamplerState ( const StringView name,
unsigned int  unit,
SamplerStateHandle  samplerStateHandle 
)
virtual

Sets the sampler slot given by unit with the given name to contain the given sampler state.

If the sampler state is set to NoHandle the default sampler state is set.

Parameters
nameName of the sampler state object as used in shaders (only used where applicable).
unitTexture unit to bind the sampler state to. The sampler state object is used to sample textures bound to this unit.
samplerStateHandleHandle to a valid sampler state, or NoHandle to set the default sampler state for the given unit.

Implements Cogs::IContext.

◆ setScalarVariable() [1/6]

void Cogs::ContextCommon::setScalarVariable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count 
)
overridevirtual

Sets the given scalar integer point variable to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 83 of file ContextCommon.cpp.

◆ setScalarVariable() [2/6]

void Cogs::ContextCommon::setScalarVariable ( const EffectVariableHandle  variableHandle,
const float  value 
)
overridevirtual

Sets the given scalar floating point variable to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 78 of file ContextCommon.cpp.

◆ setScalarVariable() [3/6]

void Cogs::ContextCommon::setScalarVariable ( const EffectVariableHandle  variableHandle,
const int *  value,
size_t  count 
)
overridevirtual

Sets the given scalar integer point variable to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 93 of file ContextCommon.cpp.

◆ setScalarVariable() [4/6]

void Cogs::ContextCommon::setScalarVariable ( const EffectVariableHandle  variableHandle,
int  value 
)
overridevirtual

Sets the given scalar integer point variable to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 88 of file ContextCommon.cpp.

◆ setScalarVariable() [5/6]

void Cogs::ContextCommon::setScalarVariable ( const StringView name,
const float  value 
)
inlineoverridevirtual

Sets the scalar floating point variable with the given name to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 36 of file ContextCommon.h.

◆ setScalarVariable() [6/6]

void Cogs::ContextCommon::setScalarVariable ( const StringView name,
int  value 
)
inlineoverridevirtual

Sets the scalar integer variable with the given name to the given value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 40 of file ContextCommon.h.

◆ setTexture() [1/6]

void Cogs::ContextCommon::setTexture ( const StringView name,
TextureViewHandle  textureViewHandle 
)
finalvirtual

Implements Cogs::IContext.

Definition at line 132 of file ContextCommon.cpp.

◆ setTexture() [2/6]

virtual void Cogs::IContext::setTexture ( const StringView name,
TextureViewHandle  textureViewHandle 
)
virtual

Implements Cogs::IContext.

◆ setTexture() [3/6]

void Cogs::ContextCommon::setTexture ( const StringView name,
unsigned int  unit,
TextureHandle  textureHandle 
)
finalvirtual

Sets the texture slot given by unit with the given name to contain the given texture.

If the texture is set to NoHandle the texture slot is cleared.

Parameters
nameName of the texture object as used in shaders.
unitTexture unit to bind the texture to.
textureHandleHandle to a valid texture, or NoHandle to set the default texture binding for the given unit.

Implements Cogs::IContext.

Definition at line 128 of file ContextCommon.cpp.

◆ setTexture() [4/6]

virtual void Cogs::IContext::setTexture ( const StringView name,
unsigned int  unit,
TextureHandle  textureHandle 
)
virtual

Sets the texture slot given by unit with the given name to contain the given texture.

If the texture is set to NoHandle the texture slot is cleared.

Parameters
nameName of the texture object as used in shaders.
unitTexture unit to bind the texture to.
textureHandleHandle to a valid texture, or NoHandle to set the default texture binding for the given unit.

Implements Cogs::IContext.

◆ setTexture() [5/6]

virtual void Cogs::IContext::setTexture ( const TextureBindingHandle  textureBindingHandle,
const TextureHandle  textureHandle 
)
virtual

Sets the texture given to the binding given by textureBindingHandle.

Parameters
textureBindingHandleValid handle to a previously created texture binding.
textureHandleHandle to a texture object, or NoHandle to set the default texture to the given binding.

Implements Cogs::IContext.

◆ setTexture() [6/6]

virtual void Cogs::IContext::setTexture ( const TextureBindingHandle  textureBindingHandle,
TextureViewHandle  textureViewHandle 
)
virtual

Implements Cogs::IContext.

◆ setVariable() [1/2]

void Cogs::ContextCommon::setVariable ( const EffectVariableHandle  index,
const uint8_t *  data,
size_t  size 
)
overridevirtual

Sets the variable with the given name and size.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 186 of file ContextCommon.cpp.

References Cogs::Handle_t< Type, Convertible >::handle.

◆ setVariable() [2/2]

void Cogs::ContextCommon::setVariable ( const StringView name,
const uint8_t *  data,
size_t  size 
)

Definition at line 200 of file ContextCommon.cpp.

◆ setVector2Variable() [1/2]

void Cogs::ContextCommon::setVector2Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
overridevirtual

Sets the given vector variable to the given two-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 98 of file ContextCommon.cpp.

◆ setVector2Variable() [2/2]

void Cogs::ContextCommon::setVector2Variable ( const StringView name,
const float *  value 
)
inlineoverridevirtual

Sets the vector variable with the given name to the given two-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 44 of file ContextCommon.h.

◆ setVector3Variable() [1/2]

void Cogs::ContextCommon::setVector3Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
overridevirtual

Sets the given vector variable to the given three-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 103 of file ContextCommon.cpp.

◆ setVector3Variable() [2/2]

void Cogs::ContextCommon::setVector3Variable ( const StringView name,
const float *  value 
)
inlineoverridevirtual

Sets the vector variable with the given name to the given three-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 48 of file ContextCommon.h.

◆ setVector4Variable() [1/3]

void Cogs::ContextCommon::setVector4Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
overridevirtual

Sets the given vector variable to the given four-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 108 of file ContextCommon.cpp.

◆ setVector4Variable() [2/3]

void Cogs::ContextCommon::setVector4Variable ( const EffectVariableHandle  variableHandle,
const int *  value,
size_t  count = 1 
)
overridevirtual

Sets the given vector variable to the given four-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 113 of file ContextCommon.cpp.

◆ setVector4Variable() [3/3]

void Cogs::ContextCommon::setVector4Variable ( const StringView name,
const float *  value 
)
inlineoverridevirtual

Sets the vector variable with the given name to the given four-component value.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30.

Definition at line 52 of file ContextCommon.h.

◆ setVertexArrayObject()

void Cogs::ContextCommon::setVertexArrayObject ( VertexArrayObjectHandle  vertexArrayObject)
overridevirtual

Logs an unsupported error, override to provide support.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30, and Cogs::ContextVK.

Definition at line 205 of file ContextCommon.cpp.

◆ signal()

virtual void Cogs::ContextCommon::signal ( FenceHandle  fenceHandle)
inlineoverridevirtual

Insert a fence in the command stream that will signal when all commands before the fence are completed.

Parameters
fenceHandleThe fence to signal.

Implements Cogs::IContext.

Reimplemented in Cogs::ContextD3D11, Cogs::ContextD3D12, Cogs::ContextGL20, and Cogs::ContextGLES30.

Definition at line 87 of file ContextCommon.h.

◆ updateBuffer()

void Cogs::ContextCommon::updateBuffer ( BufferHandle  bufferHandle,
const void *  data,
size_t  size 
)
overridevirtual

Replace contents of buffer with new data.

This will typically map the buffer + memcpy where this is fast, otherwise it will call buffer update function in underlying api.

The existing contents of the buffer will be invalidated: If provided data is smaller than buffer size, the rest of the buffer is undefined.

See also
map, unmap, updateSubBuffer

Implements Cogs::IContext.

Reimplemented in Cogs::ContextGLES30, and Cogs::ContextVK.

Definition at line 170 of file ContextCommon.cpp.

References Cogs::MapMode::WriteDiscard.

◆ updateConstantBuffers()

void Cogs::ContextCommon::updateConstantBuffers ( )
protected

Definition at line 146 of file ContextCommon.cpp.

◆ uploadStatisticsBufferUpload()

void Cogs::ContextCommon::uploadStatisticsBufferUpload ( size_t  size)
protected

Definition at line 56 of file ContextCommon.cpp.

◆ uploadStatisticsTextureUpload()

void Cogs::ContextCommon::uploadStatisticsTextureUpload ( size_t  size)
protected

Definition at line 62 of file ContextCommon.cpp.

Friends And Related Function Documentation

◆ BuffersD3D11

friend struct BuffersD3D11
friend

Definition at line 129 of file ContextCommon.h.

◆ TexturesD3D11

friend struct TexturesD3D11
friend

Definition at line 130 of file ContextCommon.h.

Member Data Documentation

◆ constantBuffersUpdated

bool Cogs::ContextCommon::constantBuffersUpdated = true
protected

Definition at line 125 of file ContextCommon.h.

◆ currStats

FrameStatistics Cogs::ContextCommon::currStats {}
protected

Definition at line 109 of file ContextCommon.h.

◆ currUploadStats

UploadStatistics Cogs::ContextCommon::currUploadStats {}
protected

Definition at line 112 of file ContextCommon.h.

◆ effect

Effect* Cogs::ContextCommon::effect = nullptr
protected

Definition at line 124 of file ContextCommon.h.

◆ frameStatisticsEnabled

bool Cogs::ContextCommon::frameStatisticsEnabled = false
protected

Definition at line 126 of file ContextCommon.h.

◆ prevStats

FrameStatistics Cogs::ContextCommon::prevStats {}
protected

Definition at line 108 of file ContextCommon.h.

◆ prevUploadStats

UploadStatistics Cogs::ContextCommon::prevUploadStats {}
protected

Definition at line 111 of file ContextCommon.h.

◆ uploadStatisticsEnabled

bool Cogs::ContextCommon::uploadStatisticsEnabled = true
protected

Definition at line 127 of file ContextCommon.h.


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