summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/bloom.fx22
-rw-r--r--hlsl/downsample.fx18
2 files changed, 21 insertions, 19 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index 2dd8ffbe2b7..a39657c2d9f 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -188,17 +188,17 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Color = Input.Color;
float2 inversePixel = 1.0f / TargetSize;
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) * 1.0f;//0.5f;
- Output.TexCoord23.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.25f;
- Output.TexCoord23.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.125f;
- Output.TexCoord45.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0625f;
- Output.TexCoord45.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.03125f;
- Output.TexCoord67.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.015625f;
- Output.TexCoord67.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0078125f;
- Output.TexCoord89.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.00390625f;
- Output.TexCoord89.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.001953125f;
- Output.TexCoordA = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0009765625f;
+ Output.TexCoord01.xy = TexCoord - inversePixel;
+ Output.TexCoord01.zw = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.5f;
+ Output.TexCoord23.xy = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.25f;
+ Output.TexCoord23.zw = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.125f;
+ Output.TexCoord45.xy = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0625f;
+ Output.TexCoord45.zw = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.03125f;
+ Output.TexCoord67.xy = (((TexCoord - inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.015625f;
+ Output.TexCoord67.zw = (((TexCoord + inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0078125f;
+ Output.TexCoord89.xy = (((TexCoord + inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.00390625f;
+ Output.TexCoord89.zw = (((TexCoord + inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.001953125f;
+ Output.TexCoordA = (((TexCoord + inversePixel) - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0009765625f;
return Output;
}
diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx
index 9dcaf7b90a0..9790af2b4a5 100644
--- a/hlsl/downsample.fx
+++ b/hlsl/downsample.fx
@@ -45,8 +45,10 @@ struct PS_INPUT
// Downsample Vertex Shader
//-----------------------------------------------------------------------------
+uniform float2 ScreenSize;
uniform float2 TargetSize;
uniform float2 SourceSize;
+uniform float2 PrimRatio;
uniform float BloomRescale;
VS_OUTPUT vs_main(VS_INPUT Input)
@@ -54,16 +56,16 @@ VS_OUTPUT vs_main(VS_INPUT Input)
VS_OUTPUT Output = (VS_OUTPUT)0;
Output.Position = float4(Input.Position.xyz, 1.0f);
- Output.Position.xy /= SourceSize;
+ Output.Position.xy /= ScreenSize;
Output.Position.y = 1.0f - Output.Position.y;
- Output.Position.xy -= 0.5f;
- Output.Position.xy *= 2.0f;
+ Output.Position.xy -= float2(0.5f, 0.5f);
+ Output.Position.xy *= float2(2.0f, 2.0f);
Output.Color = Input.Color;
- float2 inversePixel = 1.0f / SourceSize;
- Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.5f, 0.5f) * inversePixel;
- Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(1.5f, 0.5f) * inversePixel;
- Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.5f, 1.5f) * inversePixel;
- Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(1.5f, 1.5f) * inversePixel;
+ float2 inversePixel = 1.0f / ScreenSize;
+ Output.TexCoord01.xy = Input.Position.xy / ScreenSize + float2(0.5f, 0.5f) / TargetSize;
+ Output.TexCoord01.zw = Input.Position.xy / ScreenSize + float2(1.5f, 0.5f) / TargetSize;
+ Output.TexCoord23.xy = Input.Position.xy / ScreenSize + float2(0.5f, 1.5f) / TargetSize;
+ Output.TexCoord23.zw = Input.Position.xy / ScreenSize + float2(1.5f, 1.5f) / TargetSize;
return Output;
}