mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
ngl: Improve the coloring shader
Since we are now passing a float anyway, we can avoid the branch in the fragment shader.
This commit is contained in:
parent
c1f98d6837
commit
8aac574d63
@ -12,7 +12,7 @@ void main() {
|
||||
// We use this shader for both plain glyphs (used as mask)
|
||||
// and color glpyhs (used as source). The renderer sets
|
||||
// aColor to vec4(-1) for color glyhs.
|
||||
if (distance(aColor, vec4(-1)) < 0.001)
|
||||
if (distance(aColor,vec4(-1)) < 0.1)
|
||||
use_color = 0.0;
|
||||
else
|
||||
use_color = 1.0;
|
||||
@ -29,8 +29,5 @@ _IN_ float use_color;
|
||||
void main() {
|
||||
vec4 diffuse = GskTexture(u_source, vUv);
|
||||
|
||||
if (use_color > 0.0)
|
||||
gskSetOutputColor(final_color * diffuse.a);
|
||||
else
|
||||
gskSetOutputColor(diffuse * u_alpha);
|
||||
gskSetOutputColor(mix(diffuse * u_alpha, final_color * diffuse.a, use_color));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user