summaryrefslogtreecommitdiffstats
path: root/libvo/vo_opengl.c
diff options
context:
space:
mode:
authornand <nand@lavabit.com>2012-11-10 19:08:21 +0100
committerwm4 <wm4@nowhere>2012-11-11 17:56:42 +0100
commited8fad729d0481ebbedd020694c3624672c38425 (patch)
tree2fecf6cb5486a1ebc1f95eb55274f279d9a996ba /libvo/vo_opengl.c
parentc78243c03e25aa62171e7353ed455d1ac6ea77b0 (diff)
downloadmpv-ed8fad729d0481ebbedd020694c3624672c38425.tar.bz2
mpv-ed8fad729d0481ebbedd020694c3624672c38425.tar.xz
vo_opengl: add manual sRGB companding to not artifact when dithering
Patch by nand. Modified not to use macros in the GLSL, and also remove the checks for framebuffer presence. (Disabling ICC if no sRGB framebuffer is available was probably a bug.)
Diffstat (limited to 'libvo/vo_opengl.c')
-rw-r--r--libvo/vo_opengl.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/libvo/vo_opengl.c b/libvo/vo_opengl.c
index 261e1b102f..04a3559be5 100644
--- a/libvo/vo_opengl.c
+++ b/libvo/vo_opengl.c
@@ -698,6 +698,7 @@ static void compile_shaders(struct gl_priv *p)
shader_def_opt(&header_final, "USE_LINEAR_CONV_INV", p->use_lut_3d);
shader_def_opt(&header_final, "USE_GAMMA_POW", p->use_gamma);
shader_def_opt(&header_final, "USE_3DLUT", p->use_lut_3d);
+ shader_def_opt(&header_final, "USE_SRGB", p->use_srgb);
shader_def_opt(&header_final, "USE_DITHER", p->dither_texture != 0);
if (p->use_scale_sep && p->scalers[0].kernel) {
@@ -1122,11 +1123,6 @@ static void do_render(struct gl_priv *p)
float final_texw = p->image_width * source->tex_w / (float)source->vp_w;
float final_texh = p->image_height * source->tex_h / (float)source->vp_h;
- bool use_srgb_fb = p->use_srgb && !p->use_lut_3d;
-
- if (use_srgb_fb)
- gl->Enable(GL_FRAMEBUFFER_SRGB);
-
if (p->stereo_mode) {
int w = p->src_rect.x1 - p->src_rect.x0;
int imgw = p->image_width;
@@ -1165,9 +1161,6 @@ static void do_render(struct gl_priv *p)
draw_triangles(p, vb, VERTICES_PER_QUAD);
}
- if (use_srgb_fb)
- gl->Disable(GL_FRAMEBUFFER_SRGB);
-
gl->UseProgram(0);
debug_check_gl(p, "after video rendering");
@@ -1457,8 +1450,7 @@ static void check_gl_features(struct gl_priv *p)
GL *gl = p->gl;
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) &&
- (gl->mpgl_caps & MPGL_CAP_SRGB_FB);
+ bool have_srgb = gl->mpgl_caps & MPGL_CAP_SRGB_TEX;
char *disabled[10];
int n_disabled = 0;
@@ -1493,10 +1485,6 @@ 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;