[gtk/wip/baedert/gl-rework] gl renderer: Add some in/out compat glue to the shaders



commit af63d476a477d750f2a8ded2eb0f2340431040a7
Author: Timm Bäder <mail baedert org>
Date:   Tue Dec 17 12:19:37 2019 +0100

    gl renderer: Add some in/out compat glue to the shaders
    
    so we can use _IN_ and _OUT_ and get the right things for
    desktop/es/legacy GL.

 gsk/resources/glsl/preamble.fs.glsl | 14 +++++++++-----
 gsk/resources/glsl/preamble.vs.glsl | 17 +++++++++++------
 2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/gsk/resources/glsl/preamble.fs.glsl b/gsk/resources/glsl/preamble.fs.glsl
index 2c53b3d019..569de0ab62 100644
--- a/gsk/resources/glsl/preamble.fs.glsl
+++ b/gsk/resources/glsl/preamble.fs.glsl
@@ -23,14 +23,18 @@ struct RoundedRect
 uniform vec4[3] u_clip_rect;
 
 #if GSK_GLES
-varying vec2 vUv;
+#define _OUT_ varying
+#define _IN_ varying
 #elif GSK_LEGACY
-varying vec2 vUv;
-varying vec4 outputColor;
+#define _OUT_ varying
+#define _IN_ varying
+_OUT_ vec4 outputColor;
 #else
-in vec2 vUv;
-out vec4 outputColor;
+#define _OUT_ out
+#define _IN_ in
+_OUT_ vec4 outputColor;
 #endif
+_IN_ vec2 vUv;
 
 // Transform from a GskRoundedRect to a RoundedRect as we need it.
 RoundedRect
diff --git a/gsk/resources/glsl/preamble.vs.glsl b/gsk/resources/glsl/preamble.vs.glsl
index 2af42e58e1..6b18bb7ce2 100644
--- a/gsk/resources/glsl/preamble.vs.glsl
+++ b/gsk/resources/glsl/preamble.vs.glsl
@@ -1,17 +1,22 @@
 uniform mat4 u_projection;
 uniform mat4 u_modelview;
 
-
 #if GSK_GLES
+#define _OUT_ varying
+#define _IN_ varying
 attribute vec2 aPosition;
 attribute vec2 aUv;
-varying vec2 vUv;
+_OUT_ vec2 vUv;
 #elif GSK_LEGACY
+#define _OUT_ varying
+#define _IN_ varying
 attribute vec2 aPosition;
 attribute vec2 aUv;
-varying vec2 vUv;
+_OUT_ vec2 vUv;
 #else
-in vec2 aPosition;
-in vec2 aUv;
-out vec2 vUv;
+#define _OUT_ out
+#define _IN_ in
+_IN_ vec2 aPosition;
+_IN_ vec2 aUv;
+_OUT_ vec2 vUv;
 #endif


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