EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool)
: aspect_nom(aspect_nom),
aspect_denom(aspect_denom),
EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool)
: aspect_nom(aspect_nom),
aspect_denom(aspect_denom),
}
void EffectChain::add_ycbcr_output(const ImageFormat &format, OutputAlphaFormat alpha_format,
const YCbCrFormat &ycbcr_format, YCbCrOutputSplitting output_splitting)
{
assert(!finalized);
}
void EffectChain::add_ycbcr_output(const ImageFormat &format, OutputAlphaFormat alpha_format,
const YCbCrFormat &ycbcr_format, YCbCrOutputSplitting output_splitting)
{
assert(!finalized);
+GLenum EffectChain::has_input_sampler(Node *node, unsigned input_num) const
+{
+ assert(input_num < node->incoming_links.size());
+ return node->incoming_links[input_num]->bound_sampler_num >= 0 &&
+ node->incoming_links[input_num]->bound_sampler_num < 8;
+}
+
void EffectChain::find_all_nonlinear_inputs(Node *node, vector<Node *> *nonlinear_inputs)
{
if (node->output_gamma_curve == GAMMA_LINEAR &&
void EffectChain::find_all_nonlinear_inputs(Node *node, vector<Node *> *nonlinear_inputs)
{
if (node->output_gamma_curve == GAMMA_LINEAR &&
frag_shader += string("#define INPUT ") + phase->effect_ids[phase->effects.back()] + "\n";
// If we're the last phase, add the right #defines for Y'CbCr multi-output as needed.
frag_shader += string("#define INPUT ") + phase->effect_ids[phase->effects.back()] + "\n";
// If we're the last phase, add the right #defines for Y'CbCr multi-output as needed.
+
+ if (output_color_rgba) {
+ // Note: Needs to come in the header, because not only the
+ // output needs to see it (YCbCrConversionEffect and DitherEffect
+ // do, too).
+ frag_shader_header += "#define YCBCR_ALSO_OUTPUT_RGBA 1\n";
+ frag_shader_outputs.push_back("RGBA");
+ }
// Collect uniforms from all effects and output them. Note that this needs
// to happen after output_fragment_shader(), even though the uniforms come
// Collect uniforms from all effects and output them. Note that this needs
// to happen after output_fragment_shader(), even though the uniforms come
extract_uniform_declarations(effect->uniforms_vec2, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_vec3, "vec3", effect_id, &phase->uniforms_vec3, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_vec4, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_vec2, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_vec3, "vec3", effect_id, &phase->uniforms_vec3, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_vec4, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms);
extract_uniform_array_declarations(effect->uniforms_vec2_array, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms);
extract_uniform_array_declarations(effect->uniforms_vec2_array, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms);
extract_uniform_array_declarations(effect->uniforms_vec4_array, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_mat3, "mat3", effect_id, &phase->uniforms_mat3, &frag_shader_uniforms);
}
extract_uniform_array_declarations(effect->uniforms_vec4_array, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms);
extract_uniform_declarations(effect->uniforms_mat3, "mat3", effect_id, &phase->uniforms_mat3, &frag_shader_uniforms);
}
// Collect the resulting location numbers for each uniform.
collect_uniform_locations(phase->glsl_program_num, &phase->uniforms_sampler2d);
// Collect the resulting location numbers for each uniform.
collect_uniform_locations(phase->glsl_program_num, &phase->uniforms_sampler2d);
- assert(output_color_type == OUTPUT_COLOR_RGB || output_color_type == OUTPUT_COLOR_YCBCR);
- if (output_color_type != OUTPUT_COLOR_YCBCR) {
+ assert(output_color_rgba || output_color_ycbcr);
+ if (!output_color_ycbcr) {