Disable scissor for clearing the framebuffer

This commit is contained in:
Jupeyy 2023-09-10 09:44:32 +02:00
parent 96d7a9d0d9
commit ca2926335b
2 changed files with 20 additions and 0 deletions

View file

@ -966,8 +966,18 @@ void CCommandProcessorFragment_OpenGL::Cmd_TextTextures_Create(const CCommandBuf
void CCommandProcessorFragment_OpenGL::Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand)
{
// if clip is still active, force disable it for clearing, enable it again afterwards
bool ClipWasEnabled = m_LastClipEnable;
if(ClipWasEnabled)
{
glDisable(GL_SCISSOR_TEST);
}
glClearColor(pCommand->m_Color.r, pCommand->m_Color.g, pCommand->m_Color.b, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(ClipWasEnabled)
{
glEnable(GL_SCISSOR_TEST);
}
}
void CCommandProcessorFragment_OpenGL::Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand)

View file

@ -756,12 +756,22 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_TextTextures_Create(const CCommand
void CCommandProcessorFragment_OpenGL3_3::Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand)
{
// if clip is still active, force disable it for clearing, enable it again afterwards
bool ClipWasEnabled = m_LastClipEnable;
if(ClipWasEnabled)
{
glDisable(GL_SCISSOR_TEST);
}
if(pCommand->m_Color.r != m_ClearColor.r || pCommand->m_Color.g != m_ClearColor.g || pCommand->m_Color.b != m_ClearColor.b)
{
glClearColor(pCommand->m_Color.r, pCommand->m_Color.g, pCommand->m_Color.b, 0.0f);
m_ClearColor = pCommand->m_Color;
}
glClear(GL_COLOR_BUFFER_BIT);
if(ClipWasEnabled)
{
glEnable(GL_SCISSOR_TEST);
}
}
void CCommandProcessorFragment_OpenGL3_3::UploadStreamBufferData(unsigned int PrimitiveType, const void *pVertices, size_t VertSize, unsigned int PrimitiveCount, bool AsTex3D)