+
+ // If we're the last phase, add the right #defines for Y'CbCr multi-output as needed.
+ vector<string> frag_shader_outputs; // In order.
+ if (phase->output_node->outgoing_links.empty() && output_color_ycbcr) {
+ switch (output_ycbcr_splitting) {
+ case YCBCR_OUTPUT_INTERLEAVED:
+ // No #defines set.
+ frag_shader_outputs.push_back("FragColor");
+ break;
+ case YCBCR_OUTPUT_SPLIT_Y_AND_CBCR:
+ frag_shader += "#define YCBCR_OUTPUT_SPLIT_Y_AND_CBCR 1\n";
+ frag_shader_outputs.push_back("Y");
+ frag_shader_outputs.push_back("Chroma");
+ break;
+ case YCBCR_OUTPUT_PLANAR:
+ frag_shader += "#define YCBCR_OUTPUT_PLANAR 1\n";
+ frag_shader_outputs.push_back("Y");
+ frag_shader_outputs.push_back("Cb");
+ frag_shader_outputs.push_back("Cr");
+ break;
+ default:
+ assert(false);
+ }
+
+ 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");
+ }
+ }
+ frag_shader.append(read_file("footer.frag"));