1 // GLSL is pickier than the C++ preprocessor in if-testing for undefined
2 // tokens; do some fixups here to keep it happy.
4 #ifndef YCBCR_OUTPUT_PLANAR
5 #define YCBCR_OUTPUT_PLANAR 0
8 #ifndef YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
9 #define YCBCR_OUTPUT_SPLIT_Y_AND_CBCR 0
12 #ifndef SECOND_YCBCR_OUTPUT_PLANAR
13 #define SECOND_YCBCR_OUTPUT_PLANAR 0
16 #ifndef SECOND_YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
17 #define SECOND_YCBCR_OUTPUT_SPLIT_Y_AND_CBCR 0
20 #ifndef SECOND_YCBCR_OUTPUT_INTERLEAVED
21 #define SECOND_YCBCR_OUTPUT_INTERLEAVED 0
24 #ifndef YCBCR_ALSO_OUTPUT_RGBA
25 #define YCBCR_ALSO_OUTPUT_RGBA 0
28 #ifndef SQUARE_ROOT_TRANSFORMATION
29 #define SQUARE_ROOT_TRANSFORMATION 0
32 #if YCBCR_OUTPUT_PLANAR
34 #elif YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
37 out vec4 FragColor; // Y'CbCr or RGBA.
40 #if SECOND_YCBCR_OUTPUT_PLANAR
41 out vec4 Y2, Cb2, Cr2;
42 #elif SECOND_YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
44 #elif SECOND_YCBCR_OUTPUT_INTERLEAVED
48 #if YCBCR_ALSO_OUTPUT_RGBA
54 #if YCBCR_ALSO_OUTPUT_RGBA
55 vec4 color[2] = INPUT(tc);
56 vec4 color0 = color[0];
57 vec4 color1 = color[1];
59 vec4 color0 = INPUT(tc);
62 #if SQUARE_ROOT_TRANSFORMATION
63 // Make sure we don't give negative values to sqrt.
64 color0.rgb = sqrt(max(color0.rgb, 0.0));
67 #if YCBCR_OUTPUT_PLANAR
71 #elif YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
78 // Exactly the same, just with other outputs.
79 // (GLSL does not allow arrays of outputs.)
80 #if SECOND_YCBCR_OUTPUT_PLANAR
84 #elif SECOND_YCBCR_OUTPUT_SPLIT_Y_AND_CBCR
86 Chroma2 = color0.gbba;
87 #elif SECOND_YCBCR_OUTPUT_INTERLEAVED
91 #if YCBCR_ALSO_OUTPUT_RGBA