summaryrefslogtreecommitdiff
path: root/gdk/resources/glsl/gles2-texture.fs.glsl
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2016-04-25 13:38:22 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2016-04-25 14:33:36 +0100
commitf848450a70931133ab9368fd35b629c6c6e50fcb (patch)
tree648dbd35a3e44a168fa92f6d548639cb8e160bb9 /gdk/resources/glsl/gles2-texture.fs.glsl
parent1379b4b175910a253bb4aa8df3194eec2e160213 (diff)
downloadgtk+-f848450a70931133ab9368fd35b629c6c6e50fcb.tar.gz
gl: Use a uniform to flip R and B colors on GLES
This allows us to decide when the R and B color channels should be flipped with a much better granularity. For instance, when using GLX_EXT_texture_from_pixmap to create a GL texture from a surface we don't need to swap the R and B channels, as the internal representation of the texture data will already have the appropriate colors. We also don't need to flip color channels when blitting from a texture.
Diffstat (limited to 'gdk/resources/glsl/gles2-texture.fs.glsl')
-rw-r--r--gdk/resources/glsl/gles2-texture.fs.glsl8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdk/resources/glsl/gles2-texture.fs.glsl b/gdk/resources/glsl/gles2-texture.fs.glsl
index 56c6c82002..02193a3dca 100644
--- a/gdk/resources/glsl/gles2-texture.fs.glsl
+++ b/gdk/resources/glsl/gles2-texture.fs.glsl
@@ -1,12 +1,16 @@
precision mediump float;
uniform sampler2D map;
+uniform int flipColors;
varying highp vec2 vUv;
void main() {
vec4 color = texture2D(map, vUv);
- /* Flip R and B around to match the Cairo convention */
- gl_FragColor = vec4(color.z, color.y, color.x, color.w);
+ /* Flip R and B around to match the Cairo convention, if required */
+ if (flipColors == 1)
+ gl_FragColor = vec4(color.z, color.y, color.x, color.w);
+ else
+ gl_FragColor = color;
}