33#ifndef DVD_GL_STATE_TRACKER_H_
34#define DVD_GL_STATE_TRACKER_H_
46 class glShaderProgram;
78 [[nodiscard]]
BindResult setActiveBuffer( gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint& previousID);
81 [[nodiscard]]
BindResult setActiveBufferIndex( gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint bindIndex, gl46core::GLuint& previousID);
83 [[nodiscard]]
BindResult setActiveBufferIndexRange( gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint bindIndex,
size_t offsetInBytes,
size_t rangeInBytes );
84 [[nodiscard]]
BindResult setActiveBufferIndexRange( gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint bindIndex,
size_t offsetInBytes,
size_t rangeInBytes, gl46core::GLuint& previousID);
100 [[nodiscard]]
BindResult bindTexture( gl46core::GLubyte unit, gl46core::GLuint handle, gl46core::GLuint samplerHandle = 0u);
101 [[nodiscard]]
BindResult bindTextureImage( gl46core::GLubyte unit, gl46core::GLuint handle, gl46core::GLint level,
bool layered, gl46core::GLint layer, gl46core::GLenum access, gl46core::GLenum format);
103 [[nodiscard]]
BindResult bindTextures( gl46core::GLubyte unitOffset, gl46core::GLuint textureCount,
const gl46core::GLuint* textureHandles,
const gl46core::GLuint* samplerHandles);
107 [[nodiscard]]
BindResult bindSamplers( gl46core::GLubyte unitOffset, gl46core::GLuint samplerCount,
const gl46core::GLuint* samplerHandles);
109 [[nodiscard]]
BindResult bindActiveBuffer( gl46core::GLuint location, gl46core::GLuint bufferID,
size_t offset,
size_t stride);
110 [[nodiscard]]
BindResult bindActiveBuffers( gl46core::GLuint location, gl46core::GLsizei count, gl46core::GLuint* bufferIDs, gl46core::GLintptr* offset, gl46core::GLsizei* strides);
133 [[nodiscard]] gl46core::GLuint
getBoundBuffer( gl46core::GLenum target, gl46core::GLuint bindIndex) const noexcept;
134 [[nodiscard]] gl46core::GLuint
getBoundBuffer( gl46core::GLenum target, gl46core::GLuint bindIndex,
size_t& offsetOut,
size_t& rangeOut) const noexcept;
OpenGL implementation of the ShaderProgram entity.
constexpr U8 MAX_DEBUG_SCOPE_DEPTH
Maximum number of nested debug scopes we support in the renderer.
FColour4 ToFloatColour(const UColour4 &byteColour) noexcept
Handle console commands that start with a forward slash.
constexpr gl46core::GLuint GL_NULL_HANDLE
Invalid object value. Used to compare handles and determine if they were properly created.
eastl::vector< Type > vector
constexpr RenderTargetID INVALID_RENDER_TARGET_ID
constexpr auto to_base(const Type value) -> Type
gl46core::GLuint getBoundBuffer(gl46core::GLenum target, gl46core::GLuint bindIndex) const noexcept
std::array< BindConfig, 14 > PerBufferConfig
RenderTargetID _activeRenderTargetID
size_t _drawIndirectBufferOffset
gl46core::GLuint getBoundProgramHandle() const noexcept
void setVertexFormat(const AttributeMap &attributes, const size_t attributeHash)
BindResult setActiveBufferIndex(gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint bindIndex)
BlendingSettings _blendPropertiesGlobal
std::array< gl46core::GLuint, MAX_BOUND_TEXTURE_UNITS > SamplerBoundMapDef
eastl::queue< std::pair< gl46core::GLsync, U64 > > _endFrameFences
static constexpr U8 MAX_BOUND_TEXTURE_UNITS
bool setAlphaToCoverage(bool state)
FColour4 _activeClearColour
BindResult setActiveBuffer(gl46core::GLenum target, gl46core::GLuint bufferHandle)
Single place to change buffer objects for every target available.
vector< gl46core::GLboolean > _blendEnabled
RenderStateBlock _activeState
BindResult bindTextureImage(gl46core::GLubyte unit, gl46core::GLuint handle, gl46core::GLint level, bool layered, gl46core::GLint layer, gl46core::GLenum access, gl46core::GLenum format)
void setBlendColour(const UColour4 &blendColour)
bool setViewport(const Rect< I32 > &viewport)
Change the current viewport area. Redundancy check is performed in GFXDevice class.
Rect< I32 > _activeViewport
Pipeline const * _activePipeline
bool setClearColour(const UColour4 &colour)
PerBufferConfig _currentBindConfig
Rect< I32 > _activeScissor
void setBlending(const BlendingSettings &blendingProperties)
BindResult setStateBlock(const RenderStateBlock &stateBlock)
bool unbindTexture(TextureType type, gl46core::GLuint handle)
Returns true if the texture was bound. If the texture was not bound, no state is changed.
void resetBlending(const gl46core::GLuint drawBufferIdx)
BindResult bindActiveBuffer(gl46core::GLuint location, gl46core::GLuint bufferID, size_t offset, size_t stride)
Modify buffer bindings for the active vao.
gl46core::GLuint _activeShaderPipelineHandle
gl46core::GLuint _activeFBID[3]
0 - current framebuffer, 1 - current read only framebuffer, 2 - current write only framebuffer
BindResult setActiveBufferIndexRange(gl46core::GLenum target, gl46core::GLuint bufferHandle, gl46core::GLuint bindIndex, size_t offsetInBytes, size_t rangeInBytes)
Same as normal setActiveBuffer but handles proper binding of different ranges.
PixelAlignment _unpackAlignment
gl46core::GLboolean _blendEnabledGlobal
std::array< AttributeDescriptor, to_base(AttribLocation::COUNT)> AttributeSettings
vector< ImageBindSettings > ImageBoundMapDef
bool setScissor(const I32 x, const I32 y, const I32 width, const I32 height)
bool activateStateBlock(const RenderStateBlock &newBlock)
glShaderProgram * _activeShaderProgram
bool setPixelPackAlignment(const PixelAlignment &pixelPackAlignment)
Pixel pack alignment is usually changed by textures, PBOs, etc.
TextureBoundMapDef _textureBoundMap
gl46core::GLuint _activeVAOIB
BindResult bindActiveBuffers(gl46core::GLuint location, gl46core::GLsizei count, gl46core::GLuint *bufferIDs, gl46core::GLintptr *offset, gl46core::GLsizei *strides)
PrimitiveTopology _activeTopology
std::array< gl46core::GLuint, MAX_BOUND_TEXTURE_UNITS > TextureBoundMapDef
const RenderStateBlock & getActiveState() const
bool setScissor(const Rect< I32 > &newScissorRect)
void getActiveViewport(Rect< I32 > &viewportOut) const noexcept
void setPrimitiveTopology(PrimitiveTopology topology)
vec2< U16 > _activeRenderTargetDimensions
BindResult bindSamplers(gl46core::GLubyte unitOffset, gl46core::GLuint samplerCount, const gl46core::GLuint *samplerHandles)
gl46core::GLuint _activeShaderProgramHandle
VAOBindings _vaoBufferData
ImageBoundMapDef _imageBoundMap
bool setPixelUnpackAlignment(const PixelAlignment &pixelUnpackAlignment)
Pixel unpack alignment is usually changed by textures, PBOs, etc.
bool _alphaToCoverageEnabled
AttributeSettings _currentAttributes
gl46core::GLuint getBoundTextureHandle(U8 slot) const noexcept
bool * _enabledAPIDebugging
BindResult bindTexture(gl46core::GLubyte unit, gl46core::GLuint handle, gl46core::GLuint samplerHandle=0u)
Bind a texture specified by a GL handle and GL type to the specified unit using the sampler object de...
SamplerBoundMapDef _samplerBoundMap
BindResult setActiveShaderPipeline(gl46core::GLuint pipelineHandle)
Change the currently active shader pipeline. Returns false if the pipeline was already bound.
bool setDepthWrite(bool state)
DebugScope _debugScope[Config::MAX_DEBUG_SCOPE_DEPTH]
std::array< BindConfigEntry, 32 > BindConfig
std::array< gl46core::GLuint, 13 > _activeBufferID
VB, IB, SB, TB, UB, PUB, DIB.
vector< BlendingSettings > _blendProperties
PixelAlignment _packAlignment
BindResult bindTextures(gl46core::GLubyte unitOffset, gl46core::GLuint textureCount, const gl46core::GLuint *textureHandles, const gl46core::GLuint *samplerHandles)
Bind multiple textures specified by an array of handles and an offset unit.
BindResult setActiveProgram(gl46core::GLuint programHandle)
Change the currently active shader program. Returns false if the program was already bound.
bool setClearColour(const FColour4 &colour)
BindResult setActiveFB(RenderTarget::Usage usage, gl46core::GLuint ID)
glFramebuffer * _activeRenderTarget
bool setViewport(const I32 x, const I32 y, const I32 width, const I32 height)
U64 _lastSyncedFrameNumber
bool setClearDepth(F32 value)
gl46core::GLuint getBoundSamplerHandle(U8 slot) const noexcept
DebugScope _lastInsertedDebugMessage