]> git.tdb.fi Git - libs/gl.git/commitdiff
Use RAII to restore the output FBO in Pipeline::render
authorMikko Rasa <tdb@tdb.fi>
Fri, 26 Aug 2016 23:29:41 +0000 (02:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 26 Aug 2016 23:29:41 +0000 (02:29 +0300)
source/pipeline.cpp

index a27058effc08020ed7395645c268249a233b4f9f..e3da053070b0cb0dcadc84e62f6b91cf4befab5a 100644 (file)
@@ -176,7 +176,8 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                setup_frame();
 
        const Framebuffer *out_fbo = Framebuffer::current();
-       // XXX Make sure the correct FBO is restored if an exception is thrown
+       // This is a no-op but will ensure the FBO binding gets restored
+       BindRestore restore_fbo(out_fbo);
 
        if(target[0])
        {
@@ -216,8 +217,6 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                                out_fbo->bind();
                        postproc[i]->render(target[j]->color, target[j]->depth);
                }
-
-               out_fbo->bind();
        }
 
        if(!was_in_frame)