mirror of
https://github.com/yshui/picom.git
synced 2024-10-27 05:24:17 -04:00
backend: gl: don't add dither where it's not needed
If a pixel is perfectly representable as an 8-bit number, don't add dither. Reduce artifacts where dither is unnecessary. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
1271839baf
commit
d704e0f80e
1 changed files with 3 additions and 1 deletions
|
@ -201,7 +201,9 @@ const char dither_glsl[] = GLSL(330,
|
||||||
return bayer32;
|
return bayer32;
|
||||||
}
|
}
|
||||||
vec4 dither(vec4 c, vec2 coord) {
|
vec4 dither(vec4 c, vec2 coord) {
|
||||||
return vec4(c + bayer(coord) / 255.0);
|
vec4 residual = mod(c, 1.0 / 255.0);
|
||||||
|
vec4 dithered = vec4(greaterThan(residual, vec4(1e-4)));
|
||||||
|
return vec4(c + dithered * bayer(coord) / 255.0);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const char shadow_colorization_frag[] = GLSL(330,
|
const char shadow_colorization_frag[] = GLSL(330,
|
||||||
|
|
Loading…
Reference in a new issue