summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-07 13:40:24 +0100
committer ImJezze <jezze@gmx.net>2016-02-07 13:40:24 +0100
commitd15d53c728b4848e3ed74d66b9ab446811e1acee (patch)
tree5346f7ff12c1925073ef3b4b830e7b9df87523a5 /hlsl
parentf5e3032d98257ceaa7800251139f3c6df98f13e8 (diff)
Fixed Bloom Level Alignment
- fixed target dimensions of bloom levels, which results in a much better alignment especially for game with very low resolution (therefore current bloom settings might look a little less intense than before) - small cleanups (nw)
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/downsample.fx19
-rw-r--r--hlsl/focus.fx18
-rw-r--r--hlsl/prescale.fx4
3 files changed, 22 insertions, 19 deletions
diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx
index 122172350f9..6cb18f53935 100644
--- a/hlsl/downsample.fx
+++ b/hlsl/downsample.fx
@@ -57,6 +57,11 @@ uniform float2 SourceRect;
uniform bool PrepareVector;
+static const float2 Coord0Offset = float2(-0.5f, -0.5f);
+static const float2 Coord1Offset = float2( 0.5f, -0.5f);
+static const float2 Coord2Offset = float2(-0.5f, 0.5f);
+static const float2 Coord3Offset = float2( 0.5f, 0.5f);
+
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
@@ -72,14 +77,12 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Color = Input.Color;
float2 TexCoord = Input.Position.xy / ScreenDims;
- TexCoord += PrepareVector
- ? 0.5f / TargetDims // half texel offset correction (DX9) - only for vector grpahics
- : 0.0f;
-
- Output.TexCoord01.xy = TexCoord + float2(-0.5f, -0.5f) * TargetTexelDims;
- Output.TexCoord01.zw = TexCoord + float2( 0.5f, -0.5f) * TargetTexelDims;
- Output.TexCoord23.xy = TexCoord + float2(-0.5f, 0.5f) * TargetTexelDims;
- Output.TexCoord23.zw = TexCoord + float2( 0.5f, 0.5f) * TargetTexelDims;
+ TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)
+
+ Output.TexCoord01.xy = TexCoord + Coord0Offset * TargetTexelDims;
+ Output.TexCoord01.zw = TexCoord + Coord1Offset * TargetTexelDims;
+ Output.TexCoord23.xy = TexCoord + Coord2Offset * TargetTexelDims;
+ Output.TexCoord23.zw = TexCoord + Coord3Offset * TargetTexelDims;
return Output;
}
diff --git a/hlsl/focus.fx b/hlsl/focus.fx
index c5e5262fedd..5f329e9634e 100644
--- a/hlsl/focus.fx
+++ b/hlsl/focus.fx
@@ -78,19 +78,19 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Defocus Pixel Shader
//-----------------------------------------------------------------------------
-float2 Coord1Offset = float2( 0.75f, 0.50f);
-float2 Coord2Offset = float2( 0.25f, 1.00f);
-float2 Coord3Offset = float2(-0.50f, 0.75f);
-float2 Coord4Offset = float2(-1.00f, 0.25f);
-float2 Coord5Offset = float2(-0.75f, -0.50f);
-float2 Coord6Offset = float2(-0.25f, -1.00f);
-float2 Coord7Offset = float2( 0.50f, -0.75f);
-float2 Coord8Offset = float2( 1.00f, -0.25f);
-
uniform float2 Defocus = float2(0.0f, 0.0f);
uniform bool SwapXY = false;
+static const float2 Coord1Offset = float2( 0.75f, 0.50f);
+static const float2 Coord2Offset = float2( 0.25f, 1.00f);
+static const float2 Coord3Offset = float2(-0.50f, 0.75f);
+static const float2 Coord4Offset = float2(-1.00f, 0.25f);
+static const float2 Coord5Offset = float2(-0.75f, -0.50f);
+static const float2 Coord6Offset = float2(-0.25f, -1.00f);
+static const float2 Coord7Offset = float2( 0.50f, -0.75f);
+static const float2 Coord8Offset = float2( 1.00f, -0.25f);
+
float4 ps_main(PS_INPUT Input) : COLOR
{
float2 QuadRatio =
diff --git a/hlsl/prescale.fx b/hlsl/prescale.fx
index 846c02577ce..6faa659e6d0 100644
--- a/hlsl/prescale.fx
+++ b/hlsl/prescale.fx
@@ -54,13 +54,13 @@ uniform float2 TargetDims;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
-
+
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
Output.Position.y = 1.0f - Output.Position.y; // flip y
Output.Position.xy -= 0.5f; // center
Output.Position.xy *= 2.0f; // zoom
-
+
Output.TexCoord = Input.TexCoord;
Output.TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)