From: Mikko Rasa Date: Mon, 11 Oct 2021 12:25:52 +0000 (+0300) Subject: Allow suppressing clear in a sequence by passing in a special tag X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=867c4e8c34fe24146f4f8cf6bd0b27a6d99aa1a2;p=libs%2Fgl.git Allow suppressing clear in a sequence by passing in a special tag Sequence doesn't pass on the tag it receives, so it can be used to control the sequence's own behaviour instead. --- diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index e0fb408f..f7dea9bf 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -12,6 +12,8 @@ using namespace std; namespace Msp { namespace GL { +Tag Sequence::noclear_tag = "noclear"; + Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f): width(w), height(h), @@ -105,7 +107,7 @@ void Sequence::finish_frame() void Sequence::render(Renderer &renderer, Tag tag) const { - if(tag.id) + if(tag.id && tag!=noclear_tag) return; Renderer::Push _push(renderer); @@ -115,7 +117,7 @@ void Sequence::render(Renderer &renderer, Tag tag) const if(target[0]) renderer.set_framebuffer(&(target_ms ? target_ms : target[0])->get_framebuffer()); - if(clear_enabled) + if(clear_enabled && tag!=noclear_tag) { const Framebuffer *target_fbo = renderer.get_framebuffer(); if(!target_fbo) diff --git a/source/render/sequence.h b/source/render/sequence.h index 9a3d0207..efead27f 100644 --- a/source/render/sequence.h +++ b/source/render/sequence.h @@ -79,6 +79,8 @@ private: float clear_depth = 1.0f; int clear_stencil = 0; + static Tag noclear_tag; + public: Sequence() = default; Sequence(unsigned, unsigned, const FrameFormat &);