aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorAnton Fedchin <afedchin@ruswizards.com>2015-04-22 20:07:12 +0300
committerAnton Fedchin <afedchin@ruswizards.com>2015-07-04 10:24:33 +0300
commite603e18f0eb374fa1f3a9951eb0855ab03cf345f (patch)
tree701c24817d9af74f1b9efa2142282c94b392bb28 /system
parent8bb349c9fd46e45a5c6f564b163332e360bb9707 (diff)
[win32] Added DirectX11 GUI shaders.
Diffstat (limited to 'system')
-rw-r--r--system/shaders/guishader_checkerboard_left.hlsl40
-rw-r--r--system/shaders/guishader_checkerboard_right.hlsl40
-rw-r--r--system/shaders/guishader_common.hlsl73
-rw-r--r--system/shaders/guishader_default.hlsl28
-rw-r--r--system/shaders/guishader_fonts.hlsl31
-rw-r--r--system/shaders/guishader_interlaced_left.hlsl40
-rw-r--r--system/shaders/guishader_interlaced_right.hlsl40
-rw-r--r--system/shaders/guishader_multi_texture_blend.hlsl31
-rw-r--r--system/shaders/guishader_texture.hlsl30
-rw-r--r--system/shaders/guishader_texture_noblend.hlsl30
-rw-r--r--system/shaders/guishader_vert.hlsl37
-rw-r--r--system/shaders/guishader_video.hlsl38
-rw-r--r--system/shaders/guishader_video_control.hlsl46
13 files changed, 504 insertions, 0 deletions
diff --git a/system/shaders/guishader_checkerboard_left.hlsl b/system/shaders/guishader_checkerboard_left.hlsl
new file mode 100644
index 0000000000..3795b7277c
--- /dev/null
+++ b/system/shaders/guishader_checkerboard_left.hlsl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#define STEREO_MODE_SHADER
+
+Texture2D texView : register(t0);
+
+cbuffer cbViewPort : register(b0)
+{
+ float g_viewPortX;
+ float g_viewPortY;
+ float g_viewPortWidth;
+ float g_viewPortHeigh;
+};
+
+#include "guishader_common.hlsl"
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return StereoCheckerboard(input, STEREO_LEFT_EYE_INDEX);
+}
+
+
diff --git a/system/shaders/guishader_checkerboard_right.hlsl b/system/shaders/guishader_checkerboard_right.hlsl
new file mode 100644
index 0000000000..2b0d96941e
--- /dev/null
+++ b/system/shaders/guishader_checkerboard_right.hlsl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#define STEREO_MODE_SHADER
+
+Texture2D texView : register(t0);
+
+cbuffer cbViewPort : register(b0)
+{
+ float g_viewPortX;
+ float g_viewPortY;
+ float g_viewPortWidth;
+ float g_viewPortHeigh;
+};
+
+#include "guishader_common.hlsl"
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return StereoCheckerboard(input, STEREO_RIGHT_EYE_INDEX);
+}
+
+
diff --git a/system/shaders/guishader_common.hlsl b/system/shaders/guishader_common.hlsl
new file mode 100644
index 0000000000..c912201364
--- /dev/null
+++ b/system/shaders/guishader_common.hlsl
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+struct VS_INPUT
+{
+ float4 pos : POSITION;
+ float4 color: COLOR0;
+ float2 tex : TEXCOORD0;
+ float2 tex2 : TEXCOORD1;
+};
+
+struct PS_INPUT
+{
+ float4 pos : SV_POSITION;
+ float4 color: COLOR0;
+ float2 tex : TEXCOORD0;
+ float2 tex2 : TEXCOORD1;
+};
+
+SamplerState LinearSampler : register(s0)
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ Comparison = NEVER;
+};
+
+#define STEREO_LEFT_EYE_INDEX 0
+#define STEREO_RIGHT_EYE_INDEX 1
+
+#ifdef STEREO_MODE_SHADER
+
+inline float4 StereoInterlaced(PS_INPUT input, int eye)
+{
+ uint pixelY = abs(trunc(input.tex.y * g_viewPortHeigh));
+ uint odd = pixelY % 2;
+
+ if ((odd == 0 && !eye) || (odd != 0 && eye))
+ return float4(texView.Sample(LinearSampler, input.tex).rgb, 1.0);
+ else
+ return float4(0.0, 0.0, 0.0, 0.0);
+}
+
+inline float4 StereoCheckerboard(PS_INPUT input, int eye)
+{
+ uint pixelX = abs(trunc(input.tex.x * g_viewPortWidth));
+ uint pixelY = abs(trunc(input.tex.y * g_viewPortHeigh));
+ uint odd = (pixelX + pixelY) % 2;
+
+ if ((odd == 0 && !eye) || (odd != 0 && eye))
+ return float4(texView.Sample(LinearSampler, input.tex).rgb, 1.0);
+ else
+ return float4(0.0, 0.0, 0.0, 0.0);
+}
+
+#endif \ No newline at end of file
diff --git a/system/shaders/guishader_default.hlsl b/system/shaders/guishader_default.hlsl
new file mode 100644
index 0000000000..bf68e44f18
--- /dev/null
+++ b/system/shaders/guishader_default.hlsl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return input.color;
+}
+
+
diff --git a/system/shaders/guishader_fonts.hlsl b/system/shaders/guishader_fonts.hlsl
new file mode 100644
index 0000000000..27fbf4264f
--- /dev/null
+++ b/system/shaders/guishader_fonts.hlsl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D texFont : register(t0);
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ input.color.a *= texFont.Sample(LinearSampler, input.tex).a;
+ return input.color;
+}
+
+
diff --git a/system/shaders/guishader_interlaced_left.hlsl b/system/shaders/guishader_interlaced_left.hlsl
new file mode 100644
index 0000000000..fcb6d272f0
--- /dev/null
+++ b/system/shaders/guishader_interlaced_left.hlsl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#define STEREO_MODE_SHADER
+
+Texture2D texView : register(t0);
+
+cbuffer cbViewPort : register(b0)
+{
+ float g_viewPortX;
+ float g_viewPortY;
+ float g_viewPortWidth;
+ float g_viewPortHeigh;
+};
+
+#include "guishader_common.hlsl"
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return StereoInterlaced(input, STEREO_LEFT_EYE_INDEX);
+}
+
+
diff --git a/system/shaders/guishader_interlaced_right.hlsl b/system/shaders/guishader_interlaced_right.hlsl
new file mode 100644
index 0000000000..ac3b8af067
--- /dev/null
+++ b/system/shaders/guishader_interlaced_right.hlsl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#define STEREO_MODE_SHADER
+
+Texture2D texView : register(t0);
+
+cbuffer cbViewPort : register(b0)
+{
+ float g_viewPortX;
+ float g_viewPortY;
+ float g_viewPortWidth;
+ float g_viewPortHeigh;
+};
+
+#include "guishader_common.hlsl"
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return StereoInterlaced(input, STEREO_RIGHT_EYE_INDEX);
+}
+
+
diff --git a/system/shaders/guishader_multi_texture_blend.hlsl b/system/shaders/guishader_multi_texture_blend.hlsl
new file mode 100644
index 0000000000..e968ae3ca6
--- /dev/null
+++ b/system/shaders/guishader_multi_texture_blend.hlsl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D txDiffuse[2] : register(t0);
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return input.color * txDiffuse[0].Sample(LinearSampler, input.tex)
+ * txDiffuse[1].Sample(LinearSampler, input.tex2);
+}
+
+
diff --git a/system/shaders/guishader_texture.hlsl b/system/shaders/guishader_texture.hlsl
new file mode 100644
index 0000000000..b557e3bf80
--- /dev/null
+++ b/system/shaders/guishader_texture.hlsl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D texMain : register(t0);
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return input.color * texMain.Sample(LinearSampler, input.tex);
+}
+
+
diff --git a/system/shaders/guishader_texture_noblend.hlsl b/system/shaders/guishader_texture_noblend.hlsl
new file mode 100644
index 0000000000..1daaa2004b
--- /dev/null
+++ b/system/shaders/guishader_texture_noblend.hlsl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D texMain : register(t0);
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return texMain.Sample(LinearSampler, input.tex);
+}
+
+
diff --git a/system/shaders/guishader_vert.hlsl b/system/shaders/guishader_vert.hlsl
new file mode 100644
index 0000000000..17991993a4
--- /dev/null
+++ b/system/shaders/guishader_vert.hlsl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+cbuffer cbWorld : register(b0)
+{
+ float4x4 worldViewProj;
+};
+
+PS_INPUT VS(VS_INPUT input)
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.pos = mul(input.pos, worldViewProj);
+ output.color = input.color;
+ output.tex = input.tex;
+ output.tex2 = input.tex2;
+
+ return output;
+}
diff --git a/system/shaders/guishader_video.hlsl b/system/shaders/guishader_video.hlsl
new file mode 100644
index 0000000000..938c81f724
--- /dev/null
+++ b/system/shaders/guishader_video.hlsl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D texVideo : register(t0);
+
+SamplerState DynamicSampler : register(s1)
+{
+ Filter = MIN_MAG_MIP_POINT; // default
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ Comparison = NEVER;
+};
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ return texVideo.Sample(DynamicSampler, input.tex);
+}
+
+
diff --git a/system/shaders/guishader_video_control.hlsl b/system/shaders/guishader_video_control.hlsl
new file mode 100644
index 0000000000..ab73268163
--- /dev/null
+++ b/system/shaders/guishader_video_control.hlsl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2005-2015 Team Kodi
+ * http://kodi.tv
+ *
+ * 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/>.
+ *
+ */
+
+#include "guishader_common.hlsl"
+
+Texture2D texVideo : register(t0);
+
+SamplerState DynamicSampler : register(s1)
+{
+ Filter = MIN_MAG_MIP_POINT; // default
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ Comparison = NEVER;
+};
+
+float4 PS(PS_INPUT input) : SV_TARGET
+{
+ float4 current = texVideo.Sample(DynamicSampler, input.tex);
+
+ float4 diffuse = float4(input.color.rrr, 1.0f);
+ float4 specular = float4(input.color.ggg, 1.0f);
+ current *= diffuse * 2.0;
+ current.a = input.color.a;
+ current.rgb += specular.rgb - 0.5;
+
+ return current;
+}
+
+