aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2017-09-25 18:56:09 +0200
committerRainer Hochecker <fernetmenta@online.de>2017-10-05 18:06:23 +0200
commitf95a58e4b4a6de6a9e3e8073f738ec0bc8a4274b (patch)
tree668729a1bf24eaf3e6f810bc375a0703db1a36ce /system
parentcc325c5b02d8030a9a3fc7871eff1d602e6a915a (diff)
OpenGL: migrate GUITexture and Fonts to shaders
Diffstat (limited to 'system')
-rw-r--r--system/shaders/gl_shader_frag_default.glsl29
-rw-r--r--system/shaders/gl_shader_frag_fonts.glsl34
-rw-r--r--system/shaders/gl_shader_frag_multi.glsl32
-rw-r--r--system/shaders/gl_shader_frag_multi_blendcolor.glsl33
-rw-r--r--system/shaders/gl_shader_frag_texture.glsl31
-rw-r--r--system/shaders/gl_shader_frag_texture_noblend.glsl30
-rw-r--r--system/shaders/gl_shader_vert.glsl40
-rw-r--r--system/shaders/gl_shader_vert_default.glsl31
8 files changed, 260 insertions, 0 deletions
diff --git a/system/shaders/gl_shader_frag_default.glsl b/system/shaders/gl_shader_frag_default.glsl
new file mode 100644
index 0000000000..d9aba5f5fe
--- /dev/null
+++ b/system/shaders/gl_shader_frag_default.glsl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform vec4 m_unicol;
+
+// SM_DEFAULT shader
+void main ()
+{
+ gl_FragColor = m_unicol;
+}
diff --git a/system/shaders/gl_shader_frag_fonts.glsl b/system/shaders/gl_shader_frag_fonts.glsl
new file mode 100644
index 0000000000..fdc50c1130
--- /dev/null
+++ b/system/shaders/gl_shader_frag_fonts.glsl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform sampler2D m_samp0;
+varying vec4 m_cord0;
+varying vec4 m_colour;
+
+// SM_FONTS shader
+void main ()
+{
+ gl_FragColor.r = m_colour.r;
+ gl_FragColor.g = m_colour.g;
+ gl_FragColor.b = m_colour.b;
+ gl_FragColor.a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
+}
diff --git a/system/shaders/gl_shader_frag_multi.glsl b/system/shaders/gl_shader_frag_multi.glsl
new file mode 100644
index 0000000000..804a716ea3
--- /dev/null
+++ b/system/shaders/gl_shader_frag_multi.glsl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+
+// SM_MULTI shader
+void main ()
+{
+ gl_FragColor.rgba = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).rgba;
+}
diff --git a/system/shaders/gl_shader_frag_multi_blendcolor.glsl b/system/shaders/gl_shader_frag_multi_blendcolor.glsl
new file mode 100644
index 0000000000..20622d2375
--- /dev/null
+++ b/system/shaders/gl_shader_frag_multi_blendcolor.glsl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+uniform vec4 m_unicol;
+
+// SM_MULTI shader
+void main ()
+{
+ gl_FragColor.rgba = m_unicol * texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+}
diff --git a/system/shaders/gl_shader_frag_texture.glsl b/system/shaders/gl_shader_frag_texture.glsl
new file mode 100644
index 0000000000..c15681f85c
--- /dev/null
+++ b/system/shaders/gl_shader_frag_texture.glsl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform sampler2D m_samp0;
+uniform vec4 m_unicol;
+varying vec4 m_cord0;
+
+// SM_TEXTURE shader
+void main ()
+{
+ gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba * m_unicol);
+}
diff --git a/system/shaders/gl_shader_frag_texture_noblend.glsl b/system/shaders/gl_shader_frag_texture_noblend.glsl
new file mode 100644
index 0000000000..16a1f8bed9
--- /dev/null
+++ b/system/shaders/gl_shader_frag_texture_noblend.glsl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+uniform sampler2D m_samp0;
+varying vec4 m_cord0;
+
+// SM_TEXTURE_NOBLEND shader
+void main ()
+{
+ gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba);
+}
diff --git a/system/shaders/gl_shader_vert.glsl b/system/shaders/gl_shader_vert.glsl
new file mode 100644
index 0000000000..7c10b5f1bf
--- /dev/null
+++ b/system/shaders/gl_shader_vert.glsl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+attribute vec4 m_attrpos;
+attribute vec4 m_attrcol;
+attribute vec4 m_attrcord0;
+attribute vec4 m_attrcord1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying vec4 m_colour;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+
+void main ()
+{
+ mat4 mvp = m_proj * m_model;
+ gl_Position = mvp * m_attrpos;
+ m_colour = m_attrcol;
+ m_cord0 = m_attrcord0;
+ m_cord1 = m_attrcord1;
+}
diff --git a/system/shaders/gl_shader_vert_default.glsl b/system/shaders/gl_shader_vert_default.glsl
new file mode 100644
index 0000000000..554e15c3fd
--- /dev/null
+++ b/system/shaders/gl_shader_vert_default.glsl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 120
+
+attribute vec4 m_attrpos;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+
+void main ()
+{
+ mat4 mvp = m_proj * m_model;
+ gl_Position = mvp * m_attrpos;
+}