Don't use GL_FRAMEBUFFER_SRGB in GLES

This commit is contained in:
Deve 2017-10-01 22:24:42 +02:00
parent d6d1fa40c0
commit 843ebad9a1
4 changed files with 20 additions and 1 deletions

View File

@ -61,7 +61,6 @@ extern "C" {
#if defined(USE_GLES2)
#define GL_BGRA 0x80E1
#define GL_BGR 0x80E0
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
// The glDrawElementsBaseVertex is available only in OpenGL ES 3.2. At this

View File

@ -1577,7 +1577,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
return in_fbo;
#if !defined(USE_GLES2)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
out_fbo = &rtts->getFBO(FBO_MLAA_COLORS);
out_fbo->bind();
renderPassThrough(in_fbo->getRTT()[0],
@ -1593,7 +1595,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
*out_fbo);
PROFILER_POP_CPU_MARKER();
}
#if !defined(USE_GLES2)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
return out_fbo;
} // render

View File

@ -147,12 +147,16 @@ void GL3RenderTarget::draw2DImage(const irr::core::rect<s32>& dest_rect,
assert(m_frame_buffer != NULL);
irr::core::rect<s32> source_rect(0, 0, m_frame_buffer->getWidth(),
m_frame_buffer->getHeight());
#if !defined(USE_GLES2)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
draw2DImageFromRTT(m_frame_buffer->getRTT()[0],
m_frame_buffer->getWidth(), m_frame_buffer->getHeight(),
dest_rect, source_rect,
clip_rect, colors, use_alpha_channel_of_texture);
#if !defined(USE_GLES2)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
} // draw2DImage

View File

@ -304,8 +304,10 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
else
{
// We need a cleared depth buffer for some effect (eg particles depth blending)
#if !defined(USE_GLES2)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
// Bind() modifies the viewport. In order not to affect anything else,
// the viewport is just reset here and not removed in Bind().
@ -315,8 +317,10 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
vp.LowerRightCorner.X - vp.UpperLeftCorner.X,
vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y);
glClear(GL_DEPTH_BUFFER_BIT);
#if !defined(USE_GLES2)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
PROFILER_POP_CPU_MARKER();
@ -490,7 +494,9 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
}
if (!CVS->isDefferedEnabled() && !forceRTT)
{
#if !defined(USE_GLES2)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
return;
@ -596,11 +602,15 @@ void ShaderBasedRenderer::renderPostProcessing(Camera * const camera)
}
else
{
#if !defined(USE_GLES2)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
glBindFramebuffer(GL_FRAMEBUFFER, 0);
camera->activate();
m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
#if !defined(USE_GLES2)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
}
} //renderPostProcessing
@ -800,8 +810,10 @@ void ShaderBasedRenderer::render(float dt)
rg->preRenderCallback(camera); // adjusts start referee
irr_driver->getSceneManager()->setActiveCamera(camnode);
#if !defined(USE_GLES2)
if (!CVS->isDefferedEnabled())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
PROFILER_PUSH_CPU_MARKER("UBO upload", 0x0, 0xFF, 0x0);
computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight());