]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.cpp
Copy ProgramData::uniform_slots in copy constructor and operator=
[libs/gl.git] / source / pipeline.cpp
index c6260f0ee73f15d060436ec99edf3d71aa57a3bf..fd638fb6ebbbbdd0a95a78caa57586d67b7660bf 100644 (file)
@@ -49,8 +49,17 @@ void Pipeline::set_multisample(unsigned s)
        if(s==samples)
                return;
 
+       unsigned old_samples = samples;
        samples = s;
-       create_targets(1);
+       try
+       {
+               create_targets(1);
+       }
+       catch(...)
+       {
+               samples = old_samples;
+               throw;
+       }
 }
 
 void Pipeline::set_camera(const Camera *c)
@@ -138,9 +147,7 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                setup_frame();
 
        const Framebuffer *out_fbo = Framebuffer::current();
-       /* Binding the current object is a no-op, but this will restore the original
-       FBO in case an exception is thrown. */
-       Bind restore_fbo(out_fbo, true);
+       // XXX Make sure the correct FBO is restored if an exception is thrown
 
        if(target[0])
        {
@@ -153,13 +160,15 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
        {
                Bind bind_depth_test(i->get_depth_test());
                Bind bind_blend(i->get_blend());
-               Bind bind_lighting(i->get_lighting());
+               renderer.set_lighting(i->get_lighting());
 
                for(vector<Slot>::const_iterator j=renderables.begin(); j!=renderables.end(); ++j)
                        if(j->passes.empty() || j->passes.count(i->get_tag()))
                                renderer.render(*j->renderable, i->get_tag());
        }
 
+       renderer.end();
+
        if(target[0])
        {
                if(samples)