mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-15 21:20:09 +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)
|
// We use this shader for both plain glyphs (used as mask)
|
||||||
// and color glpyhs (used as source). The renderer sets
|
// and color glpyhs (used as source). The renderer sets
|
||||||
// aColor to vec4(-1) for color glyhs.
|
// 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;
|
use_color = 0.0;
|
||||||
else
|
else
|
||||||
use_color = 1.0;
|
use_color = 1.0;
|
||||||
@ -29,8 +29,5 @@ _IN_ float use_color;
|
|||||||
void main() {
|
void main() {
|
||||||
vec4 diffuse = GskTexture(u_source, vUv);
|
vec4 diffuse = GskTexture(u_source, vUv);
|
||||||
|
|
||||||
if (use_color > 0.0)
|
gskSetOutputColor(mix(diffuse * u_alpha, final_color * diffuse.a, use_color));
|
||||||
gskSetOutputColor(final_color * diffuse.a);
|
|
||||||
else
|
|
||||||
gskSetOutputColor(diffuse * u_alpha);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user