Cocoa Port: Do a quick-and-dirty attempt at fixing an issue with some output filters when using Metal display views. (Related to #476.)

This commit is contained in:
rogerman 2022-05-10 04:10:24 -07:00
parent 0f6cbffe77
commit 5647303305
2 changed files with 170 additions and 97 deletions

View File

@ -1154,12 +1154,14 @@
break;
case OutputFilterTypeID_BicubicBSpline:
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
[outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_bicubic_bspline"]];
//[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]];
[outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_bicubic_bspline_fast"]];
break;
case OutputFilterTypeID_BicubicMitchell:
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
//[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]];
[outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_bicubic_mitchell_netravali"]];
break;
@ -1169,7 +1171,8 @@
break;
case OutputFilterTypeID_Lanczos3:
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
//[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_bicubic_vertex"]];
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]];
[outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_lanczos3"]];
break;

View File

@ -43,6 +43,27 @@ struct DisplayVtx
float2 texCoord;
};
struct DisplayVtxTex16
{
float4 position [[position]];
float2 texCoord0;
float2 texCoord1;
float2 texCoord2;
float2 texCoord3;
float2 texCoord4;
float2 texCoord5;
float2 texCoord6;
float2 texCoord7;
float2 texCoord8;
float2 texCoord9;
float2 texCoord10;
float2 texCoord11;
float2 texCoord12;
float2 texCoord13;
float2 texCoord14;
float2 texCoord15;
};
struct DisplayViewShaderProperties
{
float width;
@ -207,7 +228,7 @@ vertex DisplayVtx display_output_vertex(const device float2 *inPosition [[buffer
return outVtx;
}
vertex DisplayVtx display_output_bicubic_vertex(const device float2 *inPosition [[buffer(0)]],
vertex DisplayVtxTex16 display_output_bicubic_vertex(const device float2 *inPosition [[buffer(0)]],
const device float2 *inTexCoord [[buffer(1)]],
const constant DisplayViewShaderProperties &viewProps [[buffer(2)]],
const constant uint8_t &doYFlip [[buffer(3)]],
@ -226,9 +247,30 @@ vertex DisplayVtx display_output_bicubic_vertex(const device float2 *inPosition
const float2 yFlip = (doYFlip != 0) ? float2(1.0f, -1.0f) : float2(1.0f, 1.0f);
DisplayVtx outVtx;
DisplayVtxTex16 outVtx;
outVtx.position = float4(projection * rotation * scale * inPosition[vid] * yFlip, 0.0f, 1.0f);
outVtx.texCoord = floor(inTexCoord[vid] - 0.5f) + 0.5f;
float2 xystart = floor(inTexCoord[vid] - 0.5f) + 0.5f;
outVtx.texCoord6 = xystart + float2(-1.0,-1.0);
outVtx.texCoord7 = xystart + float2( 0.0,-1.0);
outVtx.texCoord8 = xystart + float2( 1.0,-1.0);
outVtx.texCoord9 = xystart + float2( 2.0,-1.0);
outVtx.texCoord5 = xystart + float2(-1.0, 0.0);
outVtx.texCoord0 = xystart + float2( 0.0, 0.0); // Center pixel
outVtx.texCoord1 = xystart + float2( 1.0, 0.0);
outVtx.texCoord10 = xystart + float2( 2.0, 0.0);
outVtx.texCoord4 = xystart + float2(-1.0, 1.0);
outVtx.texCoord3 = xystart + float2( 0.0, 1.0);
outVtx.texCoord2 = xystart + float2( 1.0, 1.0);
outVtx.texCoord11 = xystart + float2( 2.0, 1.0);
outVtx.texCoord15 = xystart + float2(-1.0, 2.0);
outVtx.texCoord14 = xystart + float2( 0.0, 2.0);
outVtx.texCoord13 = xystart + float2( 1.0, 2.0);
outVtx.texCoord12 = xystart + float2( 2.0, 2.0);
return outVtx;
}
@ -257,11 +299,11 @@ fragment float4 output_filter_bilinear(const DisplayVtx vtx [[stage_in]],
// 04|05|06|07
// 08|09|10|11
// 12|13|14|15
fragment float4 output_filter_bicubic_bspline(const DisplayVtx vtx [[stage_in]],
fragment float4 output_filter_bicubic_bspline(const DisplayVtxTex16 vtx [[stage_in]],
const texture2d<float> tex [[texture(0)]],
const device float *inBacklightIntensity [[buffer(0)]])
{
float2 f = fract(vtx.texCoord);
float2 f = fract(vtx.texCoord0);
float4 wx = bicubic_weight_bspline(f.x);
float4 wy = bicubic_weight_bspline(f.y);
@ -269,22 +311,48 @@ fragment float4 output_filter_bicubic_bspline(const DisplayVtx vtx [[stage_in]],
wx /= dot(wx, float4(1.0f));
wy /= dot(wy, float4(1.0f));
float4 outFragment = (tex.sample(genSampler, vtx.texCoord, int2(-1,-1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0,-1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1,-1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2,-1)) * wx.a) * wy.r
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 0)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 0)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 0)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 0)) * wx.a) * wy.g
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 1)) * wx.a) * wy.b
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 2)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 2)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 2)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 2)) * wx.a) * wy.a;
float4 outFragment = (tex.sample(genSampler, vtx.texCoord6) * wx.r
+ tex.sample(genSampler, vtx.texCoord7) * wx.g
+ tex.sample(genSampler, vtx.texCoord8) * wx.b
+ tex.sample(genSampler, vtx.texCoord9) * wx.a) * wy.r
+ (tex.sample(genSampler, vtx.texCoord5) * wx.r
+ tex.sample(genSampler, vtx.texCoord0) * wx.g
+ tex.sample(genSampler, vtx.texCoord1) * wx.b
+ tex.sample(genSampler, vtx.texCoord10) * wx.a) * wy.g
+ (tex.sample(genSampler, vtx.texCoord4) * wx.r
+ tex.sample(genSampler, vtx.texCoord3) * wx.g
+ tex.sample(genSampler, vtx.texCoord2) * wx.b
+ tex.sample(genSampler, vtx.texCoord11) * wx.a) * wy.b
+ (tex.sample(genSampler, vtx.texCoord15) * wx.r
+ tex.sample(genSampler, vtx.texCoord14) * wx.g
+ tex.sample(genSampler, vtx.texCoord13) * wx.b
+ tex.sample(genSampler, vtx.texCoord12) * wx.a) * wy.a;
return float4(outFragment.rgb * *inBacklightIntensity, 1.0f);
}
fragment float4 output_filter_bicubic_bspline_fast(const DisplayVtx vtx [[stage_in]],
const texture2d<float> tex [[texture(0)]],
const device float *inBacklightIntensity [[buffer(0)]])
{
float2 texCenterPosition = floor(vtx.texCoord - 0.5f) + 0.5f;
float2 f = abs(vtx.texCoord - texCenterPosition);
float2 w0 = ((1.0f-f)*(1.0f-f)*(1.0f-f)) / 6.0f;
float2 w1 = (4.0f - 6.0f*f*f + 3.0f*f*f*f) / 6.0f;
float2 w3 = f*f*f / 6.0f;
float2 w2 = 1.0f - w0 - w1 - w3;
float2 s0 = w0 + w1;
float2 s1 = w2 + w3;
float2 t0 = texCenterPosition - 1.0f + (w1 / s0);
float2 t1 = texCenterPosition + 1.0f + (w3 / s1);
float4 outFragment = (tex.sample(genSampler, float2(t0.x, t0.y)) * s0.x +
tex.sample(genSampler, float2(t1.x, t0.y)) * s1.x) * s0.y +
(tex.sample(genSampler, float2(t0.x, t1.y)) * s0.x +
tex.sample(genSampler, float2(t1.x, t1.y)) * s1.x) * s1.y;
return float4(outFragment.rgb * *inBacklightIntensity, 1.0f);
}
@ -298,7 +366,8 @@ fragment float4 output_filter_bicubic_mitchell_netravali(const DisplayVtx vtx [[
const texture2d<float> tex [[texture(0)]],
const device float *inBacklightIntensity [[buffer(0)]])
{
float2 f = fract(vtx.texCoord);
float2 texCenterPosition = floor(vtx.texCoord - 0.5f) + 0.5f;
float2 f = fract(texCenterPosition);
float4 wx = bicubic_weight_mitchell_netravali(f.x);
float4 wy = bicubic_weight_mitchell_netravali(f.y);
@ -306,22 +375,22 @@ fragment float4 output_filter_bicubic_mitchell_netravali(const DisplayVtx vtx [[
wx /= dot(wx, float4(1.0f));
wy /= dot(wy, float4(1.0f));
float4 outFragment = (tex.sample(genSampler, vtx.texCoord, int2(-1,-1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0,-1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1,-1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2,-1)) * wx.a) * wy.r
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 0)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 0)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 0)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 0)) * wx.a) * wy.g
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 1)) * wx.a) * wy.b
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 2)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 2)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 2)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 2)) * wx.a) * wy.a;
float4 outFragment = (tex.sample(genSampler, texCenterPosition, int2(-1,-1)) * wx.r
+ tex.sample(genSampler, texCenterPosition, int2( 0,-1)) * wx.g
+ tex.sample(genSampler, texCenterPosition, int2( 1,-1)) * wx.b
+ tex.sample(genSampler, texCenterPosition, int2( 2,-1)) * wx.a) * wy.r
+ (tex.sample(genSampler, texCenterPosition, int2(-1, 0)) * wx.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 0)) * wx.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 0)) * wx.b
+ tex.sample(genSampler, texCenterPosition, int2( 2, 0)) * wx.a) * wy.g
+ (tex.sample(genSampler, texCenterPosition, int2(-1, 1)) * wx.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 1)) * wx.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 1)) * wx.b
+ tex.sample(genSampler, texCenterPosition, int2( 2, 1)) * wx.a) * wy.b
+ (tex.sample(genSampler, texCenterPosition, int2(-1, 2)) * wx.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 2)) * wx.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 2)) * wx.b
+ tex.sample(genSampler, texCenterPosition, int2( 2, 2)) * wx.a) * wy.a;
return float4(outFragment.rgb * *inBacklightIntensity, 1.0f);
}
@ -331,11 +400,11 @@ fragment float4 output_filter_bicubic_mitchell_netravali(const DisplayVtx vtx [[
// 04|05|06|07
// 08|09|10|11
// 12|13|14|15
fragment float4 output_filter_lanczos2(const DisplayVtx vtx [[stage_in]],
fragment float4 output_filter_lanczos2(const DisplayVtxTex16 vtx [[stage_in]],
const texture2d<float> tex [[texture(0)]],
const device float *inBacklightIntensity [[buffer(0)]])
{
const float2 f = fract(vtx.texCoord);
const float2 f = fract(vtx.texCoord0);
float4 wx = bicubic_weight_lanczos2(f.x);
float4 wy = bicubic_weight_lanczos2(f.y);
@ -343,22 +412,22 @@ fragment float4 output_filter_lanczos2(const DisplayVtx vtx [[stage_in]],
wx /= dot(wx, float4(1.0f));
wy /= dot(wy, float4(1.0f));
const float4 outFragment = (tex.sample(genSampler, vtx.texCoord, int2(-1,-1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0,-1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1,-1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2,-1)) * wx.a) * wy.r
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 0)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 0)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 0)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 0)) * wx.a) * wy.g
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 1)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 1)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 1)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 1)) * wx.a) * wy.b
+ (tex.sample(genSampler, vtx.texCoord, int2(-1, 2)) * wx.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 2)) * wx.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 2)) * wx.b
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 2)) * wx.a) * wy.a;
const float4 outFragment = (tex.sample(genSampler, vtx.texCoord6) * wx.r
+ tex.sample(genSampler, vtx.texCoord7) * wx.g
+ tex.sample(genSampler, vtx.texCoord8) * wx.b
+ tex.sample(genSampler, vtx.texCoord9) * wx.a) * wy.r
+ (tex.sample(genSampler, vtx.texCoord5) * wx.r
+ tex.sample(genSampler, vtx.texCoord0) * wx.g
+ tex.sample(genSampler, vtx.texCoord1) * wx.b
+ tex.sample(genSampler, vtx.texCoord10) * wx.a) * wy.g
+ (tex.sample(genSampler, vtx.texCoord4) * wx.r
+ tex.sample(genSampler, vtx.texCoord3) * wx.g
+ tex.sample(genSampler, vtx.texCoord2) * wx.b
+ tex.sample(genSampler, vtx.texCoord11) * wx.a) * wy.b
+ (tex.sample(genSampler, vtx.texCoord15) * wx.r
+ tex.sample(genSampler, vtx.texCoord14) * wx.g
+ tex.sample(genSampler, vtx.texCoord13) * wx.b
+ tex.sample(genSampler, vtx.texCoord12) * wx.a) * wy.a;
return float4(outFragment.rgb * *inBacklightIntensity, 1.0f);
}
@ -374,7 +443,8 @@ fragment float4 output_filter_lanczos3(const DisplayVtx vtx [[stage_in]],
const texture2d<float> tex [[texture(0)]],
const device float *inBacklightIntensity [[buffer(0)]])
{
const float2 f = fract(vtx.texCoord);
float2 texCenterPosition = vtx.texCoord - 0.5f;
const float2 f = fract(texCenterPosition);
float3 wx1 = bicubic_weight_lanczos3(0.5f - f.x * 0.5f);
float3 wx2 = bicubic_weight_lanczos3(1.0f - f.x * 0.5f);
float3 wy1 = bicubic_weight_lanczos3(0.5f - f.y * 0.5f);
@ -388,42 +458,42 @@ fragment float4 output_filter_lanczos3(const DisplayVtx vtx [[stage_in]],
wy1 /= sumY;
wy2 /= sumY;
const float4 outFragment = (tex.sample(genSampler, vtx.texCoord, int2(-2,-2)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1,-2)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0,-2)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1,-2)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2,-2)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3,-2)) * wx2.b) * wy1.r
+ (tex.sample(genSampler, vtx.texCoord, int2(-2,-1)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1,-1)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0,-1)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1,-1)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2,-1)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3,-1)) * wx2.b) * wy2.r
+ (tex.sample(genSampler, vtx.texCoord, int2(-2, 0)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1, 0)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 0)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 0)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 0)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3, 0)) * wx2.b) * wy1.g
+ (tex.sample(genSampler, vtx.texCoord, int2(-2, 1)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1, 1)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 1)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 1)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 1)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3, 1)) * wx2.b) * wy2.g
+ (tex.sample(genSampler, vtx.texCoord, int2(-2, 2)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1, 2)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 2)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 2)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 2)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3, 2)) * wx2.b) * wy1.b
+ (tex.sample(genSampler, vtx.texCoord, int2(-2, 3)) * wx1.r
+ tex.sample(genSampler, vtx.texCoord, int2(-1, 3)) * wx2.r
+ tex.sample(genSampler, vtx.texCoord, int2( 0, 3)) * wx1.g
+ tex.sample(genSampler, vtx.texCoord, int2( 1, 3)) * wx2.g
+ tex.sample(genSampler, vtx.texCoord, int2( 2, 3)) * wx1.b
+ tex.sample(genSampler, vtx.texCoord, int2( 3, 3)) * wx2.b) * wy2.b;
const float4 outFragment = (tex.sample(genSampler, texCenterPosition, int2(-2,-2)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1,-2)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0,-2)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1,-2)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2,-2)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3,-2)) * wx2.b) * wy1.r
+ (tex.sample(genSampler, texCenterPosition, int2(-2,-1)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1,-1)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0,-1)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1,-1)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2,-1)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3,-1)) * wx2.b) * wy2.r
+ (tex.sample(genSampler, texCenterPosition, int2(-2, 0)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1, 0)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 0)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 0)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2, 0)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3, 0)) * wx2.b) * wy1.g
+ (tex.sample(genSampler, texCenterPosition, int2(-2, 1)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1, 1)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 1)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 1)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2, 1)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3, 1)) * wx2.b) * wy2.g
+ (tex.sample(genSampler, texCenterPosition, int2(-2, 2)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1, 2)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 2)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 2)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2, 2)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3, 2)) * wx2.b) * wy1.b
+ (tex.sample(genSampler, texCenterPosition, int2(-2, 3)) * wx1.r
+ tex.sample(genSampler, texCenterPosition, int2(-1, 3)) * wx2.r
+ tex.sample(genSampler, texCenterPosition, int2( 0, 3)) * wx1.g
+ tex.sample(genSampler, texCenterPosition, int2( 1, 3)) * wx2.g
+ tex.sample(genSampler, texCenterPosition, int2( 2, 3)) * wx1.b
+ tex.sample(genSampler, texCenterPosition, int2( 3, 3)) * wx2.b) * wy2.b;
return float4(outFragment.rgb * *inBacklightIntensity, 1.0f);
}