width = w;
height = h;
hdr = false;
+ alpha = false;
samples = 0;
target_ms = 0;
target[0] = 0;
}
}
+void Pipeline::set_alpha(bool a)
+{
+ if(a==alpha)
+ return;
+
+ bool old_alpha = alpha;
+ alpha = a;
+ try
+ {
+ create_targets(2);
+ }
+ catch(...)
+ {
+ alpha = old_alpha;
+ throw;
+ }
+}
+
void Pipeline::set_multisample(unsigned s)
{
if(s==samples)
target_ms = 0;
}
- PixelFormat color_pf = (hdr ? RGB16F : RGB);
+ PixelFormat color_pf = (hdr ? (alpha ? RGBA16F : RGB16F) : (alpha ? RGBA : RGB));
RenderTargetFormat fmt = (RENDER_COLOR,color_pf, RENDER_DEPTH);
if(!postproc.empty() || samples)
{
unsigned width;
unsigned height;
bool hdr;
+ bool alpha;
unsigned samples;
RenderTarget *target[2];
RenderTarget *target_ms;
A ColorCurve postprocessor is recommended for full benefit. */
void set_hdr(bool);
+ /* Enable or disable alpha channel. When enabled, all render targets are
+ created with an RGBA pixel format instead of RGB. */
+ void set_alpha(bool);
+
void set_multisample(unsigned);
unsigned get_width() const { return width; }
void PipelineBuilder::build(Pipeline &pipeline) const
{
pipeline.set_hdr(tmpl.get_hdr());
+ pipeline.set_alpha(tmpl.get_alpha());
unsigned samples = min(tmpl.get_maximum_multisample(), Renderbuffer::get_max_samples());
if(samples<tmpl.get_required_multisample())
throw invalid_operation("PipelineBuilder::build");
PipelineTemplate::PipelineTemplate():
hdr(false),
+ alpha(false),
required_multisample(0),
max_multisample(0)
{ }
void PipelineTemplate::Loader::init()
{
add("hdr", &PipelineTemplate::hdr);
+ add("alpha", &PipelineTemplate::alpha);
add("multisample", &Loader::multisample);
add("multisample", &Loader::multisample_range);
add("pass", &Loader::pass);
typedef DataFile::LoadableTypeRegistry<PostProcLoader, PostProcLoader::AddPostProc> PostProcessorRegistry;
bool hdr;
+ bool alpha;
unsigned required_multisample;
unsigned max_multisample;
PassArray passes;
~PipelineTemplate();
bool get_hdr() const { return hdr; }
+ bool get_alpha() const { return alpha; }
unsigned get_required_multisample() const { return required_multisample; }
unsigned get_maximum_multisample() const { return max_multisample; }
const PassArray &get_passes() const { return passes; }