Recreate render targets if number of samples is changed.
Don't create render targets if neither postprocessing nor multisampling is
active. HDR is only useful with postprocessors (maybe postprocessors
should be able to request HDR?).
Call fbo.require_complete to allow trial-and-error autodetection of
rendering configuration.
void Pipeline::set_hdr(bool h)
{
void Pipeline::set_hdr(bool h)
{
}
void Pipeline::set_multisample(unsigned s)
{
}
void Pipeline::set_multisample(unsigned s)
{
+ if(s==samples)
+ return;
+
}
void Pipeline::set_camera(const Camera *c)
}
void Pipeline::set_camera(const Camera *c)
void Pipeline::add_postprocessor(PostProcessor &pp)
{
postproc.push_back(&pp);
void Pipeline::add_postprocessor(PostProcessor &pp)
{
postproc.push_back(&pp);
}
void Pipeline::setup_frame() const
}
void Pipeline::setup_frame() const
-void Pipeline::create_targets(bool recreate)
+void Pipeline::create_targets(unsigned recreate)
{
delete target[0];
delete target[1];
{
delete target[0];
delete target[1];
target[0] = 0;
target[1] = 0;
target[0] = 0;
target[1] = 0;
+ }
+ if(recreate>=1)
+ {
+ delete target_ms;
target_ms = 0;
}
PixelFormat fmt = (hdr ? RGB16F : RGB);
target_ms = 0;
}
PixelFormat fmt = (hdr ? RGB16F : RGB);
- if(!target[0])
- target[0] = new RenderTarget(width, height, fmt);
- if(!target[1] && postproc.size()>1)
- target[1] = new RenderTarget(width, height, fmt);
+ if(!postproc.empty() || samples)
+ {
+ if(!target[0])
+ target[0] = new RenderTarget(width, height, fmt);
+ if(!target[1] && postproc.size()>1)
+ target[1] = new RenderTarget(width, height, fmt);
+ }
if(!target_ms && samples)
target_ms = new MultisampleTarget(width, height, samples, fmt);
if(!target_ms && samples)
target_ms = new MultisampleTarget(width, height, samples, fmt);
depth.set_wrap(CLAMP_TO_EDGE);
depth.storage(DEPTH_COMPONENT, w, h);
fbo.attach(DEPTH_ATTACHMENT, depth, 0);
depth.set_wrap(CLAMP_TO_EDGE);
depth.storage(DEPTH_COMPONENT, w, h);
fbo.attach(DEPTH_ATTACHMENT, depth, 0);
+
+ fbo.require_complete();
depth.storage_multisample(s, DEPTH_COMPONENT, w, h);
fbo.attach(DEPTH_ATTACHMENT, depth);
depth.storage_multisample(s, DEPTH_COMPONENT, w, h);
fbo.attach(DEPTH_ATTACHMENT, depth);
+
+ fbo.require_complete();
virtual void render(Renderer &, const Tag &tag = Tag()) const;
private:
virtual void render(Renderer &, const Tag &tag = Tag()) const;
private:
- void create_targets(bool);
+ void create_targets(unsigned);