From e1f9db7e8550d5c9629ac5ad0e2f8dc2dd4efa8d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 27 Aug 2016 02:29:41 +0300 Subject: [PATCH] Use RAII to restore the output FBO in Pipeline::render --- source/pipeline.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/pipeline.cpp b/source/pipeline.cpp index a27058ef..e3da0530 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -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) -- 2.43.0