From 5b08f06cd4547102186932ce789788e07ea8fd8c Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 6 Oct 2015 20:08:05 +0200 Subject: [PATCH] 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. --- footer.frag | 15 +++++++++++++++ ycbcr_conversion_effect.frag | 5 +++++ 2 files changed, 20 insertions(+) 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); -- 2.39.2