Sequence *SequenceBuilder::build(unsigned w, unsigned h) const
{
- RefPtr<Sequence> sequence = new Sequence(w, h, create_frame_format());
+ RefPtr<Sequence> sequence = create_sequence(w, h);
build(*sequence);
return sequence.release();
}
Sequence *SequenceBuilder::build(const View &view) const
{
- RefPtr<Sequence> sequence = new Sequence(view.get_width(), view.get_height(), create_frame_format());
+ RefPtr<Sequence> sequence = create_sequence(view.get_width(), view.get_height());
build(*sequence);
return sequence.release();
}
Sequence *SequenceBuilder::build(const Framebuffer &fbo) const
{
- RefPtr<Sequence> sequence = new Sequence(fbo.get_width(), fbo.get_height(), create_frame_format());
+ RefPtr<Sequence> sequence = create_sequence(fbo.get_width(), fbo.get_height());
build(*sequence);
return sequence.release();
}
-FrameFormat SequenceBuilder::create_frame_format() const
+Sequence * SequenceBuilder::create_sequence(unsigned w, unsigned h) const
{
+ if(!w || !h || tmpl.get_postprocessors().empty())
+ return new Sequence;
+
unsigned samples = min(tmpl.get_maximum_multisample(), Device::get_current().get_info().limits.max_samples);
if(samples<tmpl.get_required_multisample())
throw invalid_operation("SequenceBuilder::create_frame_format");
DataType color_type = (tmpl.get_hdr() ? HALF_FLOAT : UNSIGNED_BYTE);
PixelFormat color_pf = make_pixelformat(RGBA, color_type);
- return (COLOR_ATTACHMENT,color_pf, DEPTH_ATTACHMENT).set_samples(samples);
+ FrameFormat format = (COLOR_ATTACHMENT,color_pf, DEPTH_ATTACHMENT).set_samples(samples);
+ return new Sequence(w, h, format);
}
} // namespace GL