if(h==hdr)
return;
+ bool old_hdr= hdr;
hdr = h;
- create_targets(2);
+ try
+ {
+ create_targets(2);
+ }
+ catch(...)
+ {
+ hdr = old_hdr;
+ throw;
+ }
}
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)
void Pipeline::add_postprocessor(PostProcessor &pp)
{
postproc.push_back(&pp);
- create_targets(0);
+ try
+ {
+ create_targets(0);
+ }
+ catch(...)
+ {
+ postproc.pop_back();
+ throw;
+ }
}
void Pipeline::setup_frame() 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])
{
Bind bind_depth_test(i->get_depth_test());
Bind bind_blend(i->get_blend());
renderer.set_lighting(i->get_lighting());
+ renderer.set_clipping(i->get_clipping());
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)
tag(t),
lighting(0),
depth_test(0),
- blend(0)
+ blend(0),
+ clipping(0)
{ }
void Pipeline::Pass::set_lighting(const Lighting *l)
blend = b;
}
+void Pipeline::Pass::set_clipping(const Clipping *c)
+{
+ clipping =c;
+}
+
Pipeline::Slot::Slot(const Renderable *r):
renderable(r)