From: Steinar H. Gunderson Date: Tue, 6 Oct 2015 18:08:05 +0000 (+0200) Subject: Fix GLSL compilation errors on some drivers. X-Git-Tag: 1.3.0~30 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=5b08f06cd4547102186932ce789788e07ea8fd8c Fix GLSL compilation errors on some drivers. Evidently #if FOO is illegal in GLSL if FOO is not defined, unlike in C++. Reported by Dan Dennedy. --- diff --git a/footer.frag b/footer.frag index 04c8e7c..4976136 100644 --- a/footer.frag +++ b/footer.frag @@ -1,3 +1,18 @@ +// GLSL is pickier than the C++ preprocessor in if-testing for undefined +// tokens; do some fixups here to keep it happy. + +#ifndef YCBCR_OUTPUT_PLANAR +#define YCBCR_OUTPUT_PLANAR 0 +#endif + +#ifndef YCBCR_OUTPUT_SPLIT_Y_AND_CBCR +#define YCBCR_OUTPUT_SPLIT_Y_AND_CBCR 0 +#endif + +#ifndef YCBCR_ALSO_OUTPUT_RGBA +#define YCBCR_ALSO_OUTPUT_RGBA 0 +#endif + #if YCBCR_OUTPUT_PLANAR out vec4 Y; out vec4 Cb; diff --git a/ycbcr_conversion_effect.frag b/ycbcr_conversion_effect.frag index ea5de45..4ef3801 100644 --- a/ycbcr_conversion_effect.frag +++ b/ycbcr_conversion_effect.frag @@ -1,3 +1,8 @@ +// See footer.frag for details about this if statement. +#ifndef YCBCR_ALSO_OUTPUT_RGBA +#define YCBCR_ALSO_OUTPUT_RGBA 0 +#endif + uniform sampler2D PREFIX(tex_y); uniform sampler2D PREFIX(tex_cb); uniform sampler2D PREFIX(tex_cr);