From 92ad161ed948637c235e198510136f0dace2ca3e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 20 Nov 2021 23:43:33 +0200 Subject: [PATCH] Do discard-clears in individual postprocessors, not the sequence It should be done just before rendering into the target starts. --- source/effects/ambientocclusion.cpp | 2 ++ source/effects/bloom.cpp | 2 ++ source/effects/colorcurve.cpp | 1 + source/render/sequence.cpp | 1 - 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index 96fc7317..350c6423 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -110,9 +110,11 @@ void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const renderer.set_shader_program(&occlude_shader, &shdata); renderer.set_framebuffer(&occlude_target.get_framebuffer()); + renderer.clear(0); quad.draw(renderer); renderer.set_framebuffer(out_fbo); + renderer.clear(0); renderer.set_shader_program(&combine_shader); quad.draw(renderer); } diff --git a/source/effects/bloom.cpp b/source/effects/bloom.cpp index 8a8dea3e..7795e191 100644 --- a/source/effects/bloom.cpp +++ b/source/effects/bloom.cpp @@ -68,11 +68,13 @@ void Bloom::render(Renderer &renderer, const Texture2D &src, const Texture2D &) { Renderer::Push push2(renderer); renderer.set_framebuffer(&target[i]->get_framebuffer()); + renderer.clear(0); renderer.set_texture("source", (i ? &target[0]->get_target_texture(COLOR_ATTACHMENT) : &src), &nearest_sampler); renderer.add_shader_data(blur_shdata[i]); quad.draw(renderer); } + renderer.clear(0); renderer.set_texture("source", &src, &nearest_sampler); renderer.set_texture("blurred", &target[1]->get_target_texture(COLOR_ATTACHMENT), &linear_sampler); renderer.set_shader_program(&combine_shader); diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index 30cb2bc7..ba76a964 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -69,6 +69,7 @@ void ColorCurve::set_linear() void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Texture2D &) { Renderer::Push push(renderer); + renderer.clear(0); renderer.set_shader_program(&shprog, &shdata); renderer.set_texture("source", &color_buf, &nearest_sampler); renderer.set_texture("curve", &curve, &linear_sampler); diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index b11d4b1c..74b8bc3b 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -154,7 +154,6 @@ void Sequence::render(Renderer &renderer, Tag tag) const { unsigned j = i%2; renderer.set_framebuffer(i+1get_framebuffer() : out_fbo); - renderer.clear(0); const Texture2D &color = target[j]->get_target_texture(COLOR_ATTACHMENT); const Texture2D &depth = target[j]->get_target_texture(DEPTH_ATTACHMENT); postproc[i]->render(renderer, color, depth); -- 2.45.2