[gtk/blue-rose-fix] gles: Fix texture color confusion



commit 2f5076dfdcbb4cb23b824bd66095a901c9485a12
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 23 13:33:54 2020 -0400

    gles: Fix texture color confusion
    
    We lack GL_BGRA in gles, so we have to swap
    channels in the shader.
    
    Fixes the blue rose.

 gsk/resources/glsl/preamble.fs.glsl | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gsk/resources/glsl/preamble.fs.glsl b/gsk/resources/glsl/preamble.fs.glsl
index cadbaf1331..07c72856a8 100644
--- a/gsk/resources/glsl/preamble.fs.glsl
+++ b/gsk/resources/glsl/preamble.fs.glsl
@@ -77,11 +77,21 @@ rounded_rect_coverage (RoundedRect r, vec2 p)
 }
 
 vec4 Texture(sampler2D sampler, vec2 texCoords) {
+  vec4 res;
+  float c;
 #if defined(GSK_GLES) || defined(GSK_LEGACY)
-  return texture2D(sampler, texCoords);
+  res = texture2D(sampler, texCoords);
 #else
-  return texture(sampler, texCoords);
+  res = texture(sampler, texCoords);
 #endif
+
+#if defined (GSK_GLES)
+  c = vec4.w;
+  vec4.w = vec4.z;
+  vec4.z = c;
+#endif
+
+  return res;
 }
 
 #ifdef GSK_GL3


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