renderer/{metal,opengl}: need to premult our cell alpha to have effect

This commit is contained in:
Mitchell Hashimoto
2023-08-18 18:33:30 -07:00
parent e92021e0c9
commit 0ca6957d0c
2 changed files with 7 additions and 2 deletions

View File

@ -39,7 +39,8 @@ void main() {
case MODE_FG:
a = texture(text, glyph_tex_coords).r;
out_FragColor = vec4(color.rgb*a, color.a*a);
vec3 premult = color.rgb * color.a;
out_FragColor = vec4(premult.rgb*a, a);
break;
case MODE_FG_COLOR:

View File

@ -160,8 +160,12 @@ fragment float4 uber_fragment(
// We premult the alpha to our whole color since our blend function
// uses One/OneMinusSourceAlpha to avoid blurry edges.
// We first premult our given color.
float4 premult = float4(in.color.rgb * in.color.a, 1);
// Then premult the texture color
float a = textureGreyscale.sample(textureSampler, coord).r;
return in.color * a;
premult = premult * a;
return premult;
}
case MODE_FG_COLOR: {