Renderer: Implement renderpass attachments clear for OpenGL

This commit is contained in:
Jérôme Leclercq
2021-05-28 22:55:56 +02:00
parent 392a23eeb1
commit 299585a7de
14 changed files with 276 additions and 96 deletions

View File

@@ -134,6 +134,10 @@ namespace Nz::GL
bool ProcessErrorStack() const;
inline void ResetColorWriteMasks() const;
inline void ResetDepthWriteMasks() const;
inline void ResetStencilWriteMasks() const;
void SetCurrentTextureUnit(UInt32 textureUnit) const;
void SetScissorBox(GLint x, GLint y, GLsizei width, GLsizei height) const;
void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height) const;

View File

@@ -99,6 +99,35 @@ namespace Nz::GL
if (m_state.boundVertexArray == vao)
m_state.boundVertexArray = 0;
}
inline void Context::ResetColorWriteMasks() const
{
if (!m_state.renderStates.colorWrite)
{
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
m_state.renderStates.colorWrite = true;
}
}
inline void Context::ResetDepthWriteMasks() const
{
if (!m_state.renderStates.depthWrite)
{
glDepthMask(GL_TRUE);
m_state.renderStates.depthWrite = true;
}
}
inline void Context::ResetStencilWriteMasks() const
{
if (m_state.renderStates.stencilBack.writeMask != 0xFFFFFFFF || m_state.renderStates.stencilFront.writeMask != 0xFFFFFFFF)
{
glStencilMaskSeparate(GL_FRONT_AND_BACK, 0xFFFFFFFF);
m_state.renderStates.stencilBack.writeMask = 0xFFFFFFFF;
m_state.renderStates.stencilFront.writeMask = 0xFFFFFFFF;
}
}
}
#include <Nazara/OpenGLRenderer/DebugOff.hpp>

View File

@@ -129,6 +129,7 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
cb(glStencilFuncSeparate, PFNGLSTENCILFUNCSEPARATEPROC) \
cb(glStencilOp, PFNGLSTENCILOPPROC) \
cb(glStencilOpSeparate, PFNGLSTENCILOPSEPARATEPROC) \
cb(glStencilMaskSeparate, PFNGLSTENCILMASKSEPARATEPROC) \
cb(glTexImage2D, PFNGLTEXIMAGE2DPROC) \
cb(glTexImage3D, PFNGLTEXIMAGE3DPROC) \
cb(glTexParameterf, PFNGLTEXPARAMETERFPROC) \