[gtk/ngl-less-shaders: 7/10] ngl: Improve the coloring shader
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ngl-less-shaders: 7/10] ngl: Improve the coloring shader
- Date: Sun, 14 Mar 2021 20:49:43 +0000 (UTC)
commit 8aac574d630e7e6b72a0b8f151f305369362ce1d
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 13 18:04:26 2021 -0500
ngl: Improve the coloring shader
Since we are now passing a float anyway, we can avoid
the branch in the fragment shader.
gsk/ngl/resources/coloring.glsl | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gsk/ngl/resources/coloring.glsl b/gsk/ngl/resources/coloring.glsl
index 15e8203b8a..007c54d562 100644
--- a/gsk/ngl/resources/coloring.glsl
+++ b/gsk/ngl/resources/coloring.glsl
@@ -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));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]