Cogs.Rendering
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Cogs::IContext Struct Referenceabstract

Represents a graphics device context which can receive rendering commands. More...

#include <IContext.h>

Public Member Functions

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.
 

Detailed Description

Represents a graphics device context which can receive rendering commands.

Member Function Documentation

◆ beginRenderPass()

virtual void Cogs::IContext::beginRenderPass ( const RenderPassInfo info)
pure virtual

Begin a render pass.

Render passes encapsulate binding render targets, multisample resolve and load and store operations.

While in a render pass do NOT use setRenderTarget(), clearRenderTarget(), clearDepth().

Check GraphicsDeviceCapabilities::RenderPass for support.

◆ clearCachedState()

virtual void Cogs::IContext::clearCachedState ( )
inlinevirtual

Prepare context for external manipulation of graphics device.

Primarily relevant in WebGL to allow javascript to do GL calls without interfering with context's cached state.

◆ clearDepth()

virtual void Cogs::IContext::clearDepth ( const float  depth = 1.0f)
pure virtual

Clear the currently set depth/stencil target to the given depth.

◆ clearRenderTarget() [1/2]

virtual void Cogs::IContext::clearRenderTarget ( const float **  values,
const int  numvalues 
)
pure virtual

Clear the currently set render target, setting the individual render target views to the given values (4 component floating point RGBA).

◆ clearRenderTarget() [2/2]

virtual void Cogs::IContext::clearRenderTarget ( const float *  value)
pure virtual

Clear the currently set render target to the given value (4 component floating point RGBA).

If the render target has less than 4 components, only the first n components need to be intended values.

◆ clearResource() [1/2]

virtual void Cogs::IContext::clearResource ( BufferHandle  destinationHandle,
float *  Values 
)
pure virtual

◆ clearResource() [2/2]

virtual void Cogs::IContext::clearResource ( BufferHandle  destinationHandle,
uint32_t *  Values 
)
pure virtual

◆ copyResource() [1/2]

virtual void Cogs::IContext::copyResource ( BufferHandle  destinationHandle,
BufferHandle  sourceHandle 
)
pure virtual

◆ copyResource() [2/2]

virtual void Cogs::IContext::copyResource ( TextureHandle  destinationHandle,
TextureHandle  sourceHandle 
)
pure virtual

◆ copyTexture()

virtual void Cogs::IContext::copyTexture ( TextureHandle  dstHandle,
unsigned  dstSub,
unsigned  dstX,
unsigned  dstY,
unsigned  dstZ,
TextureHandle  sourceHandle,
unsigned  srcSub 
)
pure virtual

◆ dispatchCompute()

virtual void Cogs::IContext::dispatchCompute ( const unsigned int  threadGroupsX,
const unsigned int  threadGroupsY,
const unsigned int  threadGroupsZ 
)
pure virtual

Dispatch computing work on the graphics device using the desired thread group count.

Parameters
threadGroupsXNumber of work groups spawned in the X dimension.
threadGroupsYNumber of work groups spawned in the Y dimension.
threadGroupsZNumber of work groups spawned in the Z dimension.

◆ draw()

virtual void Cogs::IContext::draw ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startVertex,
const size_t  numVertexes 
)
pure virtual

Draws non-indexed, non-instanced primitives.

Parameters
primitiveTypePrimitive type to assemble from the bound vertex buffers.
startVertexIndex of the first vertex in the bound vertex buffers to start at when drawing.
numVertexesNumber of vertexes to draw.

◆ drawIndexed()

virtual void Cogs::IContext::drawIndexed ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startIndex,
const size_t  numIndexes,
const size_t  startVertex = 0 
)
pure virtual

Draws indexed, non-instanced primitives.

Parameters
primitiveTypePrimitive type to assemble from the bound vertex buffers.
startIndexIndex of the first item in the index buffer to start at when drawing.
numIndexesNumber of indexes to draw.
startVertexIndex of the base vertex in the vertex buffer to index from.

◆ drawInstanced()

virtual void Cogs::IContext::drawInstanced ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startVertex,
const size_t  numVertexes,
const size_t  startInstance,
const size_t  numInstances 
)
pure virtual

Draws non-indexed, instanced primitives.

Parameters
primitiveTypePrimitive type to assemble from the bound vertex buffers.
startVertexIndex of the first vertex in the bound vertex buffers to start at when drawing each instance.
numVertexesNumber of vertexes to draw per instance.
startInstanceIndex of the first instance to start drawing at.
numInstancesNumber of instances to draw.

◆ drawInstancedIndexed()

virtual void Cogs::IContext::drawInstancedIndexed ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startInstance,
const size_t  numInstances,
const size_t  startIndex,
const size_t  numIndexes 
)
pure virtual

Draws indexed, instanced primitives.

Parameters
primitiveTypePrimitive type to assemble from the bound vertex buffers.
startInstanceIndex of the first instance to start drawing at.
numInstancesNumber of instances to draw.
startIndexIndex of the first item in the index buffer to start at when drawing each instance.
numIndexesNumber of indexes to draw per instance.

◆ endRenderPass()

virtual void Cogs::IContext::endRenderPass ( )
pure virtual

End a render pass.

◆ frameStatisticsConfigure()

virtual void Cogs::IContext::frameStatisticsConfigure ( bool  enable)
pure virtual

◆ getBufferCounter() [1/2]

virtual uint32_t Cogs::IContext::getBufferCounter ( BufferHandle  bufferHandle)
pure virtual

Get the associated counter of a buffer.

Returns
The value of the counter.

◆ getBufferCounter() [2/2]

virtual void Cogs::IContext::getBufferCounter ( BufferHandle  bufferHandle,
BufferHandle  destinationBufferHandle 
)
pure virtual

Get the associated counter of a buffer.

Parameters
bufferHandleHandle to the buffer to get the counter from. This buffer must have been created with the StructuredBufferWithCounter bind flag.
destinationBufferHandleHandle to a buffer to copy the counter value to.

◆ getLastFrameStatistics()

virtual const Cogs::FrameStatistics & Cogs::IContext::getLastFrameStatistics ( )
pure virtual

◆ getLastUploadStatistics()

virtual const Cogs::UploadStatistics & Cogs::IContext::getLastUploadStatistics ( )
pure virtual

◆ map() [1/2]

virtual void * Cogs::IContext::map ( BufferHandle  bufferHandle,
MapMode::EMapMode  mapMode,
uint32_t *  stride = nullptr 
)
pure virtual

Maps the given buffer so it can be accessed.

Parameters
bufferHandleValid handle to a buffer containing data to be read.
mapModeMapping mode to apply when mapping the buffer.
strideOptional pointer to a stride value. Must be set for aliased buffer texture resources.
Returns
A pointer to the memory mapped from the buffer. If the operation failed, returns nullptr.
See also
MapMode

Referenced by Cogs::MappedBuffer< MappedDataType >::MappedBuffer().

◆ map() [2/2]

virtual void * Cogs::IContext::map ( TextureHandle  textureHandle,
MapMode::EMapMode  accessMode,
uint32_t *  rowPitch,
uint32_t *  depthPitch 
)
pure virtual

Create host mapping of a staging texture.

Parameters
textureHandleStaging texture.
accessModeMapMode::Write (requires TextureFlags::UsageWriteStaging) or MapMode::Read (requires TextureFlags::UsageReadStaging).
[out]rowPitchNumber of bytes between successive rows in the mapping.
[out]depthPitchNumber of bytes between successive slices in the mapping.
Returns
A pointer to the start of the memory range of the mapping.
See also
unmap

◆ popCommandGroupAnnotation()

virtual void Cogs::IContext::popCommandGroupAnnotation ( )
inlinevirtual

End to tag a sequence of commands as a group in graphics debugger.

Referenced by Cogs::CommandGroupAnnotation::~CommandGroupAnnotation().

◆ pushCommandGroupAnnotation()

virtual void Cogs::IContext::pushCommandGroupAnnotation ( const StringView &  name)
inlinevirtual

Begin to tag a sequence of commands as a group in graphics debugger.

Groups can be strictly nested, and a push must always be paired with a pop.

Referenced by Cogs::CommandGroupAnnotation::CommandGroupAnnotation().

◆ readColorBuffer()

virtual void Cogs::IContext::readColorBuffer ( BufferHandle  bufferHandle,
int  x,
int  y,
int  width,
int  height,
Framebuffer::EFrameBuffer  framebuffer 
)
pure virtual

Reads data from the current render target into the given bufferHandle.

Parameters
bufferHandleBuffer to read the data into. Must be at least of size (width * height * sizeof(ColorFormat)).
xAddress of the first pixel on the x-axis to read from.
yAddress of the first pixel on the y-axis to read from.
widthWidth of the data to read in pixels.
heightHeight of the data to read in pixels.
framebufferFrame buffer to read from. Applicable when e.g reading from the default double-buffered render target.

◆ readDepthBuffer()

virtual void Cogs::IContext::readDepthBuffer ( BufferHandle  bufferHandle,
int  x,
int  y,
int  width,
int  height,
Framebuffer::EFrameBuffer  framebuffer 
)
pure virtual

Reads data from the current depth target into the given bufferHandle.

Parameters
bufferHandleBuffer to read the data into. Must be at least of size (width * height * sizeof(DepthFormat)).
xAddress of the first pixel on the x-axis to read from.
yAddress of the first pixel on the y-axis to read from.
widthWidth of the data to read in pixels.
heightHeight of the data to read in pixels.
framebufferFrame buffer to read from. Applicable when e.g reading from the default double-buffered depth target.

◆ reset()

virtual void Cogs::IContext::reset ( )
inlinevirtual

Resets all state changes made to the GPU since the last call to beginFrame.

◆ resolveResource()

virtual void Cogs::IContext::resolveResource ( TextureHandle  source,
TextureHandle  destination 
)
pure virtual

Resolves the given source resource target into the given destination texture.

The source texture is assumed to be a multisample format handled by the GPU internally. This method can be used to resolve such a texture so that it may later be used as a regular texture data (multisampled textures cannot be read by standard samplers).

If using multisample samplers in shaders, this step is not necessary to perform.

◆ setAnnotationMarker()

virtual void Cogs::IContext::setAnnotationMarker ( const StringView &  name)
inlinevirtual

Add a tag in the sequence of commands in graphics debugger.

◆ setBlendState()

virtual void Cogs::IContext::setBlendState ( const BlendStateHandle  handle,
const float *  constant = nullptr 
)
pure virtual

Set the current blend state.

◆ setBuffer() [1/2]

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

Sets a buffer to bind to the given binding.

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

◆ setBuffer() [2/2]

virtual void Cogs::IContext::setBuffer ( const StringView &  name,
BufferHandle  bufferHandle 
)
pure 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.

◆ setBufferCounter() [1/2]

virtual void Cogs::IContext::setBufferCounter ( BufferHandle  bufferHandle,
BufferHandle  sourceBufferHandle 
)
pure virtual

Set the associated counter of a buffer.

Parameters
bufferHandleHandle to the buffer to set the counter for. This buffer must have been created with the StructuredBufferWithCounter bind flag.
sourceBufferHandleHandle to a buffer to copy the counter value from.

◆ setBufferCounter() [2/2]

virtual void Cogs::IContext::setBufferCounter ( BufferHandle  bufferHandle,
uint32_t  value 
)
pure virtual

Set the associated counter of a buffer.

Parameters
bufferHandleHandle to the buffer to set the counter for. This buffer must have been created with the StructuredBufferWithCounter bind flag.
valueThe new value of the counter.

◆ setConstantBuffer() [1/2]

virtual void Cogs::IContext::setConstantBuffer ( const ConstantBufferBindingHandle  bufferBindingHandle,
const BufferHandle  bufferHandle,
const uint32_t  offset = 0,
const uint32_t  size = ~0u 
)
pure 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

◆ setConstantBuffer() [2/2]

virtual void Cogs::IContext::setConstantBuffer ( const StringView &  name,
const BufferHandle  bufferHandle,
const uint32_t  offset = 0,
const uint32_t  size = ~0u 
)
pure 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.

◆ setDepthStencilState()

virtual void Cogs::IContext::setDepthStencilState ( const DepthStencilStateHandle  handle)
pure virtual

Set the current depth stencil state.

◆ setEffect()

virtual void Cogs::IContext::setEffect ( EffectHandle  handle)
pure virtual

Set the current effect.

This sets up all shader stages included in the effect (e.g if the effect contains VS and PS shaders both the VS stage and PS stage is set up.

◆ setIndexBuffer()

virtual void Cogs::IContext::setIndexBuffer ( IndexBufferHandle  bufferHandle,
uint32_t  stride = 4,
uint32_t  offset = 0 
)
pure virtual

Sets the current index buffer.

Parameters
bufferHandleValid handle to an index buffer.
strideByte stride of the index data. Currently only supports 2 and 4. Setting stride to zero defaults to the buffers natural stride, if any. If no natural stride is set, no buffer will be bound.
offsetOffset in bytes from the start of the buffer to the first index to use.

◆ setInputLayout()

virtual void Cogs::IContext::setInputLayout ( const InputLayoutHandle  inputLayoutHandle)
pure virtual

Sets the current input layout.

Parameters
inputLayoutHandleValid handle to a previously created input layout.

◆ setMatrixVariable() [1/3]

virtual void Cogs::IContext::setMatrixVariable ( const EffectVariableHandle  variableHandle,
const float *  value 
)
pure virtual

Sets the given matrix variable to value.

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

◆ setMatrixVariable() [2/3]

virtual void Cogs::IContext::setMatrixVariable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count 
)
pure virtual

Sets the given matrix variable to value.

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

◆ setMatrixVariable() [3/3]

virtual void Cogs::IContext::setMatrixVariable ( const StringView &  name,
const float *  value 
)
pure virtual

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.

◆ setRasterizerState()

virtual void Cogs::IContext::setRasterizerState ( const RasterizerStateHandle  handle)
pure virtual

Set the current rasterizer state.

◆ setRenderTarget()

virtual void Cogs::IContext::setRenderTarget ( const RenderTargetHandle  handle,
const DepthStencilHandle  depthStencilHandle 
)
pure virtual

Sets the current render target and an associated depth stencil target.

◆ setSamplerState() [1/2]

virtual void Cogs::IContext::setSamplerState ( const SamplerStateBindingHandle  samplerStateBindingHandle,
const SamplerStateHandle  samplerStateHandle 
)
pure 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.

◆ setSamplerState() [2/2]

virtual void Cogs::IContext::setSamplerState ( const StringView &  name,
unsigned int  unit,
SamplerStateHandle  samplerStateHandle 
)
pure 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.

◆ setScalarVariable() [1/6]

virtual void Cogs::IContext::setScalarVariable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count 
)
pure virtual

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

◆ setScalarVariable() [2/6]

virtual void Cogs::IContext::setScalarVariable ( const EffectVariableHandle  variableHandle,
const float  value 
)
pure virtual

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

◆ setScalarVariable() [3/6]

virtual void Cogs::IContext::setScalarVariable ( const EffectVariableHandle  variableHandle,
const int *  value,
size_t  count 
)
pure virtual

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

◆ setScalarVariable() [4/6]

virtual void Cogs::IContext::setScalarVariable ( const EffectVariableHandle  variableHandle,
int  value 
)
pure virtual

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

◆ setScalarVariable() [5/6]

virtual void Cogs::IContext::setScalarVariable ( const StringView &  name,
const float  value 
)
pure virtual

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

◆ setScalarVariable() [6/6]

virtual void Cogs::IContext::setScalarVariable ( const StringView &  name,
int  value 
)
pure virtual

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

◆ setScissor()

virtual void Cogs::IContext::setScissor ( const int  x,
const int  y,
const int  width,
const int  height 
)
pure virtual

Sets the current scissor rectangle.

Only used if the current rasterizer state enabled scissor testing.

See also
RasterizerState.

◆ setTexture() [1/4]

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

◆ setTexture() [2/4]

virtual void Cogs::IContext::setTexture ( const StringView &  name,
unsigned int  unit,
TextureHandle  textureHandle 
)
pure 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.

◆ setTexture() [3/4]

virtual void Cogs::IContext::setTexture ( const TextureBindingHandle  textureBindingHandle,
const TextureHandle  textureHandle 
)
pure 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.

◆ setTexture() [4/4]

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

◆ setVariable()

virtual void Cogs::IContext::setVariable ( const EffectVariableHandle  index,
const uint8_t *  data,
size_t  size 
)
pure virtual

Sets the variable with the given name and size.

◆ setVector2Variable() [1/2]

virtual void Cogs::IContext::setVector2Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
pure virtual

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

◆ setVector2Variable() [2/2]

virtual void Cogs::IContext::setVector2Variable ( const StringView &  name,
const float *  value 
)
pure virtual

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

◆ setVector3Variable() [1/2]

virtual void Cogs::IContext::setVector3Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
pure virtual

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

◆ setVector3Variable() [2/2]

virtual void Cogs::IContext::setVector3Variable ( const StringView &  name,
const float *  value 
)
pure virtual

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

◆ setVector4Variable() [1/3]

virtual void Cogs::IContext::setVector4Variable ( const EffectVariableHandle  variableHandle,
const float *  value,
size_t  count = 1 
)
pure virtual

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

◆ setVector4Variable() [2/3]

virtual void Cogs::IContext::setVector4Variable ( const EffectVariableHandle  variableHandle,
const int *  value,
size_t  count = 1 
)
pure virtual

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

◆ setVector4Variable() [3/3]

virtual void Cogs::IContext::setVector4Variable ( const StringView &  name,
const float *  value 
)
pure virtual

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

◆ setVertexArrayObject()

virtual void Cogs::IContext::setVertexArrayObject ( VertexArrayObjectHandle  vertexArrayObject)
pure virtual

Sets vertexBuffers and index buffers using a prevalidated vertex array object.

Note
Check capabilites before using this.

◆ setVertexBuffers() [1/2]

virtual void Cogs::IContext::setVertexBuffers ( const VertexBufferHandle vertexBufferHandles,
const size_t  count 
)
pure virtual

Overload provided to support transitioning.

Only supports vertex buffers created with legacy loadVertexBuffer API.

◆ setVertexBuffers() [2/2]

virtual void Cogs::IContext::setVertexBuffers ( const VertexBufferHandle vertexBufferHandles,
const size_t  count,
const uint32_t *  strides,
const uint32_t *  offsets 
)
pure virtual

Sets the current vertex buffers.

Parameters
vertexBufferHandlesPointer to an array of vertex buffer handles of size at least count.
countNumber of vertex buffers to bind.
stridesPointer to array of stride values. Must be non-null and at least of size count.
offsetsOptional pointer to array of offset values. If non-null, must be at least of size count.

◆ setViewport()

virtual void Cogs::IContext::setViewport ( const float  x,
const float  y,
const float  width,
const float  height 
)
pure virtual

Sets the current viewport to the given location and dimensions.

◆ signal()

virtual void Cogs::IContext::signal ( FenceHandle  fenceHandle)
pure virtual

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

Parameters
fenceHandleThe fence to signal.

◆ unmap() [1/2]

virtual void Cogs::IContext::unmap ( BufferHandle  bufferHandle)
pure virtual

Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memory.

Parameters
bufferHandleValid handle to a buffer that is currently mapped.
See also
map

Referenced by Cogs::MappedBuffer< MappedDataType >::~MappedBuffer().

◆ unmap() [2/2]

virtual void Cogs::IContext::unmap ( TextureHandle  textureHandle)
pure virtual

Release a host mapping of a staging texture.

Parameters
textureHandleStaging texture that is currently mapped.

◆ updateBuffer()

virtual void Cogs::IContext::updateBuffer ( BufferHandle  bufferHandle,
const void *  data,
size_t  size 
)
pure virtual

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

◆ updateSubBuffer()

virtual void Cogs::IContext::updateSubBuffer ( BufferHandle  bufferHandle,
const size_t  offset,
const size_t  size,
const void *  data 
)
pure virtual

Update a region of data in a buffer.

Parameters
bufferHandleValid handle to a buffer to update data in.
offsetOffset in bytes from the start of the buffer to where the new data should be written.
sizeSize of the data given. Offset + size must be inside the allocated size of the buffer.
dataPointer to the data to store at the given offset in the buffer.
invalidateInvalidate existing buffer contents before updating buffer, i.e. no need to maintain old values.

◆ updateSubTexture()

virtual void Cogs::IContext::updateSubTexture ( TextureHandle  textureHandle,
const size_t  level,
const void *  data 
)
pure virtual

Update the data of a level in the given texture.

Parameters
textureHandleValid handle to a texture to update data in.
levelIndex of the mip level to update.
dataPointer to the data to store in the indicated mip level. Must be sized according to the dimensions, format and mip level.

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