From a0e747ab357fdad41a3c020ba0435c5d582039b6 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 14 Mar 2015 21:13:44 +0100 Subject: vo_opengl: only clamp when necessary This essentially makes it so that every gamma function that crops up somewhere has a corresponding clamp in front of it. --- video/out/gl_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 5eec1b3513..3c94e3c439 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1343,11 +1343,10 @@ static void pass_convert_yuv(struct gl_video *p) lessThanEqual(vec3(0.0181), color.rgb));) } - GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) - if (p->user_gamma_enabled) { p->use_indirect = true; gl_sc_uniform_f(sc, "user_gamma", user_gamma); + GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) GLSL(color.rgb = pow(color.rgb, vec3(1.0 / user_gamma));) } @@ -1398,6 +1397,7 @@ static void pass_render_main(struct gl_video *p) bool use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling || use_cms || p->image_params.gamma == MP_CSP_TRC_LINEAR; if (use_linear) { + GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) p->use_indirect = true; switch (p->image_params.gamma) { case MP_CSP_TRC_SRGB: -- cgit v1.2.3