64 lines
2.2 KiB
PostScript
64 lines
2.2 KiB
PostScript
|
#include "common.h"
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||
|
float4 weight[2];
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||
|
// Pixel
|
||
|
// Separable gauss filter: 2*7 + 1 + 7*2 = 29 samples
|
||
|
// Samples: 0-central, -1, -2,..., -7, 1, 2,... 7
|
||
|
// Approximated i-count: 15t + 15a + 7a(d) + 1(out) = 38, HLSL compiled to 38 :)
|
||
|
float4 main ( p_filter I ) : SV_Target
|
||
|
{
|
||
|
|
||
|
float4 ratio = float2( 1/screen_res.x,1/screen_res.y).xyxy;
|
||
|
|
||
|
ratio.x = 1;
|
||
|
//ratio.y = 1.77;
|
||
|
//ratio.y = 0.5625;
|
||
|
ratio.y = screen_res.x/screen_res.y;
|
||
|
//ratio.xyzw = ratio.xyxy;
|
||
|
ratio.xyzw = ratio.xyyx;
|
||
|
|
||
|
float4 UVavg = I.Tex0.xyyx;
|
||
|
|
||
|
//adjust for aspect ratio
|
||
|
I.Tex0 = UVavg + ((I.Tex0 - UVavg) * ratio);
|
||
|
I.Tex1 = UVavg + ((I.Tex1 - UVavg) * ratio);
|
||
|
I.Tex2 = UVavg + ((I.Tex2 - UVavg) * ratio);
|
||
|
I.Tex3 = UVavg + ((I.Tex3 - UVavg) * ratio);
|
||
|
I.Tex4 = UVavg + ((I.Tex4 - UVavg) * ratio);
|
||
|
I.Tex5 = UVavg + ((I.Tex5 - UVavg) * ratio);
|
||
|
I.Tex6 = UVavg + ((I.Tex6 - UVavg) * ratio);
|
||
|
I.Tex7 = UVavg + ((I.Tex7 - UVavg) * ratio);
|
||
|
|
||
|
// central
|
||
|
float4 accum = weight[1].w * s_bloom.Sample(smp_rtlinear, I.Tex0);
|
||
|
|
||
|
// left (7)
|
||
|
// right (7) - no swizles on 'texld', so this is dep-read infact
|
||
|
accum += weight[0].x * s_bloom.Sample(smp_rtlinear, I.Tex1.xy);
|
||
|
accum += weight[0].x * s_bloom.Sample(smp_rtlinear, I.Tex1.wz);
|
||
|
|
||
|
accum += weight[0].y * s_bloom.Sample(smp_rtlinear, I.Tex2.xy);
|
||
|
accum += weight[0].y * s_bloom.Sample(smp_rtlinear, I.Tex2.wz);
|
||
|
|
||
|
accum += weight[0].z * s_bloom.Sample(smp_rtlinear, I.Tex3.xy);
|
||
|
accum += weight[0].z * s_bloom.Sample(smp_rtlinear, I.Tex3.wz);
|
||
|
|
||
|
accum += weight[0].w * s_bloom.Sample(smp_rtlinear, I.Tex4.xy);
|
||
|
accum += weight[0].w * s_bloom.Sample(smp_rtlinear, I.Tex4.wz);
|
||
|
|
||
|
accum += weight[1].x * s_bloom.Sample(smp_rtlinear, I.Tex5.xy);
|
||
|
accum += weight[1].x * s_bloom.Sample(smp_rtlinear, I.Tex5.wz);
|
||
|
|
||
|
accum += weight[1].y * s_bloom.Sample(smp_rtlinear, I.Tex6.xy);
|
||
|
accum += weight[1].y * s_bloom.Sample(smp_rtlinear, I.Tex6.wz);
|
||
|
|
||
|
accum += weight[1].z * s_bloom.Sample(smp_rtlinear, I.Tex7.xy);
|
||
|
accum += weight[1].z * s_bloom.Sample(smp_rtlinear, I.Tex7.wz);
|
||
|
|
||
|
// OK
|
||
|
return accum;
|
||
|
}
|