3#include "../IContext.h"
6#include "OpenGLState.h"
7#include "../Base/ContextCommon.h"
8#include "../BaseGL/SyncObjects.h"
12 struct CapabilitiesGL20;
17 struct RenderTargetsGL20;
21 int effectAtomicCounterVariableIndex;
27 BufferGL20 * currentVertexBuffers[kMaxVertexInputSlots];
29 uint32_t indexBufferStride = 4;
43 void releaseResources();
63 void setViewport(
const float x,
const float y,
const float width,
const float height)
override;
64 void setScissor(
const int x,
const int y,
const int width,
const int height)
override;
69 void clearDepth(
const float depth = 1.0f)
override;
104 void dispatchCompute(
const unsigned int threadGroupsX,
const unsigned int threadGroupsY,
const unsigned int threadGroupsZ)
override;
121 void copySubResource(
BufferHandle destinationHandle,
size_t destinationOffset,
BufferHandle sourceHandle,
size_t sourceOffset,
size_t size);
123 void copyTexture(
TextureHandle dstHandle,
unsigned dstSub,
unsigned dstX,
unsigned dstY,
unsigned dstZ,
TextureHandle sourceHandle,
unsigned srcSub)
override;
125 void clearResource(
BufferHandle destinationHandle, uint32_t *Values)
override;
126 void clearResource(
BufferHandle destinationHandle,
float *Values)
override;
135 void reset()
override;
136 void setupVertexAttributes();
137 void clearInputState();
146 std::vector<AtomicCounterMapGL20> atomicCounterMappings;
149 GLuint currentProgramId = 0;
150 unsigned char * currentAttributeMap =
nullptr;
152 bool inRenderPass =
false;
155 RenderTargetHandle currentRenderTarget;
156 DepthStencilStateHandle currentDepthStencilState;
158 std::vector<GLint> enabledAttributes;
160 TextureHandle boundTextures[192];
161 SamplerStateHandle boundSamplerStates[192];
162 GLuint boundTarget[192];
164 GLuint maxImageUnits = 8;
170 bool needVertexAttributeSetup =
true;
171 bool enableMappingWorkaround =
true;
172 bool unorderedMemoryAcccess =
false;
Provides a weakly referenced view over the contents of a string.
Contains all Cogs related functionality.
void pushCommandGroupAnnotation(const StringView &name) override
Begin to tag a sequence of commands as a group in graphics debugger.
void setBufferCounter(BufferHandle bufferHandle, uint32_t value) override
Set the associated counter of a buffer.
void setIndexBuffer(IndexBufferHandle indexBufferHandle, uint32_t stride, uint32_t offset) override
Sets the current index buffer.
void clearRenderTarget(const float *color) override
Clear the currently set render target to the given value (4 component floating point RGBA).
void * map(TextureHandle, MapMode::EMapMode, uint32_t *, uint32_t *) override
Create host mapping of a staging texture.
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 getBufferCounter(BufferHandle bufferHandle, BufferHandle destinationBufferHandle) override
Get the associated counter of a buffer.
void unmap(BufferHandle bufferHandle) override
Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memo...
void clearDepth(const float depth=1.0f) override
Clear the currently set depth/stencil target to the given depth.
void unmap(TextureHandle) override
Release a host mapping of a staging texture.
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 setBlendState(const BlendStateHandle handle, const float *constant) override
Set the current blend state.
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 updateSubTexture(TextureHandle textureHandle, const size_t level, const void *data) override
Update the data of a level in the given texture.
void dispatchCompute(const unsigned int threadGroupsX, const unsigned int threadGroupsY, const unsigned int threadGroupsZ) override
Dispatch computing work on the graphics device using the desired thread group count.
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 reset() override
Resets all state changes made to the GPU since the last call to beginFrame.
void setBuffer(const BufferBindingHandle bufferBindingHandle, BufferHandle bufferHandle) override
Sets a buffer to bind to the given binding.
void draw(PrimitiveType::EPrimitiveType primitiveType, const size_t startVertex, const size_t numPrimitives) override
Draws non-indexed, non-instanced primitives.
void signal(FenceHandle fenceHandle) override
Insert a fence in the command stream that will signal when all commands before the fence are complete...
void setRasterizerState(const RasterizerStateHandle handle) override
Set the current rasterizer state.
void endRenderPass() override
End a render pass.
void setConstantBuffer(const ConstantBufferBindingHandle bufferBinding, const BufferHandle bufferHandle, const uint32_t offset, const uint32_t size) override
Sets a constant buffer to the given constant buffer binding.
void setAnnotationMarker(const StringView &name) override
Add a tag in the sequence of commands in graphics debugger.
void setVertexBuffers(const VertexBufferHandle *vertexBufferHandles, const size_t count, const uint32_t *strides, const uint32_t *offsets) override
Sets the current vertex buffers.
void setDepthStencilState(const DepthStencilStateHandle handle) override
Set the current depth stencil state.
void popCommandGroupAnnotation() override
End to tag a sequence of commands as a group in graphics debugger.
void setSamplerState(const SamplerStateBindingHandle samplerStateBindingHandle, const SamplerStateHandle samplerStateHandle) override
Sets the sampler state binding given to the given sampler state.
void setTexture(const TextureBindingHandle textureBindingHandle, const TextureHandle textureHandle) override
Sets the texture given to the binding given by textureBindingHandle.
void * map(BufferHandle bufferHandle, MapMode::EMapMode mapMode, uint32_t *stride) override
Maps the given buffer so it can be accessed.
void setInputLayout(const InputLayoutHandle inputLayoutHandle) override
Sets the current input layout.
void setRenderTarget(const RenderTargetHandle handle, const DepthStencilHandle depthStencilHandle) override
Sets the current render target and an associated depth stencil target.
void beginRenderPass(const RenderPassInfo &info) override
Begin a render pass.
void setEffect(EffectHandle effectHandle) override
Set the current effect.
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 setScissor(const int x, const int y, const int width, const int height) override
Sets the current scissor rectangle.
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 resolveResource(TextureHandle source, TextureHandle destination) override
Resolves the given source resource target into the given destination texture.
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.
Provides effects and shader management functionality.
EMapMode
Mapping mode enumeration.
EPrimitiveType
Primitive type enumeration.