[gtk+/wip/ebassi/gles: 13/26] gl: Tweak the swizzle for GLES texture fragments
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gles: 13/26] gl: Tweak the swizzle for GLES texture fragments
- Date: Sun, 24 Apr 2016 14:10:19 +0000 (UTC)
commit c2a12f5837c6ad37e12322dc9e12890cf329e534
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sat Apr 23 13:52:03 2016 +0100
gl: Tweak the swizzle for GLES texture fragments
Cairo surfaces are in BGRA format, but we upload them as RGBA buffers on
GLES; this means that the R and B channels are flipped in the texture
data.
Instead of doing a costly channel flip before putting them on the GPU,
we can flip the values inside the GLSL shader we use specifically for
GLES.
gdk/resources/glsl/gles2-texture.fs.glsl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gdk/resources/glsl/gles2-texture.fs.glsl b/gdk/resources/glsl/gles2-texture.fs.glsl
index 68e455f..56c6c82 100644
--- a/gdk/resources/glsl/gles2-texture.fs.glsl
+++ b/gdk/resources/glsl/gles2-texture.fs.glsl
@@ -5,5 +5,8 @@ uniform sampler2D map;
varying highp vec2 vUv;
void main() {
- gl_FragColor = texture2D(map, vUv);
+ 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]