diff options
Diffstat (limited to 'hlsl/downsample.fx')
-rw-r--r-- | hlsl/downsample.fx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx index 9ac584b56f1..122172350f9 100644 --- a/hlsl/downsample.fx +++ b/hlsl/downsample.fx @@ -35,7 +35,7 @@ struct VS_OUTPUT struct VS_INPUT { - float3 Position : POSITION; + float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; }; @@ -53,6 +53,7 @@ struct PS_INPUT uniform float2 ScreenDims; uniform float2 TargetDims; +uniform float2 SourceRect; uniform bool PrepareVector; @@ -72,7 +73,7 @@ VS_OUTPUT vs_main(VS_INPUT Input) float2 TexCoord = Input.Position.xy / ScreenDims; TexCoord += PrepareVector - ? 0.5f / TargetDims // half texel offset correction (DX9) + ? 0.5f / TargetDims // half texel offset correction (DX9) - only for vector grpahics : 0.0f; Output.TexCoord01.xy = TexCoord + float2(-0.5f, -0.5f) * TargetTexelDims; @@ -89,14 +90,14 @@ VS_OUTPUT vs_main(VS_INPUT Input) float4 ps_main(PS_INPUT Input) : COLOR { - float4 texel0 = tex2D(DiffuseSampler, Input.TexCoord01.xy); - float4 texel1 = tex2D(DiffuseSampler, Input.TexCoord01.zw); - float4 texel2 = tex2D(DiffuseSampler, Input.TexCoord23.xy); - float4 texel3 = tex2D(DiffuseSampler, Input.TexCoord23.zw); + float3 texel0 = tex2D(DiffuseSampler, Input.TexCoord01.xy).rgb; + float3 texel1 = tex2D(DiffuseSampler, Input.TexCoord01.zw).rgb; + float3 texel2 = tex2D(DiffuseSampler, Input.TexCoord23.xy).rgb; + float3 texel3 = tex2D(DiffuseSampler, Input.TexCoord23.zw).rgb; - float4 outTexel = (texel0 + texel1 + texel2 + texel3) / 4.0; + float3 outTexel = (texel0 + texel1 + texel2 + texel3) / 4.0; - return float4(outTexel.rgb, 1.0f); + return float4(outTexel, 1.0f); } //----------------------------------------------------------------------------- |