Don't use GL_FRAMEBUFFER_SRGB in GLES
This commit is contained in:
parent
d6d1fa40c0
commit
843ebad9a1
@ -61,7 +61,6 @@ extern "C" {
|
|||||||
#if defined(USE_GLES2)
|
#if defined(USE_GLES2)
|
||||||
#define GL_BGRA 0x80E1
|
#define GL_BGRA 0x80E1
|
||||||
#define GL_BGR 0x80E0
|
#define GL_BGR 0x80E0
|
||||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
|
||||||
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
||||||
|
|
||||||
// The glDrawElementsBaseVertex is available only in OpenGL ES 3.2. At this
|
// The glDrawElementsBaseVertex is available only in OpenGL ES 3.2. At this
|
||||||
|
@ -1577,7 +1577,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
|||||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
||||||
return in_fbo;
|
return in_fbo;
|
||||||
|
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
out_fbo = &rtts->getFBO(FBO_MLAA_COLORS);
|
out_fbo = &rtts->getFBO(FBO_MLAA_COLORS);
|
||||||
out_fbo->bind();
|
out_fbo->bind();
|
||||||
renderPassThrough(in_fbo->getRTT()[0],
|
renderPassThrough(in_fbo->getRTT()[0],
|
||||||
@ -1593,7 +1595,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
|||||||
*out_fbo);
|
*out_fbo);
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
}
|
}
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
|
|
||||||
return out_fbo;
|
return out_fbo;
|
||||||
} // render
|
} // render
|
||||||
|
@ -147,12 +147,16 @@ void GL3RenderTarget::draw2DImage(const irr::core::rect<s32>& dest_rect,
|
|||||||
assert(m_frame_buffer != NULL);
|
assert(m_frame_buffer != NULL);
|
||||||
irr::core::rect<s32> source_rect(0, 0, m_frame_buffer->getWidth(),
|
irr::core::rect<s32> source_rect(0, 0, m_frame_buffer->getWidth(),
|
||||||
m_frame_buffer->getHeight());
|
m_frame_buffer->getHeight());
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
draw2DImageFromRTT(m_frame_buffer->getRTT()[0],
|
draw2DImageFromRTT(m_frame_buffer->getRTT()[0],
|
||||||
m_frame_buffer->getWidth(), m_frame_buffer->getHeight(),
|
m_frame_buffer->getWidth(), m_frame_buffer->getHeight(),
|
||||||
dest_rect, source_rect,
|
dest_rect, source_rect,
|
||||||
clip_rect, colors, use_alpha_channel_of_texture);
|
clip_rect, colors, use_alpha_channel_of_texture);
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
|
|
||||||
} // draw2DImage
|
} // draw2DImage
|
||||||
|
|
||||||
|
@ -304,8 +304,10 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We need a cleared depth buffer for some effect (eg particles depth blending)
|
// 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))
|
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
|
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
|
||||||
// Bind() modifies the viewport. In order not to affect anything else,
|
// Bind() modifies the viewport. In order not to affect anything else,
|
||||||
// the viewport is just reset here and not removed in Bind().
|
// 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.X - vp.UpperLeftCorner.X,
|
||||||
vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y);
|
vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
@ -490,7 +494,9 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
|
|||||||
}
|
}
|
||||||
if (!CVS->isDefferedEnabled() && !forceRTT)
|
if (!CVS->isDefferedEnabled() && !forceRTT)
|
||||||
{
|
{
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
return;
|
return;
|
||||||
@ -596,11 +602,15 @@ void ShaderBasedRenderer::renderPostProcessing(Camera * const camera)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
camera->activate();
|
camera->activate();
|
||||||
m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
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);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} //renderPostProcessing
|
} //renderPostProcessing
|
||||||
|
|
||||||
@ -800,8 +810,10 @@ void ShaderBasedRenderer::render(float dt)
|
|||||||
rg->preRenderCallback(camera); // adjusts start referee
|
rg->preRenderCallback(camera); // adjusts start referee
|
||||||
irr_driver->getSceneManager()->setActiveCamera(camnode);
|
irr_driver->getSceneManager()->setActiveCamera(camnode);
|
||||||
|
|
||||||
|
#if !defined(USE_GLES2)
|
||||||
if (!CVS->isDefferedEnabled())
|
if (!CVS->isDefferedEnabled())
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("UBO upload", 0x0, 0xFF, 0x0);
|
PROFILER_PUSH_CPU_MARKER("UBO upload", 0x0, 0xFF, 0x0);
|
||||||
computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight());
|
computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight());
|
||||||
|
Loading…
Reference in New Issue
Block a user