X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.cpp;h=e468825748a640ed53cab215c6fc0ebee8c14fb3;hb=14e5bc2c02ef8cc468d5727065ad732bb422a89c;hp=e3da053070b0cb0dcadc84e62f6b91cf4befab5a;hpb=e1f9db7e8550d5c9629ac5ad0e2f8dc2dd4efa8d;p=libs%2Fgl.git diff --git a/source/pipeline.cpp b/source/pipeline.cpp index e3da0530..e4688257 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -176,8 +176,10 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const setup_frame(); const Framebuffer *out_fbo = Framebuffer::current(); - // This is a no-op but will ensure the FBO binding gets restored + // These is a no-ops but will ensure the related state gets restored BindRestore restore_fbo(out_fbo); + BindRestore restore_depth_test(DepthTest::current()); + BindRestore restore_blend(Blend::current()); if(target[0]) { @@ -186,10 +188,19 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const fbo.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT); } + for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i) { - Bind bind_depth_test(i->get_depth_test()); - Bind bind_blend(i->get_blend()); + if(const DepthTest *dt = i->get_depth_test()) + dt->bind(); + else + DepthTest::unbind(); + + if(const Blend *b = i->get_blend()) + b->bind(); + else + Blend::unbind(); + renderer.set_lighting(i->get_lighting()); renderer.set_clipping(i->get_clipping()); @@ -201,10 +212,11 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const renderer.render(*j->renderable, i->get_tag()); } - renderer.end(); - if(target[0]) { + DepthTest::unbind(); + Blend::unbind(); + if(samples) target[0]->fbo.blit_from(target_ms->fbo, COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT, false); @@ -215,7 +227,7 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const target[1-j]->fbo.bind(); else out_fbo->bind(); - postproc[i]->render(target[j]->color, target[j]->depth); + postproc[i]->render(renderer, target[j]->color, target[j]->depth); } }