mirror of https://github.com/mpv-player/mpv
vo_opengl: prevent division by zero in shader
In theory the max() should clamp it away anyway but I believe division by zero is UB so just avoid it altogether.
This commit is contained in:
parent
9e04018f92
commit
ef43854b34
|
@ -532,7 +532,7 @@ static void pass_tone_map(struct gl_shader_cache *sc, float ref_peak,
|
|||
|
||||
// Desaturate the color using a coefficient dependent on the brightness
|
||||
if (desat > 0 && ref_peak > desat) {
|
||||
GLSLF("float overbright = max(0.0, (luma - %f) / luma);\n", desat);
|
||||
GLSLF("float overbright = max(0.0, (luma - %f) / (luma + 1e-6));\n", desat);
|
||||
GLSL(color.rgb = mix(color.rgb, vec3(luma), overbright);)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue