From 718c9beef680a7fe549cda571363610712460533 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Mar 2012 13:27:36 -0700 Subject: weston: Import shaders from the Weston project. --- COPYING | 25 +++++++++++++++++++++++++ shaders/weston/1.frag | 14 ++++++++++++++ shaders/weston/1.vert | 10 ++++++++++ shaders/weston/2.frag | 9 +++++++++ shaders/weston/2.vert | 10 ++++++++++ shaders/weston/3.frag | 6 ++++++ shaders/weston/3.vert | 10 ++++++++++ shaders/weston/4.frag | 9 +++++++++ shaders/weston/4.vert | 6 ++++++ shaders/weston/5.frag | 19 +++++++++++++++++++ shaders/weston/5.vert | 7 +++++++ shaders/weston/6.frag | 7 +++++++ shaders/weston/6.vert | 12 ++++++++++++ 13 files changed, 144 insertions(+) create mode 100644 shaders/weston/1.frag create mode 100644 shaders/weston/1.vert create mode 100644 shaders/weston/2.frag create mode 100644 shaders/weston/2.vert create mode 100644 shaders/weston/3.frag create mode 100644 shaders/weston/3.vert create mode 100644 shaders/weston/4.frag create mode 100644 shaders/weston/4.vert create mode 100644 shaders/weston/5.frag create mode 100644 shaders/weston/5.vert create mode 100644 shaders/weston/6.frag create mode 100644 shaders/weston/6.vert diff --git a/COPYING b/COPYING index 4b08a62..11c993f 100644 --- a/COPYING +++ b/COPYING @@ -98,6 +98,31 @@ Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com) along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +shaders/weston: +/* + * Copyright © 2010-2011 Intel Corporation + * Copyright © 2008-2011 Kristian Høgsberg + * Copyright © 2012 Collabora, Ltd. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + shaders/yofrankie: From the website: "The Apricot open game project, the data we’ve published online 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; +} + -- cgit v1.2.3