Cogs.Core
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Cogs::ContextGLES30 Struct Reference
Inheritance diagram for Cogs::ContextGLES30:
Cogs::ContextCommon Cogs::IContext

Public Member Functions

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

TextureGLES30bindTexture (TextureHandle texture, GLuint unit=GLuint(~0u))
 
GLenum bindBuffer (OpenGLES30::BufferTarget target, GLuint buffer)
 
GLenum bindBufferCopy (OpenGLES30::BufferTarget target, BufferGLES30 &buffer)
 
void unbindBuffer (GLuint buffer)
 
void unbindVAO ()
 
- Protected Member Functions inherited from Cogs::ContextCommon
void setCurrentEffect (Effect *currentEffect)
 
void updateConstantBuffers ()
 
void frameStatisticsAccountDrawCall (size_t count, bool indexed)
 
void uploadStatisticsBufferUpload (size_t size)
 
void uploadStatisticsTextureUpload (size_t size)
 

Private Member Functions

void setupVertexAttributes (size_t baseVertex)
 
bool setupState ()
 
bool setupDraw (size_t baseVertex)
 
bool setupIndexedDraw (GLenum &indexType, GLsizei &indexCount, const GLvoid *&indexOffset, const size_t startIndex, const size_t numIndices, const size_t baseVertex)
 

Private Attributes

BuffersGLES30buffers = nullptr
 
TexturesGLES30textures = nullptr
 
EffectsGLES30effects = nullptr
 
RenderTargetsGLES30renderTargets = nullptr
 
CapabilitiesGLES30capabilities = nullptr
 
GLSyncObjectssyncObjects = nullptr
 
SamplerStateHandle defaultSamplerStateHandle = SamplerStateHandle::NoHandle
 
GLuint activeTexUnit = 0
 
struct {
   TextureHandle   texture = TextureHandle::NoHandle
 
   SamplerStateHandle   sampler = SamplerStateHandle::NoHandle
 
   GLenum   target = GL_TEXTURE_2D
 
texUnits [OpenGLES30::maxTexUnits]
 
bool inRenderPass = false
 
RenderPassInfo renderPassInfo = {}
 
RenderTargetHandle currentRenderTarget = RenderTargetHandle::NoHandle
 
DepthStencilHandle currentDepthStencilTarget = DepthStencilHandle::NoHandle
 
struct {
   GLuint   buffer = 0
 
bufferTargets [size_t(OpenGLES30::BufferTarget::Count)]
 
BufferHandle emptyUniformBuffer = BufferHandle::NoHandle
 
struct {
   GLuint   buffer = 0
 
   GLuint   offset = 0
 
   GLuint   size = 0
 
uniformBufferTargets [size_t(OpenGLES30::maxUniformBuffers)]
 
struct {
   struct {
      VertexBufferHandle   handle = VertexBufferHandle::NoHandle
 
      uint32_t   stride = 0
 
      uint32_t   offset = 0
 
   }   currItems [OpenGLES30::maxVertexAttributes]
 
   uint32_t   baseVertex = 0
 
   uint32_t   count = 0
 
vertexBuffers
 
struct {
   InputLayoutHandle   prevHandle = InputLayoutHandle::NoHandle
 
   InputLayoutHandle   currHandle = InputLayoutHandle::NoHandle
 
inputLayout
 
struct {
   IndexBufferHandle   handle = IndexBufferHandle::NoHandle
 
   uint32_t   stride = 0
 
   uint32_t   offset = 0
 
indexBuffer
 
struct {
   VertexArrayObjectHandle   prevHandle = VertexArrayObjectHandle::NoHandle
 
   VertexArrayObjectHandle   currHandle = VertexArrayObjectHandle::NoHandle
 
   GLenum   indexType = GL_INVALID_ENUM
 
   GLsizei   indexCount = 0
 
   GLsizei   indexStride = 0
 
vertexArrayObject
 
struct {
   EffectHandle   handle = EffectHandle::NoHandle
 
   EffectGLES30 *   ptr = nullptr
 
currentEffect
 
uint32_t currentAttributeMask = 0
 
RasterizerState currentRasterizerState = RasterizerState::DefaultState()
 
struct {
   BlendStateHandle   handle = BlendStateHandle::NoHandle
 
   float   constant [4] = {}
 
   BlendStateGLES30   state
 
currBlendState
 
struct {
   BlendStateHandle   handle = BlendStateHandle::NoHandle
 
   float   constant [4] = {}
 
nextBlendState
 
DepthStencilState currentDepthStencilState = DepthStencilState::DefaultState()
 
bool needVertexAttributeSetup = true
 

Friends

struct TexturesGLES30
 
struct BuffersGLES30
 

Additional Inherited Members

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

Detailed Description

Definition at line 31 of file ContextGLES30.h.

Member Function Documentation

◆ beginRenderPass()

void Cogs::ContextGLES30::beginRenderPass ( const RenderPassInfo info)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 589 of file ContextGLES30.cpp.

References Cogs::Handle_t< RenderTargetTag >::InvalidHandle, and Cogs::Handle_t< DepthStencilTag >::InvalidHandle.

◆ bindBuffer()

GLenum Cogs::ContextGLES30::bindBuffer ( OpenGLES30::BufferTarget  target,
GLuint  buffer 
)
protected

Definition at line 218 of file ContextGLES30.cpp.

◆ bindBufferCopy()

GLenum Cogs::ContextGLES30::bindBufferCopy ( OpenGLES30::BufferTarget  target,
BufferGLES30 buffer 
)
inlineprotected

Definition at line 173 of file ContextGLES30.h.

◆ bindTexture()

Cogs::TextureGLES30 * Cogs::ContextGLES30::bindTexture ( TextureHandle  texture,
GLuint  unit = GLuint(~0u) 
)
protected

Definition at line 788 of file ContextGLES30.cpp.

◆ clearCachedState()

void Cogs::ContextGLES30::clearCachedState ( )
finalvirtual

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.

Reimplemented from Cogs::IContext.

Definition at line 1189 of file ContextGLES30.cpp.

References Cogs::Handle_t< TextureTag >::NoHandle, Cogs::Handle_t< SamplerTag >::NoHandle, Cogs::Handle_t< VertexArrayObjectTag >::NoHandle, Cogs::Handle_t< BufferTag, BufferHandle >::NoHandle, and Cogs::Handle_t< EffectTag >::NoHandle.

◆ clearDepth()

void Cogs::ContextGLES30::clearDepth ( const float  depth = 1.0f)
overridevirtual

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

Implements Cogs::IContext.

Definition at line 722 of file ContextGLES30.cpp.

◆ clearRenderTarget() [1/2]

void Cogs::ContextGLES30::clearRenderTarget ( const float **  values,
const int  numvalues 
)
overridevirtual

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

Implements Cogs::IContext.

Definition at line 679 of file ContextGLES30.cpp.

◆ clearRenderTarget() [2/2]

void Cogs::ContextGLES30::clearRenderTarget ( const float *  value)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 667 of file ContextGLES30.cpp.

◆ clearResource() [1/2]

void Cogs::ContextGLES30::clearResource ( BufferHandle  ,
float *   
)
inlineoverridevirtual

Implements Cogs::IContext.

Definition at line 140 of file ContextGLES30.h.

◆ clearResource() [2/2]

void Cogs::ContextGLES30::clearResource ( BufferHandle  ,
uint32_t *   
)
inlineoverridevirtual

Implements Cogs::IContext.

Definition at line 139 of file ContextGLES30.h.

◆ copyResource() [1/2]

void Cogs::ContextGLES30::copyResource ( BufferHandle  destinationHandle,
BufferHandle  sourceHandle 
)
overridevirtual

Implements Cogs::IContext.

Definition at line 1530 of file ContextGLES30.cpp.

◆ copyResource() [2/2]

void Cogs::ContextGLES30::copyResource ( TextureHandle  destinationHandle,
TextureHandle  sourceHandle 
)
overridevirtual

Implements Cogs::IContext.

Definition at line 1554 of file ContextGLES30.cpp.

◆ copyTexture()

void Cogs::ContextGLES30::copyTexture ( TextureHandle  dstHandle,
unsigned  dstSub,
unsigned  dstX,
unsigned  dstY,
unsigned  dstZ,
TextureHandle  sourceHandle,
unsigned  srcSub 
)
overridevirtual

Implements Cogs::IContext.

Definition at line 1399 of file ContextGLES30.cpp.

◆ dispatchCompute()

void Cogs::ContextGLES30::dispatchCompute ( const unsigned int  threadGroupsX,
const unsigned int  threadGroupsY,
const unsigned int  threadGroupsZ 
)
inlinevirtual

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.

Implements Cogs::IContext.

Definition at line 115 of file ContextGLES30.h.

◆ draw()

void Cogs::ContextGLES30::draw ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startVertex,
const size_t  numVertexes 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 495 of file ContextGLES30.cpp.

◆ drawIndexed()

void Cogs::ContextGLES30::drawIndexed ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startIndex,
const size_t  numIndexes,
const size_t  startVertex = 0 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 505 of file ContextGLES30.cpp.

◆ drawInstanced()

void Cogs::ContextGLES30::drawInstanced ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startVertex,
const size_t  numVertexes,
const size_t  startInstance,
const size_t  numInstances 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 518 of file ContextGLES30.cpp.

◆ drawInstancedIndexed()

void Cogs::ContextGLES30::drawInstancedIndexed ( PrimitiveType::EPrimitiveType  primitiveType,
const size_t  startInstance,
const size_t  numInstances,
const size_t  startIndex,
const size_t  numIndexes 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 533 of file ContextGLES30.cpp.

◆ endRenderPass()

void Cogs::ContextGLES30::endRenderPass ( )
overridevirtual

◆ getBufferCounter() [1/2]

uint32_t Cogs::ContextGLES30::getBufferCounter ( BufferHandle  bufferHandle)
overridevirtual

Get the associated counter of a buffer.

Returns
The value of the counter.

Implements Cogs::IContext.

Definition at line 1525 of file ContextGLES30.cpp.

◆ getBufferCounter() [2/2]

void Cogs::ContextGLES30::getBufferCounter ( BufferHandle  bufferHandle,
BufferHandle  destinationBufferHandle 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1520 of file ContextGLES30.cpp.

◆ getCurrentEffect()

EffectHandle Cogs::ContextGLES30::getCurrentEffect ( )
inlineoverridevirtual

Implements Cogs::ContextCommon.

Definition at line 47 of file ContextGLES30.h.

◆ getEffect()

EffectHandle Cogs::ContextGLES30::getEffect ( )
inline

Definition at line 71 of file ContextGLES30.h.

◆ getEffects()

Cogs::IEffects * Cogs::ContextGLES30::getEffects ( )
overridevirtual

Implements Cogs::ContextCommon.

Definition at line 115 of file ContextGLES30.cpp.

◆ getIAState()

InputAssemblerStateCommon * Cogs::ContextGLES30::getIAState ( )
inlineoverridevirtual

Implements Cogs::ContextCommon.

Definition at line 45 of file ContextGLES30.h.

◆ initialize()

void Cogs::ContextGLES30::initialize ( BuffersGLES30 buffers,
TexturesGLES30 textures,
EffectsGLES30 effects,
RenderTargetsGLES30 renderTargets,
CapabilitiesGLES30 caps,
GLSyncObjects sync 
)
inline

Definition at line 36 of file ContextGLES30.h.

◆ map() [1/2]

void * Cogs::ContextGLES30::map ( BufferHandle  bufferHandle,
MapMode::EMapMode  mapMode,
uint32_t *  stride = nullptr 
)
overridevirtual

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

Implements Cogs::IContext.

Definition at line 1302 of file ContextGLES30.cpp.

References Cogs::BufferGLES30::bufferId, Cogs::BufferGLES30::isMapped, Cogs::BufferGLES30::mappedData, Cogs::MapMode::Read, Cogs::MapMode::ReadWrite, Cogs::BufferGLES30::size, Cogs::BufferGLES30::target, Cogs::MapMode::Write, Cogs::BufferGLES30::writeBackMap, and Cogs::MapMode::WriteDiscard.

◆ map() [2/2]

void * Cogs::ContextGLES30::map ( TextureHandle  textureHandle,
MapMode::EMapMode  accessMode,
uint32_t *  rowPitch,
uint32_t *  depthPitch 
)
inlineoverridevirtual

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

Implements Cogs::IContext.

Definition at line 127 of file ContextGLES30.h.

◆ readColorBuffer()

void Cogs::ContextGLES30::readColorBuffer ( BufferHandle  bufferHandle,
int  x,
int  y,
int  width,
int  height,
Framebuffer::EFrameBuffer  framebuffer 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1263 of file ContextGLES30.cpp.

References Cogs::FormatInfo::blockSize, Cogs::BufferGLES30::bufferId, Cogs::Handle_t< RenderTargetTag >::InvalidHandle, Cogs::BufferGLES30::size, and Cogs::RenderTargetViewDescription::texture.

◆ readDepthBuffer()

void Cogs::ContextGLES30::readDepthBuffer ( BufferHandle  bufferHandle,
int  x,
int  y,
int  width,
int  height,
Framebuffer::EFrameBuffer  framebuffer 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1258 of file ContextGLES30.cpp.

◆ reset()

void Cogs::ContextGLES30::reset ( )
overridevirtual

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

Reimplemented from Cogs::IContext.

Definition at line 1559 of file ContextGLES30.cpp.

◆ resolveResource()

void Cogs::ContextGLES30::resolveResource ( TextureHandle  source,
TextureHandle  destination 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 933 of file ContextGLES30.cpp.

References Cogs::TextureFlags::DepthBuffer.

◆ setBlendState()

void Cogs::ContextGLES30::setBlendState ( const BlendStateHandle  handle,
const float *  constant 
)
overridevirtual

Set the current blend state.

Implements Cogs::IContext.

Definition at line 581 of file ContextGLES30.cpp.

◆ setBuffer()

void Cogs::ContextGLES30::setBuffer ( const BufferBindingHandle  bufferBindingHandle,
BufferHandle  bufferHandle 
)
overridevirtual

Sets a buffer to bind to the given binding.

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

Implements Cogs::IContext.

Definition at line 1505 of file ContextGLES30.cpp.

◆ setBufferCounter() [1/2]

void Cogs::ContextGLES30::setBufferCounter ( BufferHandle  bufferHandle,
BufferHandle  sourceBufferHandle 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1515 of file ContextGLES30.cpp.

◆ setBufferCounter() [2/2]

void Cogs::ContextGLES30::setBufferCounter ( BufferHandle  bufferHandle,
uint32_t  value 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1510 of file ContextGLES30.cpp.

◆ setConstantBuffer()

void Cogs::ContextGLES30::setConstantBuffer ( const ConstantBufferBindingHandle  bufferBindingHandle,
const BufferHandle  bufferHandle,
const uint32_t  offset,
const uint32_t  size 
)
overridevirtual

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.

Definition at line 281 of file ContextGLES30.cpp.

References Cogs::BufferGLES30::bufferId, Cogs::Handle_t< Type, Convertible >::handle, and Cogs::BufferGLES30::size.

◆ setDefaults()

void Cogs::ContextGLES30::setDefaults ( )

Definition at line 1107 of file ContextGLES30.cpp.

◆ setDepthStencilState()

void Cogs::ContextGLES30::setDepthStencilState ( const DepthStencilStateHandle  handle)
overridevirtual

◆ setEffect()

void Cogs::ContextGLES30::setEffect ( EffectHandle  handle)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 729 of file ContextGLES30.cpp.

References Cogs::Handle_t< Type, Convertible >::handle, Cogs::Handle_t< EffectTag >::InvalidHandle, and Cogs::Handle_t< EffectTag >::NoHandle.

Referenced by Cogs::EffectsGLES30::releaseEffect().

◆ setIndexBuffer()

void Cogs::ContextGLES30::setIndexBuffer ( IndexBufferHandle  bufferHandle,
uint32_t  stride,
uint32_t  offset 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 259 of file ContextGLES30.cpp.

References Cogs::Handle_t< Type, Convertible >::handle, Cogs::Handle_t< BufferTag, BufferHandle >::InvalidHandle, Cogs::BufferGLES30::isIndexBuffer, and Cogs::Handle_t< VertexArrayObjectTag >::NoHandle.

◆ setInputLayout()

void Cogs::ContextGLES30::setInputLayout ( const InputLayoutHandle  inputLayoutHandle)
overridevirtual

Sets the current input layout.

Parameters
inputLayoutHandleValid handle to a previously created input layout.

Implements Cogs::IContext.

Definition at line 928 of file ContextGLES30.cpp.

◆ setMatrixVariable() [1/3]

void Cogs::ContextGLES30::setMatrixVariable ( const EffectVariableHandle  variableHandle,
const float *  value 
)
inlineoverridevirtual

Sets the given matrix variable to value.

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

Reimplemented from Cogs::ContextCommon.

Definition at line 80 of file ContextGLES30.h.

References setMatrixVariable().

Referenced by setMatrixVariable().

◆ setMatrixVariable() [2/3]

void Cogs::ContextGLES30::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.

Reimplemented from Cogs::ContextCommon.

Definition at line 1042 of file ContextGLES30.cpp.

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

◆ setMatrixVariable() [3/3]

void Cogs::ContextGLES30::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.

Reimplemented from Cogs::ContextCommon.

Definition at line 986 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setRasterizerState()

void Cogs::ContextGLES30::setRasterizerState ( const RasterizerStateHandle  handle)
overridevirtual

◆ setRenderTarget()

void Cogs::ContextGLES30::setRenderTarget ( const RenderTargetHandle  handle,
const DepthStencilHandle  depthStencilHandle 
)
overridevirtual

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

Implements Cogs::IContext.

Definition at line 640 of file ContextGLES30.cpp.

References Cogs::Handle_t< RenderTargetTag >::InvalidHandle, and Cogs::Handle_t< DepthStencilTag >::InvalidHandle.

◆ setSamplerState()

void Cogs::ContextGLES30::setSamplerState ( const SamplerStateBindingHandle  samplerStateBindingHandle,
const SamplerStateHandle  samplerStateHandle 
)
overridevirtual

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.

Definition at line 851 of file ContextGLES30.cpp.

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

◆ setScalarVariable() [1/6]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1051 of file ContextGLES30.cpp.

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

◆ setScalarVariable() [2/6]

void Cogs::ContextGLES30::setScalarVariable ( const EffectVariableHandle  variableHandle,
const float  value 
)
inlineoverridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 83 of file ContextGLES30.h.

References setScalarVariable().

Referenced by setScalarVariable().

◆ setScalarVariable() [3/6]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1060 of file ContextGLES30.cpp.

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

◆ setScalarVariable() [4/6]

void Cogs::ContextGLES30::setScalarVariable ( const EffectVariableHandle  variableHandle,
int  value 
)
inlineoverridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 86 of file ContextGLES30.h.

References setScalarVariable().

Referenced by setScalarVariable().

◆ setScalarVariable() [5/6]

void Cogs::ContextGLES30::setScalarVariable ( const StringView name,
const float  value 
)
overridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 995 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setScalarVariable() [6/6]

void Cogs::ContextGLES30::setScalarVariable ( const StringView name,
int  value 
)
overridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1004 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setScissor()

void Cogs::ContextGLES30::setScissor ( const int  x,
const int  y,
const int  width,
const int  height 
)
overridevirtual

Sets the current scissor rectangle.

Only used if the current rasterizer state enabled scissor testing.

See also
RasterizerState.

Implements Cogs::IContext.

Definition at line 662 of file ContextGLES30.cpp.

◆ setTexture() [1/2]

void Cogs::ContextGLES30::setTexture ( const TextureBindingHandle  textureBindingHandle,
const TextureHandle  textureHandle 
)
finalvirtual

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.

Definition at line 752 of file ContextGLES30.cpp.

References Cogs::Handle_t< Type, Convertible >::handle, Cogs::Handle_t< TextureBindingTag >::InvalidHandle, and Cogs::Handle_t< TextureBindingTag >::NoHandle.

◆ setTexture() [2/2]

void Cogs::ContextGLES30::setTexture ( const TextureBindingHandle  textureBindingHandle,
TextureViewHandle  textureViewHandle 
)
finalvirtual

Implements Cogs::IContext.

Definition at line 771 of file ContextGLES30.cpp.

◆ setupDraw()

bool Cogs::ContextGLES30::setupDraw ( size_t  baseVertex)
private

Definition at line 383 of file ContextGLES30.cpp.

◆ setupIndexedDraw()

bool Cogs::ContextGLES30::setupIndexedDraw ( GLenum &  indexType,
GLsizei &  indexCount,
const GLvoid *&  indexOffset,
const size_t  startIndex,
const size_t  numIndices,
const size_t  baseVertex 
)
private

Definition at line 429 of file ContextGLES30.cpp.

◆ setupState()

bool Cogs::ContextGLES30::setupState ( )
private

Definition at line 317 of file ContextGLES30.cpp.

◆ setupVertexAttributes()

void Cogs::ContextGLES30::setupVertexAttributes ( size_t  baseVertex)
private

Definition at line 122 of file ContextGLES30.cpp.

◆ setVariable()

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

Sets the variable with the given name and size.

Reimplemented from Cogs::ContextCommon.

Definition at line 1564 of file ContextGLES30.cpp.

◆ setVector2Variable() [1/2]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1069 of file ContextGLES30.cpp.

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

◆ setVector2Variable() [2/2]

void Cogs::ContextGLES30::setVector2Variable ( const StringView name,
const float *  value 
)
overridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1013 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setVector3Variable() [1/2]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1078 of file ContextGLES30.cpp.

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

◆ setVector3Variable() [2/2]

void Cogs::ContextGLES30::setVector3Variable ( const StringView name,
const float *  value 
)
overridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1022 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setVector4Variable() [1/3]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1087 of file ContextGLES30.cpp.

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

◆ setVector4Variable() [2/3]

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

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1096 of file ContextGLES30.cpp.

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

◆ setVector4Variable() [3/3]

void Cogs::ContextGLES30::setVector4Variable ( const StringView name,
const float *  value 
)
overridevirtual

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

Reimplemented from Cogs::ContextCommon.

Definition at line 1031 of file ContextGLES30.cpp.

References Cogs::StringView::data(), and Cogs::StringView::length().

◆ setVertexArrayObject()

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

Logs an unsupported error, override to provide support.

Reimplemented from Cogs::ContextCommon.

Definition at line 575 of file ContextGLES30.cpp.

◆ setVertexBuffers() [1/2]

void Cogs::ContextGLES30::setVertexBuffers ( const VertexBufferHandle vertexBufferHandles,
const size_t  count,
const uint32_t *  strides,
const uint32_t *  offsets 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 563 of file ContextGLES30.cpp.

References Cogs::Handle_t< VertexArrayObjectTag >::NoHandle.

◆ setVertexBuffers() [2/2]

void Cogs::ContextGLES30::setVertexBuffers ( const VertexBufferHandle vertexBufferHandles,
const size_t  count 
)
overridevirtual

Overload provided to support transitioning.

Only supports vertex buffers created with legacy loadVertexBuffer API.

Implements Cogs::IContext.

Definition at line 551 of file ContextGLES30.cpp.

References Cogs::Handle_t< VertexArrayObjectTag >::NoHandle.

◆ setViewport()

void Cogs::ContextGLES30::setViewport ( const float  x,
const float  y,
const float  width,
const float  height 
)
overridevirtual

Sets the current viewport to the given location and dimensions.

Implements Cogs::IContext.

Definition at line 656 of file ContextGLES30.cpp.

◆ signal()

void Cogs::ContextGLES30::signal ( FenceHandle  fenceHandle)
overridevirtual

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

Parameters
fenceHandleThe fence to signal.

Reimplemented from Cogs::ContextCommon.

Definition at line 117 of file ContextGLES30.cpp.

◆ unbindBuffer()

void Cogs::ContextGLES30::unbindBuffer ( GLuint  buffer)
protected

Definition at line 228 of file ContextGLES30.cpp.

◆ unbindVAO()

void Cogs::ContextGLES30::unbindVAO ( )
protected

Definition at line 244 of file ContextGLES30.cpp.

◆ unmap() [1/2]

void Cogs::ContextGLES30::unmap ( BufferHandle  bufferHandle)
overridevirtual

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

Implements Cogs::IContext.

Definition at line 1345 of file ContextGLES30.cpp.

References Cogs::BufferGLES30::isMapped, Cogs::BufferGLES30::keepMapBacking, Cogs::BufferGLES30::mappedData, and Cogs::BufferGLES30::writeBackMap.

◆ unmap() [2/2]

void Cogs::ContextGLES30::unmap ( TextureHandle  textureHandle)
inlineoverridevirtual

Release a host mapping of a staging texture.

Parameters
textureHandleStaging texture that is currently mapped.

Implements Cogs::IContext.

Definition at line 130 of file ContextGLES30.h.

◆ updateBuffer()

void Cogs::ContextGLES30::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

Reimplemented from Cogs::ContextCommon.

Definition at line 1367 of file ContextGLES30.cpp.

References Cogs::BufferGLES30::size.

◆ updateSubBuffer()

void Cogs::ContextGLES30::updateSubBuffer ( BufferHandle  bufferHandle,
const size_t  offset,
const size_t  size,
const void *  data 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1489 of file ContextGLES30.cpp.

References Cogs::BufferGLES30::size, and Cogs::BufferGLES30::target.

◆ updateSubTexture()

void Cogs::ContextGLES30::updateSubTexture ( TextureHandle  textureHandle,
const size_t  level,
const void *  data 
)
overridevirtual

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.

Implements Cogs::IContext.

Definition at line 1387 of file ContextGLES30.cpp.

Friends And Related Function Documentation

◆ BuffersGLES30

friend struct BuffersGLES30
friend

Definition at line 34 of file ContextGLES30.h.

◆ TexturesGLES30

friend struct TexturesGLES30
friend

Definition at line 33 of file ContextGLES30.h.

Member Data Documentation

◆ activeTexUnit

GLuint Cogs::ContextGLES30::activeTexUnit = 0
private

Definition at line 203 of file ContextGLES30.h.

◆ baseVertex

uint32_t Cogs::ContextGLES30::baseVertex = 0

Definition at line 237 of file ContextGLES30.h.

◆ buffer

GLuint Cogs::ContextGLES30::buffer = 0

Definition at line 217 of file ContextGLES30.h.

◆ buffers

BuffersGLES30* Cogs::ContextGLES30::buffers = nullptr
private

Definition at line 194 of file ContextGLES30.h.

◆ capabilities

CapabilitiesGLES30* Cogs::ContextGLES30::capabilities = nullptr
private

Definition at line 198 of file ContextGLES30.h.

◆ constant

float Cogs::ContextGLES30::constant[4] = {}

Definition at line 272 of file ContextGLES30.h.

◆ count

uint32_t Cogs::ContextGLES30::count = 0

Definition at line 238 of file ContextGLES30.h.

◆ currentAttributeMask

uint32_t Cogs::ContextGLES30::currentAttributeMask = 0
private

Definition at line 266 of file ContextGLES30.h.

◆ currentDepthStencilState

DepthStencilState Cogs::ContextGLES30::currentDepthStencilState = DepthStencilState::DefaultState()
private

Definition at line 281 of file ContextGLES30.h.

◆ currentDepthStencilTarget

DepthStencilHandle Cogs::ContextGLES30::currentDepthStencilTarget = DepthStencilHandle::NoHandle
private

Definition at line 214 of file ContextGLES30.h.

◆ currentRasterizerState

RasterizerState Cogs::ContextGLES30::currentRasterizerState = RasterizerState::DefaultState()
private

Definition at line 268 of file ContextGLES30.h.

◆ currentRenderTarget

RenderTargetHandle Cogs::ContextGLES30::currentRenderTarget = RenderTargetHandle::NoHandle
private

Definition at line 213 of file ContextGLES30.h.

◆ currHandle [1/2]

InputLayoutHandle Cogs::ContextGLES30::currHandle = InputLayoutHandle::NoHandle

Definition at line 243 of file ContextGLES30.h.

◆ currHandle [2/2]

Definition at line 256 of file ContextGLES30.h.

◆ defaultSamplerStateHandle

SamplerStateHandle Cogs::ContextGLES30::defaultSamplerStateHandle = SamplerStateHandle::NoHandle
private

Definition at line 201 of file ContextGLES30.h.

◆ effects

EffectsGLES30* Cogs::ContextGLES30::effects = nullptr
private

Definition at line 196 of file ContextGLES30.h.

◆ emptyUniformBuffer

BufferHandle Cogs::ContextGLES30::emptyUniformBuffer = BufferHandle::NoHandle
private

Definition at line 223 of file ContextGLES30.h.

◆ handle [1/4]

VertexBufferHandle Cogs::ContextGLES30::handle = VertexBufferHandle::NoHandle

Definition at line 233 of file ContextGLES30.h.

◆ handle [2/4]

IndexBufferHandle Cogs::ContextGLES30::handle = IndexBufferHandle::NoHandle

Definition at line 247 of file ContextGLES30.h.

◆ handle [3/4]

EffectHandle Cogs::ContextGLES30::handle = EffectHandle::NoHandle

Definition at line 263 of file ContextGLES30.h.

◆ handle [4/4]

BlendStateHandle Cogs::ContextGLES30::handle = BlendStateHandle::NoHandle

Definition at line 271 of file ContextGLES30.h.

◆ indexCount

GLsizei Cogs::ContextGLES30::indexCount = 0

Definition at line 258 of file ContextGLES30.h.

◆ indexStride

GLsizei Cogs::ContextGLES30::indexStride = 0

Definition at line 259 of file ContextGLES30.h.

◆ indexType

GLenum Cogs::ContextGLES30::indexType = GL_INVALID_ENUM

Definition at line 257 of file ContextGLES30.h.

◆ inRenderPass

bool Cogs::ContextGLES30::inRenderPass = false
private

Definition at line 210 of file ContextGLES30.h.

◆ needVertexAttributeSetup

bool Cogs::ContextGLES30::needVertexAttributeSetup = true
private

Definition at line 283 of file ContextGLES30.h.

◆ offset [1/2]

GLuint Cogs::ContextGLES30::offset = 0

Definition at line 227 of file ContextGLES30.h.

◆ offset [2/2]

uint32_t Cogs::ContextGLES30::offset = 0

Definition at line 235 of file ContextGLES30.h.

◆ prevHandle [1/2]

InputLayoutHandle Cogs::ContextGLES30::prevHandle = InputLayoutHandle::NoHandle

Definition at line 242 of file ContextGLES30.h.

◆ prevHandle [2/2]

Definition at line 255 of file ContextGLES30.h.

◆ ptr

EffectGLES30* Cogs::ContextGLES30::ptr = nullptr

Definition at line 264 of file ContextGLES30.h.

◆ renderPassInfo

RenderPassInfo Cogs::ContextGLES30::renderPassInfo = {}
private

Definition at line 211 of file ContextGLES30.h.

◆ renderTargets

RenderTargetsGLES30* Cogs::ContextGLES30::renderTargets = nullptr
private

Definition at line 197 of file ContextGLES30.h.

◆ sampler

SamplerStateHandle Cogs::ContextGLES30::sampler = SamplerStateHandle::NoHandle

Definition at line 206 of file ContextGLES30.h.

◆ size

GLuint Cogs::ContextGLES30::size = 0

Definition at line 228 of file ContextGLES30.h.

◆ state

BlendStateGLES30 Cogs::ContextGLES30::state

Definition at line 273 of file ContextGLES30.h.

◆ stride

uint32_t Cogs::ContextGLES30::stride = 0

Definition at line 234 of file ContextGLES30.h.

◆ syncObjects

GLSyncObjects* Cogs::ContextGLES30::syncObjects = nullptr
private

Definition at line 199 of file ContextGLES30.h.

◆ target

GLenum Cogs::ContextGLES30::target = GL_TEXTURE_2D

Definition at line 207 of file ContextGLES30.h.

◆ texture

TextureHandle Cogs::ContextGLES30::texture = TextureHandle::NoHandle

Definition at line 205 of file ContextGLES30.h.

◆ textures

TexturesGLES30* Cogs::ContextGLES30::textures = nullptr
private

Definition at line 195 of file ContextGLES30.h.


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