namespace movit {
-EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool)
+EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool, GLenum intermediate_format)
: aspect_nom(aspect_nom),
aspect_denom(aspect_denom),
output_color_rgba(false),
output_color_ycbcr(false),
dither_effect(NULL),
+ intermediate_format(intermediate_format),
num_dither_bits(0),
output_origin(OUTPUT_ORIGIN_BOTTOM_LEFT),
finalized(false),
if (alpha_handling == Effect::INPUT_AND_OUTPUT_PREMULTIPLIED_ALPHA ||
alpha_handling == Effect::INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK) {
+ // This combination (requiring premultiplied alpha, but _not_ requiring
+ // linear light) is illegal, // since the combination
+ // of premultiplied alpha and nonlinear inputs is
+ // meaningless.
+ assert(node->effect->needs_linear_light());
+
// If the effect has asked for premultiplied alpha, check that it has got it.
if (any_postmultiplied) {
node->output_alpha_type = ALPHA_INVALID;
check_error();
glDisable(GL_DITHER);
check_error();
+ glEnable(GL_FRAMEBUFFER_SRGB);
+ check_error();
// Save original viewport.
GLuint x = 0, y = 0;
if (!last_phase) {
find_output_size(phase);
- GLuint tex_num = resource_pool->create_2d_texture(GL_RGBA16F, phase->output_width, phase->output_height);
+ GLuint tex_num = resource_pool->create_2d_texture(intermediate_format, phase->output_width, phase->output_height);
output_textures->insert(make_pair(phase, tex_num));
}