2 * Copyright (C) 2005-2010-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
22 texture g_KernelTexture;
27 Texture = <g_Texture>;
34 sampler KernelSampler =
37 Texture = <g_KernelTexture>;
46 float4 Position : POSITION;
47 float2 TextureUV : TEXCOORD0;
52 float4 RGBColor : COLOR0;
55 half4 weight(float pos)
59 w = tex1D(KernelSampler, pos);
61 w = tex1D(KernelSampler, pos).bgra;
64 #ifdef HAS_FLOAT_TEXTURE
71 half3 pixel(float xpos, float ypos)
73 return tex2D(RGBSampler, float2(xpos, ypos)).rgb;
76 half3 getLine(float ypos, float4 xpos, half4 linetaps)
79 pixel(xpos.r, ypos) * linetaps.r +
80 pixel(xpos.g, ypos) * linetaps.g +
81 pixel(xpos.b, ypos) * linetaps.b +
82 pixel(xpos.a, ypos) * linetaps.a;
85 PS_OUTPUT CONVOLUTION4x4(VS_OUTPUT In)
89 float2 pos = In.TextureUV + g_StepXY * 0.5;
90 float2 f = frac(pos / g_StepXY);
92 half4 linetaps = weight(1.0 - f.x);
93 half4 columntaps = weight(1.0 - f.y);
95 // kernel generation code made sure taps add up to 1, no need to adjust here.
97 float2 xystart = (-1.0 - f) * g_StepXY + In.TextureUV;
100 xystart.x + g_StepXY.x,
101 xystart.x + g_StepXY.x * 2.0,
102 xystart.x + g_StepXY.x * 3.0);
105 getLine(xystart.y , xpos, linetaps) * columntaps.r +
106 getLine(xystart.y + g_StepXY.y , xpos, linetaps) * columntaps.g +
107 getLine(xystart.y + g_StepXY.y * 2.0, xpos, linetaps) * columntaps.b +
108 getLine(xystart.y + g_StepXY.y * 3.0, xpos, linetaps) * columntaps.a;
110 OUT.RGBColor.a = 1.0;
118 PixelShader = compile ps_3_0 CONVOLUTION4x4();