summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-03-13 13:27:36 -0700
committerEric Anholt <eric@anholt.net>2012-03-13 13:29:23 -0700
commit718c9beef680a7fe549cda571363610712460533 (patch)
tree36b84256c3cacfc3abc12a8abef118d70e2f161c /shaders
parent7244cfb2fed9d066de4301e49643961dd885f7ff (diff)
weston: Import shaders from the Weston project.
Diffstat (limited to 'shaders')
-rw-r--r--shaders/weston/1.frag14
-rw-r--r--shaders/weston/1.vert10
-rw-r--r--shaders/weston/2.frag9
-rw-r--r--shaders/weston/2.vert10
-rw-r--r--shaders/weston/3.frag6
-rw-r--r--shaders/weston/3.vert10
-rw-r--r--shaders/weston/4.frag9
-rw-r--r--shaders/weston/4.vert6
-rw-r--r--shaders/weston/5.frag19
-rw-r--r--shaders/weston/5.vert7
-rw-r--r--shaders/weston/6.frag7
-rw-r--r--shaders/weston/6.vert12
12 files changed, 119 insertions, 0 deletions
diff --git a/shaders/weston/1.frag b/shaders/weston/1.frag
new file mode 100644
index 0000000..987aa56
--- /dev/null
+++ b/shaders/weston/1.frag
@@ -0,0 +1,14 @@
+precision mediump float;
+varying vec2 v_texcoord;
+uniform sampler2D tex;
+uniform float alpha;
+uniform float texwidth;
+void main()
+{
+ if (v_texcoord.x < 0.0 || v_texcoord.x > texwidth ||
+ v_texcoord.y < 0.0 || v_texcoord.y > 1.0)
+ discard;
+ gl_FragColor = texture2D(tex, v_texcoord)
+; gl_FragColor = alpha * gl_FragColor;
+}
+
diff --git a/shaders/weston/1.vert b/shaders/weston/1.vert
new file mode 100644
index 0000000..7b4e1b7
--- /dev/null
+++ b/shaders/weston/1.vert
@@ -0,0 +1,10 @@
+uniform mat4 proj;
+attribute vec2 position;
+attribute vec2 texcoord;
+varying vec2 v_texcoord;
+void main()
+{
+ gl_Position = proj * vec4(position, 0.0, 1.0);
+ v_texcoord = texcoord;
+}
+
diff --git a/shaders/weston/2.frag b/shaders/weston/2.frag
new file mode 100644
index 0000000..e290824
--- /dev/null
+++ b/shaders/weston/2.frag
@@ -0,0 +1,9 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+uniform vec4 color;
+void main()
+{
+ gl_FragColor = color;
+}
+
diff --git a/shaders/weston/2.vert b/shaders/weston/2.vert
new file mode 100644
index 0000000..7b4e1b7
--- /dev/null
+++ b/shaders/weston/2.vert
@@ -0,0 +1,10 @@
+uniform mat4 proj;
+attribute vec2 position;
+attribute vec2 texcoord;
+varying vec2 v_texcoord;
+void main()
+{
+ gl_Position = proj * vec4(position, 0.0, 1.0);
+ v_texcoord = texcoord;
+}
+
diff --git a/shaders/weston/3.frag b/shaders/weston/3.frag
new file mode 100644
index 0000000..4c72c26
--- /dev/null
+++ b/shaders/weston/3.frag
@@ -0,0 +1,6 @@
+uniform vec4 color;
+void main()
+{
+ gl_FragColor = color;
+}
+
diff --git a/shaders/weston/3.vert b/shaders/weston/3.vert
new file mode 100644
index 0000000..03b57f1
--- /dev/null
+++ b/shaders/weston/3.vert
@@ -0,0 +1,10 @@
+attribute vec4 Vertex;
+attribute vec4 Color;
+attribute vec4 MultiTexCoord0;
+attribute vec4 MultiTexCoord1;
+uniform mat4 ModelViewProjectionMatrix;
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * Vertex;
+}
+
diff --git a/shaders/weston/4.frag b/shaders/weston/4.frag
new file mode 100644
index 0000000..544ecfa
--- /dev/null
+++ b/shaders/weston/4.frag
@@ -0,0 +1,9 @@
+#version 130
+uniform ivec4 color;
+out ivec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
diff --git a/shaders/weston/4.vert b/shaders/weston/4.vert
new file mode 100644
index 0000000..b081d0f
--- /dev/null
+++ b/shaders/weston/4.vert
@@ -0,0 +1,6 @@
+attribute vec4 position;
+void main()
+{
+ gl_Position = position;
+}
+
diff --git a/shaders/weston/5.frag b/shaders/weston/5.frag
new file mode 100644
index 0000000..1d1b4ff
--- /dev/null
+++ b/shaders/weston/5.frag
@@ -0,0 +1,19 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+uniform sampler2D source_sampler;
+uniform vec2 source_texdims;
+varying vec2 source_texcoords;
+vec4 get_source()
+{
+ return texture2D (source_sampler, source_texcoords);
+}
+vec4 get_mask()
+{
+ return vec4 (0, 0, 0, 1);
+}
+void main()
+{
+ gl_FragColor = get_source() * get_mask().a;
+}
+
diff --git a/shaders/weston/5.vert b/shaders/weston/5.vert
new file mode 100644
index 0000000..0fbd261
--- /dev/null
+++ b/shaders/weston/5.vert
@@ -0,0 +1,7 @@
+#version 130
+attribute vec4 position;
+void main()
+{
+ gl_Position = position;
+}
+
diff --git a/shaders/weston/6.frag b/shaders/weston/6.frag
new file mode 100644
index 0000000..8857b30
--- /dev/null
+++ b/shaders/weston/6.frag
@@ -0,0 +1,7 @@
+precision mediump float;
+uniform vec4 color;
+void main()
+{
+ gl_FragColor = color
+;}
+
diff --git a/shaders/weston/6.vert b/shaders/weston/6.vert
new file mode 100644
index 0000000..a1802af
--- /dev/null
+++ b/shaders/weston/6.vert
@@ -0,0 +1,12 @@
+varying vec2 source_texcoords;
+attribute vec4 Vertex;
+attribute vec4 Color;
+attribute vec4 MultiTexCoord0;
+attribute vec4 MultiTexCoord1;
+uniform mat4 ModelViewProjectionMatrix;
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * Vertex;
+ source_texcoords = MultiTexCoord0.xy;
+}
+