0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

gl_video: fix OSX by not using undefined name in GLSL "#if"

The OSX shader compiler was giving this error:

    ERROR: 0:235: '' : syntax error incorrect preprocessor directive

on this line:

    [235] #if USE_CONV == CONV_PLANAR

USE_CONV was undefined in some cases. The expected behavior is that the
shader preprocessor interprets this as branch not taken (AFAIK exactly
as in C), which is probably what the standard would dictate. This is
possible an OSX bug. But admittedly, I'm not sure whether this is really
standard behavior (in C or GLSL), and doing this is extremely weird at
best, so make sure that USE_CONV is always defined.

Should fix behavior on OSX.
This commit is contained in:
wm4 2013-03-28 23:30:54 +01:00
parent 6232fa26b3
commit 5d8b50bda8

View File

@ -703,6 +703,8 @@ static void compile_shaders(struct gl_video *p)
shader_def(&header_conv, "USE_CONV", "CONV_NV12"); shader_def(&header_conv, "USE_CONV", "CONV_NV12");
} else if (p->plane_count > 1) { } else if (p->plane_count > 1) {
shader_def(&header_conv, "USE_CONV", "CONV_PLANAR"); shader_def(&header_conv, "USE_CONV", "CONV_PLANAR");
} else {
shader_def(&header_conv, "USE_CONV", "0");
} }
shader_def_opt(&header_conv, "USE_GBRP", p->image_format == IMGFMT_GBRP); shader_def_opt(&header_conv, "USE_GBRP", p->image_format == IMGFMT_GBRP);