summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/bloom.fx88
-rw-r--r--hlsl/color.fx10
-rw-r--r--hlsl/deconverge.fx72
-rw-r--r--hlsl/downsample.fx30
-rw-r--r--hlsl/focus.fx2
-rw-r--r--hlsl/phosphor.fx4
-rw-r--r--hlsl/post.fx23
-rw-r--r--hlsl/prescale.fx22
-rw-r--r--hlsl/yiq_decode.fx19
-rw-r--r--hlsl/yiq_encode.fx28
10 files changed, 146 insertions, 152 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index cf8b603cece..aa856118e1b 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -124,7 +124,7 @@ sampler DiffuseSampler9 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler10 = sampler_state
+sampler DiffuseSamplerA = sampler_state
{
Texture = <DiffuseK>;
MipFilter = LINEAR;
@@ -143,7 +143,12 @@ struct VS_OUTPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 TexCoord01 : TEXCOORD0;
+ float4 TexCoord23 : TEXCOORD1;
+ float4 TexCoord45 : TEXCOORD2;
+ float4 TexCoord67 : TEXCOORD3;
+ float4 TexCoord89 : TEXCOORD4;
+ float2 TexCoordA : TEXCOORD5;
};
struct VS_INPUT
@@ -156,7 +161,12 @@ struct VS_INPUT
struct PS_INPUT
{
float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 TexCoord01 : TEXCOORD0;
+ float4 TexCoord23 : TEXCOORD1;
+ float4 TexCoord45 : TEXCOORD2;
+ float4 TexCoord67 : TEXCOORD3;
+ float4 TexCoord89 : TEXCOORD4;
+ float2 TexCoordA : TEXCOORD5;
};
//-----------------------------------------------------------------------------
@@ -164,18 +174,7 @@ struct PS_INPUT
//-----------------------------------------------------------------------------
uniform float2 TargetSize;
-
-uniform float DiffuseScaleA;
-uniform float DiffuseScaleB;
-uniform float DiffuseScaleC;
-uniform float DiffuseScaleD;
-uniform float DiffuseScaleE;
-uniform float DiffuseScaleF;
-uniform float DiffuseScaleG;
-uniform float DiffuseScaleH;
-uniform float DiffuseScaleI;
-uniform float DiffuseScaleJ;
-uniform float DiffuseScaleK;
+uniform float2 SourceSize;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -188,7 +187,18 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.xy *= float2(2.0f, 2.0f);
Output.Color = Input.Color;
float2 inversePixel = 1.0f / TargetSize;
- Output.TexCoord = Input.Position.xy * inversePixel;
+ float2 TexCoord = Input.Position.xy * inversePixel + float2(0.5f, 0.5f) * inversePixel;
+ Output.TexCoord01.xy = TexCoord;
+ Output.TexCoord01.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.5f;
+ Output.TexCoord23.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.25f;
+ Output.TexCoord23.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.125f;
+ Output.TexCoord45.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0625f;
+ Output.TexCoord45.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.03125f;
+ Output.TexCoord67.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.015625f;
+ Output.TexCoord67.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0078125f;
+ Output.TexCoord89.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.00390625f;
+ Output.TexCoord89.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.001953125f;
+ Output.TexCoordA = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0009765625f;
return Output;
}
@@ -197,21 +207,39 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Bloom Pixel Shader
//-----------------------------------------------------------------------------
+uniform float4 Level0123Weight;
+uniform float4 Level4567Weight;
+uniform float3 Level89AWeight;
+
float4 ps_main(PS_INPUT Input) : COLOR
{
- float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb * DiffuseScaleA * 1.00f;
- float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb * DiffuseScaleB * 0.95f;
- float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb * DiffuseScaleC * 0.85f;
- float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb * DiffuseScaleD * 0.75f;
- float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb * DiffuseScaleE * 0.65f;
- float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb * DiffuseScaleF * 0.55f;
- float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb * DiffuseScaleG * 0.45f;
- float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb * DiffuseScaleH * 0.35f;
- float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb * DiffuseScaleI * 0.25f;
- float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb * DiffuseScaleJ * 0.15f;
- float3 texel10 = tex2D(DiffuseSampler10, Input.TexCoord).rgb * DiffuseScaleK * 0.10f;
- return float4(texel0 + texel1 + texel2 + texel3 + texel4 +
- texel5 + texel6 + texel7 + texel8 + texel9 + texel10, 1.0f);
+ float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord01.xy).rgb;
+ float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord01.zw).rgb;
+ float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord23.xy).rgb;
+ float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord23.zw).rgb;
+ float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord45.xy).rgb;
+ float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord45.zw).rgb;
+ float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord67.xy).rgb;
+ float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord67.zw).rgb;
+ float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord89.xy).rgb;
+ float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord89.zw).rgb;
+ float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoordA).rgb;
+
+ texel0 = texel0 * Level0123Weight.x; // 1.0f;
+ texel1 = texel1 * Level0123Weight.y; // 0.21f;
+ texel2 = texel2 * Level0123Weight.z; // 0.19f;
+ texel3 = texel3 * Level0123Weight.w; // 0.17f;
+ texel4 = texel4 * Level4567Weight.x; // 0.15f;
+ texel5 = texel5 * Level4567Weight.y; // 0.14f;
+ texel6 = texel6 * Level4567Weight.z; // 0.13f;
+ texel7 = texel7 * Level4567Weight.w; // 0.12f;
+ texel8 = texel8 * Level89AWeight.x; // 0.11f;
+ texel9 = texel9 * Level89AWeight.y; // 0.10f;
+ texelA = texelA * Level89AWeight.z; // 0.09f;
+
+ float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
+ texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
+ return sum;
}
//-----------------------------------------------------------------------------
@@ -234,7 +262,7 @@ technique TestTechnique
Sampler[7] = <DiffuseSampler7>; // 16x16
Sampler[8] = <DiffuseSampler8>; // 8x8
Sampler[9] = <DiffuseSampler9>; // 4x4
- Sampler[10] = <DiffuseSampler10>; // 2x2
+ Sampler[10] = <DiffuseSamplerA>; // 2x2
VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
diff --git a/hlsl/color.fx b/hlsl/color.fx
index 5e62dbd6d9f..e22bd17634b 100644
--- a/hlsl/color.fx
+++ b/hlsl/color.fx
@@ -46,11 +46,7 @@ struct PS_INPUT
uniform float TargetWidth;
uniform float TargetHeight;
-uniform float RawWidth;
-uniform float RawHeight;
-
-uniform float WidthRatio;
-uniform float HeightRatio;
+uniform float2 RawDims;
uniform float YIQEnable;
@@ -58,7 +54,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
- float2 invDims = float2(1.0f / RawWidth, 1.0f / RawHeight);
+ float2 invDims = 1.0f / RawDims;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight;
@@ -67,7 +63,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color;
- Output.TexCoord = Input.TexCoord + float2(0.5f, 0.5f) * invDims;
+ Output.TexCoord = Input.TexCoord + 0.5f * invDims;
return Output;
}
diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx
index 7121fe07b46..3943b2666cd 100644
--- a/hlsl/deconverge.fx
+++ b/hlsl/deconverge.fx
@@ -23,6 +23,9 @@ struct VS_OUTPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
+ //float2 RedCoord : TEXCOORD0;
+ //float2 GrnCoord : TEXCOORD1;
+ //float2 BluCoord : TEXCOORD2;
float3 CoordX : TEXCOORD0;
float3 CoordY : TEXCOORD1;
float2 TexCoord : TEXCOORD2;
@@ -38,6 +41,9 @@ struct VS_INPUT
struct PS_INPUT
{
float4 Color : COLOR0;
+ //float2 RedCoord : TEXCOORD0;
+ //float2 GrnCoord : TEXCOORD1;
+ //float2 BluCoord : TEXCOORD2;
float3 CoordX : TEXCOORD0;
float3 CoordY : TEXCOORD1;
float2 TexCoord : TEXCOORD2;
@@ -53,11 +59,9 @@ uniform float3 ConvergeY = float3(0.0f, 0.0f, 0.0f);
uniform float TargetWidth;
uniform float TargetHeight;
-uniform float RawWidth;
-uniform float RawHeight;
+uniform float2 RawDims;
-uniform float WidthRatio;
-uniform float HeightRatio;
+uniform float2 SizeRatio;
uniform float3 RadialConvergeX = float3(0.0f, 0.0f, 0.0f);
uniform float3 RadialConvergeY = float3(0.0f, 0.0f, 0.0f);
@@ -68,9 +72,8 @@ VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
- float2 TargetRawRatio = float2(TargetWidth / RawWidth, TargetWidth / RawWidth);
- float2 invDims = float2(1.0f / RawWidth, 1.0f / RawHeight);
- float2 Ratios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
+ float2 invDims = 1.0f / RawDims;
+ float2 Ratios = SizeRatio;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight;
@@ -81,8 +84,19 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Color = Input.Color;
float2 TexCoord = Input.TexCoord;
- Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawWidth) + 0.5f) * Ratios.x + ConvergeX * invDims.x;
- Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawHeight) + 0.5f) * Ratios.y + ConvergeY * invDims.y;
+ float2 RadialRed = float2(RadialConvergeX.x, RadialConvergeY.x);
+ float2 RadialGrn = float2(RadialConvergeX.y, RadialConvergeY.y);
+ float2 RadialBlu = float2(RadialConvergeX.z, RadialConvergeY.z);
+ float2 ConvergeRed = float2(ConvergeX.x, ConvergeY.x);
+ float2 ConvergeGrn = float2(ConvergeX.y, ConvergeY.y);
+ float2 ConvergeBlu = float2(ConvergeX.z, ConvergeY.z);
+ float2 ScaledRatio = ((TexCoord * SizeRatio) - 0.5f);
+
+ Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawDims.x) + 0.5f) * Ratios.x + ConvergeX * invDims.x;
+ Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawDims.y) + 0.5f) * Ratios.y + ConvergeY * invDims.y;
+ //Output.RedCoord = (ScaledRatio * (1.0f + RadialRed / RawDims) + 0.5f) * SizeRatio + ConvergeRed * invDims;
+ //Output.GrnCoord = (ScaledRatio * (1.0f + RadialGrn / RawDims) + 0.5f) * SizeRatio + ConvergeGrn * invDims;
+ //Output.BluCoord = (ScaledRatio * (1.0f + RadialBlu / RawDims) + 0.5f) * SizeRatio + ConvergeBlu * invDims;
Output.TexCoord = TexCoord;
return Output;
@@ -94,39 +108,15 @@ VS_OUTPUT vs_main(VS_INPUT Input)
float4 ps_main(PS_INPUT Input) : COLOR
{
- float2 MagnetOffset = float2(32.0f / RawWidth, 32.0f / RawHeight);
- float2 MagnetCenter = float2(0.9f / WidthRatio, 0.9f / HeightRatio);
- float MagnetDistance = length((MagnetCenter - Input.TexCoord) * float2(WidthRatio, HeightRatio));
- float Deconverge = 1.0f - MagnetDistance / MagnetCenter;
- Deconverge = 1.0f;//clamp(Deconverge, 0.0f, 1.0f);
- float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a;
+ float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a;
+ //float RedTexel = tex2D(DiffuseSampler, Input.RedCoord).r;
+ //float GrnTexel = tex2D(DiffuseSampler, Input.GrnCoord).g;
+ //float BluTexel = tex2D(DiffuseSampler, Input.BluCoord).b;
+ float RedTexel = tex2D(DiffuseSampler, float2(Input.CoordX.x, Input.CoordY.x)).r;
+ float GrnTexel = tex2D(DiffuseSampler, float2(Input.CoordX.y, Input.CoordY.y)).g;
+ float BluTexel = tex2D(DiffuseSampler, float2(Input.CoordX.z, Input.CoordY.z)).b;
- float2 TargetDims = float2(RawWidth, RawHeight);
- float2 DimOffset = 0.0f / TargetDims;
- float2 TexCoord = Input.TexCoord;
- float3 CoordX = Input.CoordX;
- float3 CoordY = Input.CoordY;
-
- CoordX = lerp(TexCoord.x, CoordX, Deconverge);
- CoordY = lerp(TexCoord.y, CoordY, Deconverge);
-
- float RedTexel = tex2D(DiffuseSampler, float2(CoordX.x, CoordY.x) - DimOffset).r;
- float GrnTexel = tex2D(DiffuseSampler, float2(CoordX.y, CoordY.y) - DimOffset).g;
- float BluTexel = tex2D(DiffuseSampler, float2(CoordX.z, CoordY.z) - DimOffset).b;
-
- //RedTexel *= Input.RedCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
- //RedTexel *= Input.RedCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
- //RedTexel *= Input.RedCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
- //RedTexel *= Input.RedCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
- //GrnTexel *= Input.GrnCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
- //GrnTexel *= Input.GrnCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
- //GrnTexel *= Input.GrnCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
- //GrnTexel *= Input.GrnCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
- //BluTexel *= Input.BluCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
- //BluTexel *= Input.BluCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
- //BluTexel *= Input.BluCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
- //BluTexel *= Input.BluCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
-
+ //return float4(Input.TexCoord, 0.0f, 1.0f);
return float4(RedTexel, GrnTexel, BluTexel, Alpha);
}
diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx
index 5e0de0ca46d..9a77d12d6ac 100644
--- a/hlsl/downsample.fx
+++ b/hlsl/downsample.fx
@@ -54,31 +54,27 @@ struct PS_INPUT
uniform float2 TargetSize;
uniform float2 SourceSize;
-uniform float2 Defocus = float2(0.0f, 0.0f);
-
-uniform float Brighten;
-
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
Output.Position = float4(Input.Position.xyz, 1.0f);
- Output.Position.xy /= TargetSize;
+ Output.Position.xy /= SourceSize;
Output.Position.y = 1.0f - Output.Position.y;
- Output.Position.xy -= float2(0.5f, 0.5f);
- Output.Position.xy *= float2(2.0f, 2.0f);
+ Output.Position.xy -= 0.5f;
+ Output.Position.xy *= 2.0f;
Output.Color = Input.Color;
float2 inversePixel = 1.0f / TargetSize;
- Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.75f - 0.5f, 0.32f - 0.5f) * inversePixel;
- Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(0.35f - 0.5f, 0.65f - 0.5f) * inversePixel;
- Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.31f - 0.5f, 1.25f - 0.5f) * inversePixel;
- Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(0.58f - 0.5f, 1.61f - 0.5f) * inversePixel;
- Output.TexCoord45.xy = Input.Position.xy * inversePixel + float2(1.00f - 0.5f, 1.75f - 0.5f) * inversePixel;
- Output.TexCoord45.zw = Input.Position.xy * inversePixel + float2(1.35f - 0.5f, 1.64f - 0.5f) * inversePixel;
- Output.TexCoord67.xy = Input.Position.xy * inversePixel + float2(1.65f - 0.5f, 1.32f - 0.5f) * inversePixel;
- Output.TexCoord67.zw = Input.Position.xy * inversePixel + float2(1.72f - 0.5f, 0.93f - 0.5f) * inversePixel;
- Output.TexCoord89.xy = Input.Position.xy * inversePixel + float2(1.57f - 0.5f, 0.57f - 0.5f) * inversePixel;
- Output.TexCoord89.zw = Input.Position.xy * inversePixel + float2(1.25f - 0.5f, 0.33f - 0.5f) * inversePixel;
+ Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.00f + 0.5f) * inversePixel;
+ Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.00f + 0.5f) * inversePixel;
+ Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.25f + 0.5f) * inversePixel;
+ Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.25f + 0.5f) * inversePixel;
+ Output.TexCoord45.xy = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.25f + 0.5f) * inversePixel;
+ Output.TexCoord45.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.50f + 0.5f) * inversePixel;
+ Output.TexCoord67.xy = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.50f + 0.5f) * inversePixel;
+ Output.TexCoord67.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.75f + 0.5f) * inversePixel;
+ Output.TexCoord89.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.75f + 0.5f) * inversePixel;
+ Output.TexCoord89.zw = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.75f + 0.5f) * inversePixel;
return Output;
}
diff --git a/hlsl/focus.fx b/hlsl/focus.fx
index 37079af55a2..0df9c876b2b 100644
--- a/hlsl/focus.fx
+++ b/hlsl/focus.fx
@@ -86,7 +86,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
float2 TexCoord = Input.TexCoord;
- TexCoord = TexCoord + 0.5f * InvTexSize;
+ TexCoord = TexCoord;// + float2(0.5f, -0.5f) * InvTexSize;
Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * Defocus;
Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * Defocus;
Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * Defocus;
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx
index f48417459c4..b1a7f983435 100644
--- a/hlsl/phosphor.fx
+++ b/hlsl/phosphor.fx
@@ -114,8 +114,8 @@ technique TestTechnique
{
Lighting = FALSE;
- //Sampler[0] = <DiffuseSampler>;
- //Sampler[1] = <PreviousSampler>;
+ Sampler[0] = <DiffuseSampler>;
+ Sampler[1] = <PreviousSampler>;
VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
diff --git a/hlsl/post.fx b/hlsl/post.fx
index 4176a78b197..5b4640db496 100644
--- a/hlsl/post.fx
+++ b/hlsl/post.fx
@@ -59,11 +59,9 @@ struct PS_INPUT
uniform float TargetWidth;
uniform float TargetHeight;
-uniform float RawWidth;
-uniform float RawHeight;
+uniform float2 RawDims;
-uniform float WidthRatio;
-uniform float HeightRatio;
+uniform float2 SizeRatio;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -77,11 +75,8 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color;
- Output.TexCoord = Input.TexCoord + 0.5f / float2(TargetWidth, TargetHeight);
+ Output.TexCoord = Input.TexCoord + 0.5f / RawDims;//float2(TargetWidth, TargetHeight);
- //float Zoom = 32.0f;
- //Output.TexCoord /= Zoom;
- //Output.TexCoord += float2(0.175f * (1.0f - 1.0f / Zoom) / WidthRatio, 0.175f * (1.0f - 1.0f / Zoom) / HeightRatio);
return Output;
}
@@ -117,7 +112,7 @@ uniform float3 Floor = float3(0.0f, 0.0f, 0.0f);
float4 ps_main(PS_INPUT Input) : COLOR
{
- float2 Ratios = float2(WidthRatio, HeightRatio);
+ float2 Ratios = 1.0f / SizeRatio;
// -- Screen Pincushion Calculation --
float2 PinViewpointOffset = float2(0.0f, 0.0f);
@@ -153,14 +148,12 @@ float4 ps_main(PS_INPUT Input) : COLOR
float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
// -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
- clip((BaseCoord.x < 1.0f / RawWidth) ? -1 : 1);
- clip((BaseCoord.y < 1.0f / RawHeight) ? -1 : 1);
- clip((BaseCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth)) ? -1 : 1);
- clip((BaseCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight)) ? -1 : 1);
+ clip((BaseCoord < 1.0f / RawDims) ? -1 : 1);
+ clip((BaseCoord > (SizeRatio + 1.0f / RawDims)) ? -1 : 1);
// -- Scanline Simulation --
- float InnerSine = ScanCoord.y * RawHeight * ScanlineScale;
- float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * RawHeight);
+ float InnerSine = ScanCoord.y * RawDims.y * ScanlineScale;
+ float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * RawDims.y);
float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAmount);
float3 Scanned = BaseTexel.rgb * ScanBrightness;
diff --git a/hlsl/prescale.fx b/hlsl/prescale.fx
index 10420af1b85..965d89691f8 100644
--- a/hlsl/prescale.fx
+++ b/hlsl/prescale.fx
@@ -41,11 +41,10 @@ struct PS_INPUT
// Passthrough Vertex Shader
//-----------------------------------------------------------------------------
-float TargetWidth;
-float TargetHeight;
+uniform float TargetWidth;
+uniform float TargetHeight;
-float RawWidth;
-float RawHeight;
+uniform float2 RawDims;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -70,14 +69,13 @@ VS_OUTPUT vs_main(VS_INPUT Input)
float4 ps_main(PS_INPUT Input) : COLOR
{
- float2 RawDims = float2(RawWidth, RawHeight);
- float2 TexCoord = Input.TexCoord * RawDims;
- TexCoord -= frac(TexCoord);
- TexCoord += 0.5f;
- TexCoord /= RawDims;
-
- float4 Center = tex2D(DiffuseSampler, TexCoord);
- return Center;
+ //float2 TexCoord = Input.TexCoord * RawDims;
+ //TexCoord -= frac(TexCoord);
+ //TexCoord += 0.5f;
+ //TexCoord /= RawDims;
+ //
+ //return tex2D(DiffuseSampler, TexCoord);
+ return tex2D(DiffuseSampler, Input.TexCoord);
}
//-----------------------------------------------------------------------------
diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx
index c94ae76de0d..af3c01c34ab 100644
--- a/hlsl/yiq_decode.fx
+++ b/hlsl/yiq_decode.fx
@@ -57,8 +57,7 @@ struct PS_INPUT
uniform float TargetWidth;
uniform float TargetHeight;
-uniform float RawWidth;
-uniform float RawHeight;
+uniform float2 RawDims;
uniform float WidthRatio;
uniform float HeightRatio;
@@ -75,7 +74,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Coord0.xy = Input.TexCoord;
- Output.Coord0.zw = float2(1.0f / RawWidth, 0.0f);
+ Output.Coord0.zw = float2(1.0f / RawDims.x, 0.0f);
return Output;
}
@@ -98,8 +97,6 @@ uniform float QFreqResponse = 0.6f;
float4 ps_main(PS_INPUT Input) : COLOR
{
- float2 RawDims = float2(RawWidth, RawHeight);
-
float4 BaseTexel = tex2D(DiffuseSampler, Input.Coord0.xy + 0.5f / RawDims);
// YIQ convolution: N coefficients each
@@ -109,11 +106,11 @@ float4 ps_main(PS_INPUT Input) : COLOR
float MaxC = 2.1183f;
float MinC = -1.1183f;
float CRange = MaxC - MinC;
- float Fc_y1 = (CCValue - NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
- float Fc_y2 = (CCValue + NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
- float Fc_y3 = YFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
- float Fc_i = IFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
- float Fc_q = QFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
+ float Fc_y1 = (CCValue - NotchHalfWidth) * ScanTime / (RawDims.x * 4.0f / WidthRatio);
+ float Fc_y2 = (CCValue + NotchHalfWidth) * ScanTime / (RawDims.x * 4.0f / WidthRatio);
+ float Fc_y3 = YFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
+ float Fc_i = IFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
+ float Fc_q = QFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
float PI = 3.1415926535897932384626433832795;
float PI2 = 2.0f * PI;
float PI2Length = PI2 / 82.0f;
@@ -126,7 +123,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
float4 CoordY = Input.Coord0.y;
float2 TexCoord = float2(CoordX.r, CoordY.r);
float4 C = tex2D(CompositeSampler, TexCoord + float2(0.625f, 0.4f) / RawDims) * CRange + MinC;
- float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawHeight / HeightRatio) + BValue) + OValue;
+ float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawDims.y / HeightRatio) + BValue) + OValue;
float4 SincYIn1 = PI2 * Fc_y1 * n4;
float4 SincYIn2 = PI2 * Fc_y2 * n4;
diff --git a/hlsl/yiq_encode.fx b/hlsl/yiq_encode.fx
index d9c888d5a3c..2a2a1e40851 100644
--- a/hlsl/yiq_encode.fx
+++ b/hlsl/yiq_encode.fx
@@ -52,11 +52,9 @@ struct PS_INPUT
uniform float TargetWidth;
uniform float TargetHeight;
-uniform float RawWidth;
-uniform float RawHeight;
+uniform float2 RawDims;
-uniform float WidthRatio;
-uniform float HeightRatio;
+uniform float2 SizeRatio;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -90,26 +88,24 @@ uniform float ScanTime = 52.6f;
float4 ps_main(PS_INPUT Input) : COLOR
{
- float2 Scaler = float2(RawWidth, RawHeight);
- float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
+ float2 Coord0 = Input.Coord0 + float2(PValue * 0.00f, 0.0f) / RawDims;
+ float2 Coord1 = Input.Coord1 + float2(PValue * 0.25f, 0.0f) / RawDims;
+ float2 Coord2 = Input.Coord2 + float2(PValue * 0.50f, 0.0f) / RawDims;
+ float2 Coord3 = Input.Coord3 + float2(PValue * 0.75f, 0.0f) / RawDims;
- float2 Coord0 = Input.Coord0 + float2(PValue * 0.00f, 0.0f) / Scaler;
- float2 Coord1 = Input.Coord1 + float2(PValue * 0.25f, 0.0f) / Scaler;
- float2 Coord2 = Input.Coord2 + float2(PValue * 0.50f, 0.0f) / Scaler;
- float2 Coord3 = Input.Coord3 + float2(PValue * 0.75f, 0.0f) / Scaler;
-
- float2 TexelOffset = 0.5f / Scaler;
+ float2 TexelOffset = 0.5f / RawDims;
float3 Texel0 = tex2D(DiffuseSampler, Coord0 + TexelOffset).rgb;
float3 Texel1 = tex2D(DiffuseSampler, Coord1 + TexelOffset).rgb;
float3 Texel2 = tex2D(DiffuseSampler, Coord2 + TexelOffset).rgb;
float3 Texel3 = tex2D(DiffuseSampler, Coord3 + TexelOffset).rgb;
+ float2 InvSize = 1.0f / SizeRatio;
float PI = 3.1415926535897932384626433832795;
float W = PI * 2.0f * CCValue * ScanTime;
- float T0 = Coord0.x * WidthRatio + AValue * Coord0.y * 2.0f * (RawHeight / HeightRatio) + BValue;
- float T1 = Coord1.x * WidthRatio + AValue * Coord1.y * 2.0f * (RawHeight / HeightRatio) + BValue;
- float T2 = Coord2.x * WidthRatio + AValue * Coord2.y * 2.0f * (RawHeight / HeightRatio) + BValue;
- float T3 = Coord3.x * WidthRatio + AValue * Coord3.y * 2.0f * (RawHeight / HeightRatio) + BValue;
+ float T0 = Coord0.x * InvSize.x + AValue * Coord0.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
+ float T1 = Coord1.x * InvSize.x + AValue * Coord1.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
+ float T2 = Coord2.x * InvSize.x + AValue * Coord2.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
+ float T3 = Coord3.x * InvSize.x + AValue * Coord3.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f));
float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f));