mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
vo_opengl: fix compatibility with OpenGL 2.1
The srgb_compand() function passes bvec to mix(), which is apparently not available on GL 2.1 / GLSL 1.20: 0:0(0): error: no matching function for call to `mix(vec3, vec3, bvec3)' 0:0(0): error: candidates are: float mix(float, float, float) 0:0(0): error: vec2 mix(vec2, vec2, vec2) 0:0(0): error: vec3 mix(vec3, vec3, vec3) 0:0(0): error: vec4 mix(vec4, vec4, vec4) 0:0(0): error: vec2 mix(vec2, vec2, float) 0:0(0): error: vec3 mix(vec3, vec3, float) 0:0(0): error: vec4 mix(vec4, vec4, float) Also add back disabling color management on older GL, as the srgb_compand() function is needed for that.
This commit is contained in:
parent
a558117909
commit
0165ab5402
@ -1455,6 +1455,10 @@ static void check_gl_features(struct gl_priv *p)
|
||||
bool have_fbo = gl->mpgl_caps & MPGL_CAP_FB;
|
||||
bool have_srgb = gl->mpgl_caps & MPGL_CAP_SRGB_TEX;
|
||||
|
||||
// srgb_compand() not available
|
||||
if (gl->glsl_version < 130)
|
||||
have_srgb = false;
|
||||
|
||||
char *disabled[10];
|
||||
int n_disabled = 0;
|
||||
|
||||
@ -1488,6 +1492,10 @@ static void check_gl_features(struct gl_priv *p)
|
||||
p->use_lut_3d = false;
|
||||
disabled[n_disabled++] = "color management (FBO)";
|
||||
}
|
||||
if (!have_srgb && p->use_lut_3d) {
|
||||
p->use_lut_3d = false;
|
||||
disabled[n_disabled++] = "color management (sRGB)";
|
||||
}
|
||||
|
||||
if (!have_fbo) {
|
||||
p->use_scale_sep = false;
|
||||
|
@ -37,11 +37,14 @@
|
||||
# define in varying
|
||||
#endif
|
||||
|
||||
// Earlier GLSL doesn't support mix() with bvec
|
||||
#if __VERSION__ >= 130
|
||||
vec3 srgb_compand(vec3 v)
|
||||
{
|
||||
return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92,
|
||||
lessThanEqual(v, vec3(0.0031308)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#!section vertex_all
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user