summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/yiq_encode.fx
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2013-05-19 16:21:26 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2013-05-19 16:21:26 +0000
commite028e20476411120097970a13098ce57ebe66ced (patch)
treed1f2ee37875ee7ab1df3ef7cd864766b1f02884f /hlsl/yiq_encode.fx
parentec5c9bc680ab64ab57f2e89312e80c0aefa2036c (diff)
- "And he did give them CRT bloom, and it scorched their eyes so; and they wept
openly, for there was nothing left to see with" [MooglyGuy] * Enabled vector bloom and associated .ini controls * Added raster bloom and associated .ini controls, each bloom "level" is the linear weight of successively half-sized render targets * Removed D3D8 mode * Mass renaming in D3D renderer to use namespaces, initial planning step to HAL-based renderer implementation on Windows (i.e., GL on Windows) * Converted d3d_info, d3d_poly_info, and d3d_texture_info into classes * Added batching of vectors for possible speed increase * Minor cleanup of shader state setting
Diffstat (limited to 'hlsl/yiq_encode.fx')
-rw-r--r--hlsl/yiq_encode.fx28
1 files changed, 12 insertions, 16 deletions
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));