summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2014-03-05 15:01:32 +0100
committerwm4 <wm4@nowhere>2014-03-10 22:56:26 +0100
commitfbddbce01dec878c072cd9dd00da9ff035f3350f (patch)
tree2e1d1f06945139f6c89a0051dbf05433737e40c1
parent6a833797dbafaf11bd37ba9827f828ff07e4577d (diff)
downloadmpv-fbddbce01dec878c072cd9dd00da9ff035f3350f.tar.bz2
mpv-fbddbce01dec878c072cd9dd00da9ff035f3350f.tar.xz
vo_opengl: Correct and clarify gl_check_features
This updates the logic for the new, somewhat unified behavior of SRGB and 3DLUT since 34bf9be (not that it was particularly correct even that change) and checks for the presence of corresponding extensions only in the cases in which they're needed.
-rw-r--r--video/out/gl_video.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 976fa3b486..204b8a8c70 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -1301,6 +1301,9 @@ static void init_video(struct gl_video *p, const struct mp_image_params *params)
p->colorspace = csp;
if (p->is_rgb && (p->opts.srgb || p->use_lut_3d)) {
+ // If we're opening an RGB source like a png file or similar,
+ // we just sample it using GL_SRGB which treats it as an sRGB source
+ // and pretend it's linear as far as CMS is concerned
p->is_linear_rgb = true;
p->image.planes[0].gl_internal_format = GL_SRGB;
}
@@ -1840,10 +1843,7 @@ static void check_gl_features(struct gl_video *p)
bool have_float_tex = gl->mpgl_caps & MPGL_CAP_FLOAT_TEX;
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;
+ bool have_mix = gl->glsl_version >= 130;
char *disabled[10];
int n_disabled = 0;
@@ -1878,19 +1878,32 @@ static void check_gl_features(struct gl_video *p)
}
}
- if (!have_srgb && p->opts.srgb) {
+ int use_cms = p->opts.srgb || p->use_lut_3d;
+
+ // srgb_compand() not available
+ if (!have_mix && p->opts.srgb) {
p->opts.srgb = false;
- disabled[n_disabled++] = "sRGB";
+ disabled[n_disabled++] = "sRGB output (GLSL version)";
}
- if (!have_fbo && p->use_lut_3d) {
+ if (!have_fbo && use_cms) {
+ p->opts.srgb = false;
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 (p->is_rgb) {
+ // When opening RGB files we use SRGB to expand
+ if (!have_srgb && use_cms) {
+ p->opts.srgb = false;
+ p->use_lut_3d = false;
+ disabled[n_disabled++] = "color management (SRGB textures)";
+ }
+ } else {
+ // when opening non-RGB files we use bt709_expand()
+ if (!have_mix && p->use_lut_3d) {
+ p->use_lut_3d = false;
+ disabled[n_disabled++] = "color management (GLSL version)";
+ }
}
-
if (!have_fbo) {
p->opts.scale_sep = false;
p->opts.indirect = false;