Further clean up framebuffer
Avoid using hdr framebuffer in displace and glow Also remove stencil test in mlaa (in the pass no stencil buffer exists in FBO_MLAA* anyway)
This commit is contained in:
parent
ccc83a28f2
commit
9737c2f950
@ -1197,18 +1197,12 @@ void PostProcessing::applyMLAA(const FrameBuffer& mlaa_tmp_framebuffer,
|
||||
1.0f / UserConfigParams::m_height);
|
||||
|
||||
mlaa_tmp_framebuffer.bind();
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glStencilFunc(GL_ALWAYS, 1, ~0);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// Pass 1: color edge detection
|
||||
MLAAColorEdgeDetectionSHader::getInstance()->render(PIXEL_SIZE, mlaa_colors_framebuffer.getRTT()[0]);
|
||||
|
||||
glStencilFunc(GL_EQUAL, 1, ~0);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
||||
// Pass 2: blend weights
|
||||
mlaa_blend_framebuffer.bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
@ -1224,8 +1218,6 @@ void PostProcessing::applyMLAA(const FrameBuffer& mlaa_tmp_framebuffer,
|
||||
MLAAGatherSHader::getInstance()
|
||||
->render(PIXEL_SIZE, mlaa_blend_framebuffer.getRTT()[0], mlaa_tmp_framebuffer.getRTT()[0]);
|
||||
|
||||
// Done.
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
} // applyMLAA
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -128,7 +128,6 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
m_render_target_textures[RTT_HALF1] = generateRTT(half, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_HALF1_R] = generateRTT(half, red_internal_format, red_format, type);
|
||||
m_render_target_textures[RTT_HALF2] = generateRTT(half, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
|
||||
if (UserConfigParams::m_mlaa)
|
||||
{
|
||||
@ -187,7 +186,7 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_SP_DIFF_COLOR]);
|
||||
m_frame_buffers[FBO_RGBA_1] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
m_frame_buffers[FBO_RGBA_1] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_RGBA_2]);
|
||||
@ -214,10 +213,6 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF2]);
|
||||
m_frame_buffers[FBO_HALF2] = new FrameBuffer(somevector, half.Width, half.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_DISPLACE]);
|
||||
m_frame_buffers[FBO_DISPLACE] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
if (m_render_target_textures[RTT_RGBA_3] != 0)
|
||||
{
|
||||
somevector.clear();
|
||||
|
@ -36,7 +36,6 @@ enum TypeFBO
|
||||
FBO_HALF1_R,
|
||||
FBO_HALF1,
|
||||
FBO_HALF2,
|
||||
FBO_DISPLACE,
|
||||
|
||||
FBO_RGBA_3, // MLAA
|
||||
|
||||
@ -75,7 +74,6 @@ enum TypeRTT : unsigned int
|
||||
RTT_HALF1,
|
||||
RTT_HALF1_R,
|
||||
RTT_HALF2,
|
||||
RTT_DISPLACE,
|
||||
|
||||
RTT_RGBA_3,
|
||||
|
||||
|
@ -148,7 +148,7 @@ void ShaderBasedRenderer::renderSSAO() const
|
||||
void ShaderBasedRenderer::renderGlow() const
|
||||
{
|
||||
irr_driver->getSceneManager()->setCurrentRendertime(scene::ESNRP_SOLID);
|
||||
m_rtts->getFBO(FBO_TMP1_WITH_DS).bind();
|
||||
m_rtts->getFBO(FBO_RGBA_1).bind();
|
||||
glClearStencil(0);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
@ -367,7 +367,7 @@ void ShaderBasedRenderer::renderSceneDeferred(scene::ICameraSceneNode * const ca
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_GLOW));
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
renderGlow();
|
||||
m_post_processing->renderGlow(m_rtts->getFBO(FBO_TMP1_WITH_DS),
|
||||
m_post_processing->renderGlow(m_rtts->getFBO(FBO_RGBA_1),
|
||||
m_rtts->getFBO(FBO_HALF1),
|
||||
m_rtts->getFBO(FBO_QUARTER1),
|
||||
m_rtts->getFBO(FBO_COLORS));
|
||||
|
@ -178,7 +178,7 @@ void displaceShaderInit(SPShader* shader)
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_TMP1_WITH_DS).bind(),
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_RGBA_1).bind(),
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}, RP_1ST);
|
||||
shader->addShaderFile("sp_pass.vert", GL_VERTEX_SHADER, RP_RESERVED);
|
||||
@ -196,7 +196,7 @@ void displaceShaderInit(SPShader* shader)
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_DISPLACE).bind(),
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_TMP1_WITH_DS).bind(),
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}, RP_RESERVED);
|
||||
SPShaderManager::addPrefilledTexturesToShader(shader,
|
||||
@ -205,7 +205,7 @@ void displaceShaderInit(SPShader* shader)
|
||||
shader->addCustomPrefilledTextures(ST_BILINEAR,
|
||||
GL_TEXTURE_2D, "mask_tex", []()->GLuint
|
||||
{
|
||||
return g_stk_sbr->getRTTs()->getFBO(FBO_TMP1_WITH_DS).getRTT()[0];
|
||||
return g_stk_sbr->getRTTs()->getFBO(FBO_RGBA_1).getRTT()[0];
|
||||
}, RP_RESERVED);
|
||||
shader->addCustomPrefilledTextures(ST_BILINEAR,
|
||||
GL_TEXTURE_2D, "color_tex", []()->GLuint
|
||||
@ -218,7 +218,7 @@ void displaceShaderInit(SPShader* shader)
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_COLORS).bind();
|
||||
glStencilFunc(GL_EQUAL, 1, 0xFF);
|
||||
g_stk_sbr->getPostProcessing()->renderPassThrough
|
||||
(g_stk_sbr->getRTTs()->getFBO(FBO_DISPLACE).getRTT()[0],
|
||||
(g_stk_sbr->getRTTs()->getFBO(FBO_TMP1_WITH_DS).getRTT()[0],
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_COLORS).getWidth(),
|
||||
g_stk_sbr->getRTTs()->getFBO(FBO_COLORS).getHeight());
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
Loading…
Reference in New Issue
Block a user