[GL] Fix sRGB framebuffer write (#3032)
This commit is contained in:
parent
10ec8e8882
commit
cd3a1ea7f8
@ -3821,18 +3821,6 @@ namespace bgfx { namespace gl
|
||||
m_needPresent |= true;
|
||||
|
||||
m_currentFbo = m_msaaBackBufferFbo;
|
||||
|
||||
if (m_srgbWriteControlSupport)
|
||||
{
|
||||
if (0 != (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) )
|
||||
{
|
||||
GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3853,6 +3841,26 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
if (m_srgbWriteControlSupport)
|
||||
{
|
||||
if (0 == m_currentFbo)
|
||||
{
|
||||
if (0 != (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) )
|
||||
{
|
||||
GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// actual sRGB write/blending determined by FBO's color attachments format
|
||||
GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
}
|
||||
|
||||
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_currentFbo) );
|
||||
|
||||
m_fbh = _fbh;
|
||||
@ -8579,6 +8587,12 @@ namespace bgfx { namespace gl
|
||||
|
||||
profiler.end();
|
||||
}
|
||||
|
||||
if (m_srgbWriteControlSupport)
|
||||
{
|
||||
// switch state back to default for cases when the on-screen draw is done externally
|
||||
GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB) );
|
||||
}
|
||||
}
|
||||
|
||||
BGFX_GL_PROFILER_END();
|
||||
|
Loading…
Reference in New Issue
Block a user