diff options
author | Anton Fedchin <afedchin@ruswizards.com> | 2015-07-07 12:23:57 +0300 |
---|---|---|
committer | Anton Fedchin <afedchin@ruswizards.com> | 2015-07-11 11:12:24 +0300 |
commit | 1ece66f678cd8e7e1b57e94deaa74d0307703ef5 (patch) | |
tree | a194b28536ee7324a0882ee0421982508dc4f82f /system/shaders | |
parent | ac54ddfe73672487aaaa54ab8d06b231d44e1201 (diff) |
[dx11] WinVideoFilter: a little shaders optimizations.
Diffstat (limited to 'system/shaders')
-rw-r--r-- | system/shaders/convolution-4x4_d3d.fx | 48 | ||||
-rw-r--r-- | system/shaders/convolution-6x6_d3d.fx | 61 | ||||
-rw-r--r-- | system/shaders/convolutionsep-4x4_d3d.fx | 74 | ||||
-rw-r--r-- | system/shaders/convolutionsep-6x6_d3d.fx | 84 | ||||
-rw-r--r-- | system/shaders/testshader.fx | 6 | ||||
-rw-r--r-- | system/shaders/yuv2rgb_d3d.fx | 12 |
6 files changed, 124 insertions, 161 deletions
diff --git a/system/shaders/convolution-4x4_d3d.fx b/system/shaders/convolution-4x4_d3d.fx index e1bec786c7..9d92b12b22 100644 --- a/system/shaders/convolution-4x4_d3d.fx +++ b/system/shaders/convolution-4x4_d3d.fx @@ -21,8 +21,7 @@ texture2D g_Texture; texture2D g_KernelTexture; float2 g_StepXY; -float g_viewportWidth; -float g_viewportHeight; +float2 g_viewPort; SamplerState RGBSampler : IMMUTABLE { @@ -46,8 +45,8 @@ struct VS_INPUT struct VS_OUTPUT { - float4 Position : SV_POSITION; float2 TextureUV : TEXCOORD0; + float4 Position : SV_POSITION; }; // @@ -56,8 +55,8 @@ struct VS_OUTPUT VS_OUTPUT VS(VS_INPUT In) { VS_OUTPUT output = (VS_OUTPUT)0; - output.Position.x = (In.Position.x / (g_viewportWidth / 2.0)) - 1; - output.Position.y = -(In.Position.y / (g_viewportHeight / 2.0)) + 1; + output.Position.x = (In.Position.x / (g_viewPort.x / 2.0)) - 1; + output.Position.y = -(In.Position.y / (g_viewPort.y / 2.0)) + 1; output.Position.z = output.Position.z; output.Position.w = 1.0; output.TextureUV = In.TextureUV; @@ -79,46 +78,47 @@ inline half4 weight(float pos) return w; } +inline half3 pixel(float xpos, float ypos) +{ + return g_Texture.Sample(RGBSampler, float2(xpos, ypos)).rgb; +} + inline half3 getLine(float ypos, float4 xpos, half4 linetaps) { return - g_Texture.Sample(RGBSampler, float2(xpos.r, ypos)).rgb * linetaps.r + - g_Texture.Sample(RGBSampler, float2(xpos.g, ypos)).rgb * linetaps.g + - g_Texture.Sample(RGBSampler, float2(xpos.b, ypos)).rgb * linetaps.b + - g_Texture.Sample(RGBSampler, float2(xpos.a, ypos)).rgb * linetaps.a; + pixel(xpos.r, ypos) * linetaps.r + + pixel(xpos.g, ypos) * linetaps.g + + pixel(xpos.b, ypos) * linetaps.b + + pixel(xpos.a, ypos) * linetaps.a; } -float4 CONVOLUTION4x4(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION4x4(float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY * 0.5; - float2 f = frac(pos / g_StepXY); + float2 f = frac(TextureUV / g_StepXY + float2(0.5, 0.5)); half4 linetaps = weight(1.0 - f.x); half4 columntaps = weight(1.0 - f.y); // kernel generation code made sure taps add up to 1, no need to adjust here. - float2 xystart = (-1.0 - f) * g_StepXY + In.TextureUV; - float4 xpos = float4( - xystart.x, - xystart.x + g_StepXY.x, - xystart.x + g_StepXY.x * 2.0, - xystart.x + g_StepXY.x * 3.0); + float2 xystart = (-1.0 - f) * g_StepXY + TextureUV; + float4 xpos = xystart.x + g_StepXY.x * float4(0.0, 1.0, 2.0, 3.0); + float4 ypos = xystart.y + g_StepXY.y * float4(0.0, 1.0, 2.0, 3.0); float3 rgb = - getLine(xystart.y , xpos, linetaps) * columntaps.r + - getLine(xystart.y + g_StepXY.y , xpos, linetaps) * columntaps.g + - getLine(xystart.y + g_StepXY.y * 2.0, xpos, linetaps) * columntaps.b + - getLine(xystart.y + g_StepXY.y * 3.0, xpos, linetaps) * columntaps.a; + getLine(ypos.x, xpos, linetaps) * columntaps.r + + getLine(ypos.y, xpos, linetaps) * columntaps.g + + getLine(ypos.z, xpos, linetaps) * columntaps.b + + getLine(ypos.w, xpos, linetaps) * columntaps.a; return float4(rgb, 1.0); } -technique10 SCALER_T +technique11 SCALER_T { pass P0 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION4x4() ) ); } }; diff --git a/system/shaders/convolution-6x6_d3d.fx b/system/shaders/convolution-6x6_d3d.fx index a773a01855..d6f1210ba2 100644 --- a/system/shaders/convolution-6x6_d3d.fx +++ b/system/shaders/convolution-6x6_d3d.fx @@ -21,8 +21,7 @@ texture2D g_Texture; texture2D g_KernelTexture; float2 g_StepXY; -float g_viewportWidth; -float g_viewportHeight; +float2 g_viewPort; SamplerState RGBSampler : IMMUTABLE { @@ -40,8 +39,8 @@ SamplerState KernelSampler : IMMUTABLE struct VS_OUTPUT { - float4 Position : SV_POSITION; float2 TextureUV : TEXCOORD0; + float4 Position : SV_POSITION; }; // @@ -50,8 +49,8 @@ struct VS_OUTPUT VS_OUTPUT VS(VS_OUTPUT In) { VS_OUTPUT output = (VS_OUTPUT)0; - output.Position.x = (In.Position.x / (g_viewportWidth / 2.0)) - 1; - output.Position.y = -(In.Position.y / (g_viewportHeight / 2.0)) + 1; + output.Position.x = (In.Position.x / (g_viewPort.x / 2.0)) - 1; + output.Position.y = -(In.Position.y / (g_viewPort.y / 2.0)) + 1; output.Position.z = output.Position.z; output.Position.w = 1.0; output.TextureUV = In.TextureUV; @@ -73,21 +72,25 @@ half3 weight(float pos) return w; } +inline half3 pixel(float xpos, float ypos) +{ + return g_Texture.Sample(RGBSampler, float2(xpos, ypos)).rgb; +} + inline half3 getLine(float ypos, float3 xpos1, float3 xpos2, half3 linetaps1, half3 linetaps2) { return - g_Texture.Sample(RGBSampler, float2(xpos1.r, ypos)).rgb * linetaps1.r + - g_Texture.Sample(RGBSampler, float2(xpos1.g, ypos)).rgb * linetaps2.r + - g_Texture.Sample(RGBSampler, float2(xpos1.b, ypos)).rgb * linetaps1.g + - g_Texture.Sample(RGBSampler, float2(xpos2.r, ypos)).rgb * linetaps2.g + - g_Texture.Sample(RGBSampler, float2(xpos2.g, ypos)).rgb * linetaps1.b + - g_Texture.Sample(RGBSampler, float2(xpos2.b, ypos)).rgb * linetaps2.b; + pixel(xpos1.r, ypos) * linetaps1.r + + pixel(xpos1.g, ypos) * linetaps2.r + + pixel(xpos1.b, ypos) * linetaps1.g + + pixel(xpos2.r, ypos) * linetaps2.g + + pixel(xpos2.g, ypos) * linetaps1.b + + pixel(xpos2.b, ypos) * linetaps2.b; } -float4 CONVOLUTION6x6(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION6x6(in float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY * 0.5; - float2 f = frac(pos / g_StepXY); + float2 f = frac(TextureUV / g_StepXY + 0.5); half3 linetaps1 = weight((1.0 - f.x) / 2.0); half3 linetaps2 = weight((1.0 - f.x) / 2.0 + 0.5); @@ -96,32 +99,28 @@ float4 CONVOLUTION6x6(VS_OUTPUT In) : SV_TARGET // kernel generation code made sure taps add up to 1, no need to adjust here. - float2 xystart = (-2.0 - f) * g_StepXY + In.TextureUV; - float3 xpos1 = float3( - xystart.x, - xystart.x + g_StepXY.x, - xystart.x + g_StepXY.x * 2.0); - float3 xpos2 = half3( - xystart.x + g_StepXY.x * 3.0, - xystart.x + g_StepXY.x * 4.0, - xystart.x + g_StepXY.x * 5.0); + float2 xystart = (-2.0 - f) * g_StepXY + TextureUV; + float3 xpos1 = xystart.x + g_StepXY.x * float3(0.0, 1.0, 2.0); + float3 xpos2 = xystart.x + g_StepXY.x * float3(3.0, 4.0, 5.0); + float3 ypos1 = xystart.y + g_StepXY.y * float3(0.0, 1.0, 2.0); + float3 ypos2 = xystart.y + g_StepXY.y * float3(3.0, 4.0, 5.0); float3 rgb = - getLine(xystart.y , xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r + - getLine(xystart.y + g_StepXY.y , xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r + - getLine(xystart.y + g_StepXY.y * 2.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g + - getLine(xystart.y + g_StepXY.y * 3.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g + - getLine(xystart.y + g_StepXY.y * 4.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b + - getLine(xystart.y + g_StepXY.y * 5.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b; + getLine(ypos1.x, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r + + getLine(ypos1.y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r + + getLine(ypos1.z, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g + + getLine(ypos2.x, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g + + getLine(ypos2.y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b + + getLine(ypos2.z, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b; return float4(rgb, 1.0f); } -technique10 SCALER_T +technique11 SCALER_T { pass P0 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION6x6() ) ); } }; diff --git a/system/shaders/convolutionsep-4x4_d3d.fx b/system/shaders/convolutionsep-4x4_d3d.fx index 2816e7bbc2..a778987651 100644 --- a/system/shaders/convolutionsep-4x4_d3d.fx +++ b/system/shaders/convolutionsep-4x4_d3d.fx @@ -20,10 +20,8 @@ texture2D g_Texture; texture2D g_KernelTexture; -float2 g_StepXY_P0; -float2 g_StepXY_P1; -float g_viewportWidth; -float g_viewportHeight; +float4 g_StepXY; +float2 g_viewPort; SamplerState RGBSampler : IMMUTABLE { @@ -47,8 +45,8 @@ struct VS_INPUT struct VS_OUTPUT { - float4 Position : SV_POSITION; float2 TextureUV : TEXCOORD0; + float4 Position : SV_POSITION; }; // @@ -57,8 +55,8 @@ struct VS_OUTPUT VS_OUTPUT VS(VS_INPUT In) { VS_OUTPUT output = (VS_OUTPUT)0; - output.Position.x = (In.Position.x / (g_viewportWidth / 2.0)) - 1; - output.Position.y = -(In.Position.y / (g_viewportHeight / 2.0)) + 1; + output.Position.x = (In.Position.x / (g_viewPort.x / 2.0)) - 1; + output.Position.y = -(In.Position.y / (g_viewPort.y / 2.0)) + 1; output.Position.z = output.Position.z; output.Position.w = 1.0; output.TextureUV = In.TextureUV; @@ -80,9 +78,9 @@ inline half4 weight(float pos) return w; } -inline half3 pixel(texture2D tex, float xpos, float ypos) +inline half3 pixel(float xpos, float ypos) { - return tex.Sample(RGBSampler, float2(xpos, ypos)).rgb; + return g_Texture.Sample(RGBSampler, float2(xpos, ypos)).rgb; } // Code for first pass - horizontal @@ -90,30 +88,22 @@ inline half3 pixel(texture2D tex, float xpos, float ypos) inline half3 getLine(float ypos, float4 xpos, half4 linetaps) { return - pixel(g_Texture, xpos.r, ypos) * linetaps.r + - pixel(g_Texture, xpos.g, ypos) * linetaps.g + - pixel(g_Texture, xpos.b, ypos) * linetaps.b + - pixel(g_Texture, xpos.a, ypos) * linetaps.a; + pixel(xpos.r, ypos) * linetaps.r + + pixel(xpos.g, ypos) * linetaps.g + + pixel(xpos.b, ypos) * linetaps.b + + pixel(xpos.a, ypos) * linetaps.a; } -float4 CONVOLUTION4x4Horiz(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION4x4Horiz(in float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY_P0 * 0.5; - float2 f = frac(pos / g_StepXY_P0); - + float2 f = frac(TextureUV / g_StepXY.xy + 0.5); half4 linetaps = weight(1.0 - f.x); // kernel generation code made sure taps add up to 1, no need to adjust here. + float xystart = (-1.0 - f.x) * g_StepXY.x + TextureUV.x; - float xystart = (-1.0 - f.x) * g_StepXY_P0.x + In.TextureUV.x; - - float4 xpos = float4( - xystart, - xystart + g_StepXY_P0.x, - xystart + g_StepXY_P0.x * 2.0, - xystart + g_StepXY_P0.x * 3.0); - - return float4(getLine(In.TextureUV.y, xpos, linetaps), 1.0f); + float4 xpos = xystart + g_StepXY.x * float4(0.0, 1.0, 2.0, 3.0); + return float4(getLine(TextureUV.y, xpos, linetaps), 1.0f); } // Code for second pass - vertical @@ -121,42 +111,34 @@ float4 CONVOLUTION4x4Horiz(VS_OUTPUT In) : SV_TARGET inline half3 getRow(float xpos, float4 ypos, half4 columntaps) { return - pixel(g_Texture, xpos, ypos.r) * columntaps.r + - pixel(g_Texture, xpos, ypos.g) * columntaps.g + - pixel(g_Texture, xpos, ypos.b) * columntaps.b + - pixel(g_Texture, xpos, ypos.a) * columntaps.a; + pixel(xpos, ypos.r) * columntaps.r + + pixel(xpos, ypos.g) * columntaps.g + + pixel(xpos, ypos.b) * columntaps.b + + pixel(xpos, ypos.a) * columntaps.a; } -float4 CONVOLUTION4x4Vert(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION4x4Vert(in float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY_P1 * 0.5; - float2 f = frac(pos / g_StepXY_P1); - + float2 f = frac(TextureUV / g_StepXY.zw + 0.5); half4 columntaps = weight(1.0 - f.y); // kernel generation code made sure taps add up to 1, no need to adjust here. + float xystart = (-1.0 - f.y) * g_StepXY.w + TextureUV.y; - float xystart = (-1.0 - f.y) * g_StepXY_P1.y + In.TextureUV.y; - - float4 ypos = float4( - xystart, - xystart + g_StepXY_P1.y, - xystart + g_StepXY_P1.y * 2.0, - xystart + g_StepXY_P1.y * 3.0); - - return float4(getRow(In.TextureUV.x, ypos, columntaps), 1.0f); + float4 ypos = xystart + g_StepXY.w * float4(0.0, 1.0, 2.0, 3.0); + return float4(getRow(TextureUV.x, ypos, columntaps), 1.0f); } -technique10 SCALER_T +technique11 SCALER_T { pass P0 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION4x4Horiz() ) ); } pass P1 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION4x4Vert() ) ); } diff --git a/system/shaders/convolutionsep-6x6_d3d.fx b/system/shaders/convolutionsep-6x6_d3d.fx index 9a5f27f8d3..bf31f31fc1 100644 --- a/system/shaders/convolutionsep-6x6_d3d.fx +++ b/system/shaders/convolutionsep-6x6_d3d.fx @@ -20,10 +20,8 @@ texture2D g_Texture; texture2D g_KernelTexture; -float2 g_StepXY_P0; -float2 g_StepXY_P1; -float g_viewportWidth; -float g_viewportHeight; +float4 g_StepXY; +float2 g_viewPort; SamplerState RGBSampler : IMMUTABLE { @@ -47,8 +45,8 @@ struct VS_INPUT struct VS_OUTPUT { - float4 Position : SV_POSITION; float2 TextureUV : TEXCOORD0; + float4 Position : SV_POSITION; }; // @@ -57,8 +55,8 @@ struct VS_OUTPUT VS_OUTPUT VS(VS_INPUT In) { VS_OUTPUT output = (VS_OUTPUT)0; - output.Position.x = (In.Position.x / (g_viewportWidth / 2.0)) - 1; - output.Position.y = -(In.Position.y / (g_viewportHeight / 2.0)) + 1; + output.Position.x = (In.Position.x / (g_viewPort.x / 2.0)) - 1; + output.Position.y = -(In.Position.y / (g_viewPort.y / 2.0)) + 1; output.Position.z = output.Position.z; output.Position.w = 1.0; output.TextureUV = In.TextureUV; @@ -80,45 +78,38 @@ inline half3 weight(float pos) return w; } -inline half3 pixel(texture2D tex, float xpos, float ypos) +inline half3 pixel(float xpos, float ypos) { - return tex.Sample(RGBSampler, float2(xpos, ypos)).rgb; + return g_Texture.Sample(RGBSampler, float2(xpos, ypos)).rgb; } half3 getLine(float ypos, float3 xpos1, float3 xpos2, half3 linetaps1, half3 linetaps2) { return - g_Texture.Sample(RGBSampler, float2(xpos1.r, ypos)).rgb * linetaps1.r + - g_Texture.Sample(RGBSampler, float2(xpos1.g, ypos)).rgb * linetaps2.r + - g_Texture.Sample(RGBSampler, float2(xpos1.b, ypos)).rgb * linetaps1.g + - g_Texture.Sample(RGBSampler, float2(xpos2.r, ypos)).rgb * linetaps2.g + - g_Texture.Sample(RGBSampler, float2(xpos2.g, ypos)).rgb * linetaps1.b + - g_Texture.Sample(RGBSampler, float2(xpos2.b, ypos)).rgb * linetaps2.b; + pixel(xpos1.r, ypos) * linetaps1.r + + pixel(xpos1.g, ypos) * linetaps2.r + + pixel(xpos1.b, ypos) * linetaps1.g + + pixel(xpos2.r, ypos) * linetaps2.g + + pixel(xpos2.g, ypos) * linetaps1.b + + pixel(xpos2.b, ypos) * linetaps2.b; } // Code for first pass - horizontal -float4 CONVOLUTION6x6Horiz(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION6x6Horiz(in float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY_P0 * 0.5; - float2 f = frac(pos / g_StepXY_P0); + float2 f = frac(TextureUV / g_StepXY.xy + 0.5); half3 linetaps1 = weight((1.0 - f.x) / 2.0); half3 linetaps2 = weight((1.0 - f.x) / 2.0 + 0.5); // kernel generation code made sure taps add up to 1, no need to adjust here. - float xstart = (-2.0 - f.x) * g_StepXY_P0.x + In.TextureUV.x; + float xstart = (-2.0 - f.x) * g_StepXY.x + TextureUV.x; - float3 xpos1 = float3( - xstart, - xstart + g_StepXY_P0.x, - xstart + g_StepXY_P0.x * 2.0); - float3 xpos2 = half3( - xstart + g_StepXY_P0.x * 3.0, - xstart + g_StepXY_P0.x * 4.0, - xstart + g_StepXY_P0.x * 5.0); + float3 xpos1 = xstart + g_StepXY.x * float3(0.0, 1.0, 2.0); + float3 xpos2 = xstart + g_StepXY.x * float3(3.0, 4.0, 5.0); - return float4(getLine(In.TextureUV.y, xpos1, xpos2, linetaps1, linetaps2), 1.0); + return float4(getLine(TextureUV.y, xpos1, xpos2, linetaps1, linetaps2), 1.0); } // Code for second pass - vertical @@ -126,48 +117,41 @@ float4 CONVOLUTION6x6Horiz(VS_OUTPUT In) : SV_TARGET half3 getRow(float xpos, float3 ypos1, float3 ypos2, half3 columntaps1, half3 columntaps2) { return - g_Texture.Sample(RGBSampler, float2(xpos, ypos1.r)).rgb * columntaps1.r + - g_Texture.Sample(RGBSampler, float2(xpos, ypos1.g)).rgb * columntaps2.r + - g_Texture.Sample(RGBSampler, float2(xpos, ypos1.b)).rgb * columntaps1.g + - g_Texture.Sample(RGBSampler, float2(xpos, ypos2.r)).rgb * columntaps2.g + - g_Texture.Sample(RGBSampler, float2(xpos, ypos2.g)).rgb * columntaps1.b + - g_Texture.Sample(RGBSampler, float2(xpos, ypos2.b)).rgb * columntaps2.b; + pixel(xpos, ypos1.r) * columntaps1.r + + pixel(xpos, ypos1.g) * columntaps2.r + + pixel(xpos, ypos1.b) * columntaps1.g + + pixel(xpos, ypos2.r) * columntaps2.g + + pixel(xpos, ypos2.g) * columntaps1.b + + pixel(xpos, ypos2.b) * columntaps2.b; } -float4 CONVOLUTION6x6Vert(VS_OUTPUT In) : SV_TARGET +float4 CONVOLUTION6x6Vert(in float2 TextureUV : TEXCOORD0) : SV_TARGET { - float2 pos = In.TextureUV + g_StepXY_P1 * 0.5; - float2 f = frac(pos / g_StepXY_P1); + float2 f = frac(TextureUV / g_StepXY.zw + 0.5); half3 columntaps1 = weight((1.0 - f.y) / 2.0); half3 columntaps2 = weight((1.0 - f.y) / 2.0 + 0.5); // kernel generation code made sure taps add up to 1, no need to adjust here. - float ystart = (-2.0 - f.y) * g_StepXY_P1.y + In.TextureUV.y; + float ystart = (-2.0 - f.y) * g_StepXY.w + TextureUV.y; - float3 ypos1 = float3( - ystart, - ystart + g_StepXY_P1.y, - ystart + g_StepXY_P1.y * 2.0); - float3 ypos2 = half3( - ystart + g_StepXY_P1.y * 3.0, - ystart + g_StepXY_P1.y * 4.0, - ystart + g_StepXY_P1.y * 5.0); + float3 ypos1 = ystart + g_StepXY.w * float3(0.0, 1.0, 2.0); + float3 ypos2 = ystart + g_StepXY.w * float3(3.0, 4.0, 5.0); - return float4(getRow(In.TextureUV.x, ypos1, ypos2, columntaps1, columntaps2), 1.0); + return float4(getRow(TextureUV.x, ypos1, ypos2, columntaps1, columntaps2), 1.0); } -technique10 SCALER_T +technique11 SCALER_T { pass P0 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION6x6Horiz() ) ); } pass P1 { - SetVertexShader( CompileShader( vs_4_0_level_9_3, VS() ) ); + SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); SetPixelShader( CompileShader( ps_4_0_level_9_3, CONVOLUTION6x6Vert() ) ); } }; diff --git a/system/shaders/testshader.fx b/system/shaders/testshader.fx index ffe46ad5d0..8c41ee7edf 100644 --- a/system/shaders/testshader.fx +++ b/system/shaders/testshader.fx @@ -18,15 +18,15 @@ * */ -float4 TEST() : COLOR +float4 TEST() : SV_TARGET { return float4(0.0, 0.0, 0.0, 0.0); } -technique TEST_T +technique11 TEST_T { pass P0 { - PixelShader = compile ps_2_0 TEST(); + SetPixelShader( CompileShader( ps_4_0_level_9_3, TEST() ) ); } }; diff --git a/system/shaders/yuv2rgb_d3d.fx b/system/shaders/yuv2rgb_d3d.fx index 7621c60b7e..6fb9cf3829 100644 --- a/system/shaders/yuv2rgb_d3d.fx +++ b/system/shaders/yuv2rgb_d3d.fx @@ -23,8 +23,7 @@ texture2D g_UTexture; texture2D g_VTexture; float4x4 g_ColorMatrix; float2 g_StepXY; -float g_viewportWidth; -float g_viewportHeight; +float2 g_viewPort; SamplerState YUVSampler : IMMUTABLE @@ -52,17 +51,17 @@ struct VS_INPUT struct VS_OUTPUT { - float4 Position : SV_POSITION; float2 TextureY : TEXCOORD0; float2 TextureU : TEXCOORD1; float2 TextureV : TEXCOORD2; + float4 Position : SV_POSITION; }; VS_OUTPUT VS(VS_INPUT In) { VS_OUTPUT output = (VS_OUTPUT)0; - output.Position.x = (In.Position.x / (g_viewportWidth / 2.0)) - 1; - output.Position.y = -(In.Position.y / (g_viewportHeight / 2.0)) + 1; + output.Position.x = (In.Position.x / (g_viewPort.x / 2.0)) - 1; + output.Position.y = -(In.Position.y / (g_viewPort.y / 2.0)) + 1; output.Position.z = output.Position.z; output.Position.w = 1.0; output.TextureY = In.TextureY; @@ -132,12 +131,11 @@ float4 YUV2RGB(VS_OUTPUT In) : SV_TARGET return float4(mul(YUV, g_ColorMatrix).rgb, 1.0); } -technique10 YUV2RGB_T +technique11 YUV2RGB_T { pass P0 { SetVertexShader( CompileShader( vs_4_0_level_9_1, VS() ) ); - SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0_level_9_1, YUV2RGB() ) ); } }; |