[gtk: 1/2] ngl: Fix the coloring shader on GLES 2.0




commit 064947356ab85f9255316dccc4217eb0e507e768
Author: Emmanuel Gil Peyrot <linkmauve linkmauve fr>
Date:   Sat Mar 13 22:00:54 2021 +0000

    ngl: Fix the coloring shader on GLES 2.0
    
    Integer varyings didn’t exist in GLSL ES 1.00, neither did the flat
    attribute.

 gsk/ngl/resources/coloring.glsl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gsk/ngl/resources/coloring.glsl b/gsk/ngl/resources/coloring.glsl
index 69b21c6e2e..5b5d46a732 100644
--- a/gsk/ngl/resources/coloring.glsl
+++ b/gsk/ngl/resources/coloring.glsl
@@ -2,7 +2,7 @@
 // coloring.glsl
 
 _OUT_ vec4 final_color;
-flat _OUT_ int use_color;
+_OUT_ float use_color;
 
 void main() {
   gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
@@ -13,9 +13,9 @@ void main() {
   // and color glpyhs (used as source). The renderer sets
   // aColor to vec4(-1) for color glyhs.
   if (distance(aColor, vec4(-1)) < 0.001)
-    use_color = 0;
+    use_color = 0.0;
   else
-    use_color = 1;
+    use_color = 1.0;
 
   final_color = gsk_premultiply(aColor) * u_alpha;
 }
@@ -24,12 +24,12 @@ void main() {
 // coloring.glsl
 
 _IN_ vec4 final_color;
-flat _IN_ int use_color;
+_IN_ float use_color;
 
 void main() {
   vec4 diffuse = GskTexture(u_source, vUv);
 
-  if (use_color == 1)
+  if (use_color > 0.0)
     gskSetOutputColor(final_color * diffuse.a);
   else
     gskSetOutputColor(diffuse * u_alpha);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]