0001:
0002:
0003:
0004:
0005:
0006:
0007:
0008:
0009:
0010: sampler SrcSamp : register(s0);
0011:
0012: float2 vSize;
0013: float2 d2u;
0014:
0015:
0016:
0017:
0018: struct VS_OUTPUT
0019: {
0020: float4 Pos : POSITION;
0021: float2 Tex0 : TEXCOORD0;
0022: float2 Tex1 : TEXCOORD1;
0023: float2 Tex2 : TEXCOORD2;
0024: float2 Tex3 : TEXCOORD3;
0025: float2 Tex4 : TEXCOORD4;
0026: float2 Tex5 : TEXCOORD5;
0027: float2 Tex6 : TEXCOORD6;
0028: float2 Tex7 : TEXCOORD7;
0029: };
0030:
0031:
0032:
0033:
0034: float4 PS (VS_OUTPUT In) : COLOR
0035: {
0036: #if 0
0037:
0038: const float4 w3 = float4(-0.5, 1.5,-1.5, 0.5);
0039: const float4 w2 = float4( 1.0,-2.5, 2.0,-0.5);
0040: const float4 w1 = float4(-0.5, 0.0, 0.5, 0.0);
0041: const float4 w0 = float4( 0.0, 1.0, 0.0, 0.0);
0042: #else
0043: const float4 w3 = float4(-1, 1,-1, 1);
0044: const float4 w2 = float4( 2,-2, 1,-1);
0045: const float4 w1 = float4(-1, 0, 1, 0);
0046: const float4 w0 = float4( 0, 1, 0, 0);
0047: #endif
0048:
0049: float2 fUV = frac (In.Tex5 * vSize);
0050: float2 fUV2 = fUV * fUV;
0051: float2 fUV3 = fUV * fUV2;
0052: float4 u, v;
0053: u = fUV3.x * w3 + fUV2.x * w2 + fUV.x * w1 + w0;
0054: v = fUV3.y * w3 + fUV2.y * w2 + fUV.y * w1 + w0;
0055:
0056:
0057: float4 col00 = tex2D( SrcSamp, In.Tex0 );
0058: float4 col01 = tex2D( SrcSamp, In.Tex1 );
0059: float4 col02 = tex2D( SrcSamp, In.Tex2 );
0060: float4 col03 = tex2D( SrcSamp, In.Tex3 );
0061:
0062: float4 col10 = tex2D( SrcSamp, In.Tex4 );
0063: float4 col11 = tex2D( SrcSamp, In.Tex5 );
0064: float4 col12 = tex2D( SrcSamp, In.Tex6 );
0065: float4 col13 = tex2D( SrcSamp, In.Tex7 );
0066:
0067: float4 col20 = tex2D( SrcSamp, In.Tex0 + d2u );
0068: float4 col21 = tex2D( SrcSamp, In.Tex1 + d2u );
0069: float4 col22 = tex2D( SrcSamp, In.Tex2 + d2u );
0070: float4 col23 = tex2D( SrcSamp, In.Tex3 + d2u );
0071:
0072: float4 col30 = tex2D( SrcSamp, In.Tex4 + d2u );
0073: float4 col31 = tex2D( SrcSamp, In.Tex5 + d2u );
0074: float4 col32 = tex2D( SrcSamp, In.Tex6 + d2u );
0075: float4 col33 = tex2D( SrcSamp, In.Tex7 + d2u );
0076:
0077:
0078: float4 col0 = u.x * col00 + u.y * col10 + u.z * col20 + u.w * col30;
0079: float4 col1 = u.x * col01 + u.y * col11 + u.z * col21 + u.w * col31;
0080: float4 col2 = u.x * col02 + u.y * col12 + u.z * col22 + u.w * col32;
0081: float4 col3 = u.x * col03 + u.y * col13 + u.z * col23 + u.w * col33;
0082:
0083: return v.x * col0 + v.y * col1 + v.z * col2 + v.w * col3;
0084: }
0085:
0086:
0087:
0088: technique TShader
0089: {
0090: pass P0
0091: {
0092:
0093: PixelShader = compile ps_2_0 PS();
0094: }
0095: }
0096: