summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-04-13 19:21:57 +0200
committer ImJezze <jezze@gmx.net>2016-04-13 19:21:57 +0200
commit32f0e6efac8b51dbdc11b390b64753227cbb6180 (patch)
treeaf19990b09f731d098ca93781b732e0724ebf7e9 /hlsl
parent6be4d8312ccf4d9b5fde5fc2b5094e637fbdf7d7 (diff)
Removed hacks for vector screens from shaders (nw)
- added handling of texture coordinates for vector screens to core render - added handling of orientation/rotation for vector screens to D3D renderer
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/bloom.fx4
-rw-r--r--hlsl/distortion.fx45
-rw-r--r--hlsl/downsample.fx5
-rw-r--r--hlsl/post.fx21
-rw-r--r--hlsl/primary.fx2
-rw-r--r--hlsl/vector.fx6
6 files changed, 19 insertions, 64 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index 5911e1ee8b5..db23995d55b 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -278,9 +278,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.TexCoord = TexCoord.xy;
- TexCoord += VectorScreen
- ? 0.5f / TargetDims.xy
- : 0.5f / SourceDims.xy;
+ TexCoord += 0.5f / SourceDims;
Output.BloomCoord = TexCoord.xy;
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx
index 0040c76d3b0..e33b8811ba5 100644
--- a/hlsl/distortion.fx
+++ b/hlsl/distortion.fx
@@ -89,8 +89,6 @@ uniform float2 ScreenDims; // size of the window or fullscreen
uniform float2 TargetDims; // size of the target surface
uniform float2 QuadDims; // size of the screen quad
-uniform bool VectorScreen;
-
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
@@ -120,7 +118,6 @@ uniform float VignettingAmount = 0.0f;
uniform float ReflectionAmount = 0.0f;
uniform bool SwapXY = false;
-uniform int RotationType = 0; // 0 = 0°, 1 = 90°, 2 = 180°, 3 = 270°
float GetNoiseFactor(float3 n, float random)
{
@@ -146,40 +143,16 @@ float GetSpotAddend(float2 coord, float amount)
{
float2 SpotCoord = coord;
- // hack for vector screen
- if (VectorScreen)
- {
- // upper right quadrant
- float2 spotOffset =
- RotationType == 1 // 90°
- ? float2(-0.25f, -0.25f)
- : RotationType == 2 // 180°
- ? float2(0.25f, -0.25f)
- : RotationType == 3 // 270° else 0°
- ? float2(0.25f, 0.25f)
- : float2(-0.25f, 0.25f);
-
- // normalized screen canvas ratio
- float2 CanvasRatio = SwapXY
- ? float2(QuadDims.x / QuadDims.y, 1.0f)
- : float2(1.0f, QuadDims.y / QuadDims.x);
-
- SpotCoord += spotOffset;
- SpotCoord *= CanvasRatio;
- }
- else
- {
- // upper right quadrant
- float2 spotOffset = float2(-0.25f, 0.25f);
+ // upper right quadrant
+ float2 spotOffset = float2(-0.25f, 0.25f);
- // normalized screen canvas ratio
- float2 CanvasRatio = SwapXY
- ? float2(1.0f, QuadDims.x / QuadDims.y)
- : float2(1.0f, QuadDims.y / QuadDims.x);
+ // normalized screen canvas ratio
+ float2 CanvasRatio = SwapXY
+ ? float2(1.0f, QuadDims.x / QuadDims.y)
+ : float2(1.0f, QuadDims.y / QuadDims.x);
- SpotCoord += spotOffset;
- SpotCoord *= CanvasRatio;
- }
+ SpotCoord += spotOffset;
+ SpotCoord *= CanvasRatio;
float SpotBlur = amount;
@@ -201,7 +174,7 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount)
smoothAmount = min(smoothAmount, radiusAmount);
float2 quadDims = QuadDims;
- quadDims = !VectorScreen && SwapXY
+ quadDims = SwapXY
? quadDims.yx
: quadDims.xy;
diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx
index 7b4d003dd7c..c069b0ad10e 100644
--- a/hlsl/downsample.fx
+++ b/hlsl/downsample.fx
@@ -55,8 +55,6 @@ uniform float2 ScreenDims;
uniform float2 TargetDims;
uniform float2 QuadDims;
-uniform bool VectorScreen;
-
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);
@@ -67,9 +65,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
VS_OUTPUT Output = (VS_OUTPUT)0;
float2 HalfTargetTexelDims = 0.5f / TargetDims;
- HalfTargetTexelDims *= VectorScreen
- ? (ScreenDims / QuadDims)
- : 1.0f;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
diff --git a/hlsl/post.fx b/hlsl/post.fx
index c3966257c02..1ef59fcca39 100644
--- a/hlsl/post.fx
+++ b/hlsl/post.fx
@@ -175,27 +175,22 @@ float2 GetShadowCoord(float2 QuadCoord, float2 SourceCoord)
float2 shadowUV = ShadowUV;
float2 shadowCount = ShadowCount;
- // swap x/y vector and raster in screen mode (not source mode)
+ // swap x/y in screen mode (not source mode)
canvasCoord = ShadowTileMode == 0 && SwapXY
? canvasCoord.yx
: canvasCoord.xy;
- // swap x/y vector and raster in screen mode (not source mode)
+ // swap x/y in screen mode (not source mode)
shadowCount = ShadowTileMode == 0 && SwapXY
? shadowCount.yx
: shadowCount.xy;
float2 shadowTile = canvasTexelDims * shadowCount;
- // swap x/y vector in screen mode (not raster and not source mode)
- shadowTile = VectorScreen && ShadowTileMode == 0 && SwapXY
- ? shadowTile.yx
- : shadowTile.xy;
-
float2 shadowFrac = frac(canvasCoord / shadowTile);
- // swap x/y raster in screen mode (not vector and not source mode)
- shadowFrac = !VectorScreen && ShadowTileMode == 0 && SwapXY
+ // swap x/y in screen mode (not source mode)
+ shadowFrac = ShadowTileMode == 0 && SwapXY
? shadowFrac.yx
: shadowFrac.xy;
@@ -215,12 +210,8 @@ float4 ps_main(PS_INPUT Input) : COLOR
float4 BaseColor = tex2D(DiffuseSampler, TexCoord);
BaseColor.a = 1.0f;
- // keep border
- if (!PrepareBloom)
- {
- // clip border
- clip(TexCoord < 0.0f || TexCoord > 1.0f ? -1 : 1);
- }
+ // clip border
+ clip(TexCoord < 0.0f || TexCoord > 1.0f ? -1 : 1);
// Mask Simulation (may not affect bloom)
if (!PrepareBloom && ShadowAlpha > 0.0f)
diff --git a/hlsl/primary.fx b/hlsl/primary.fx
index 9f5a3c62faf..939d37e97dd 100644
--- a/hlsl/primary.fx
+++ b/hlsl/primary.fx
@@ -55,8 +55,6 @@ uniform float2 ScreenDims;
uniform float2 TargetDims;
uniform float2 QuadDims;
-uniform bool VectorScreen;
-
VS_OUTPUT vs_screen_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
diff --git a/hlsl/vector.fx b/hlsl/vector.fx
index 13aeb943c53..d71b85ad0e1 100644
--- a/hlsl/vector.fx
+++ b/hlsl/vector.fx
@@ -28,7 +28,7 @@ struct PS_INPUT
{
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
- float2 LineInfo : TEXCOORD1;
+ float2 LineInfo : TEXCOORD1; // x is the line length, y is unused
};
//-----------------------------------------------------------------------------
@@ -47,9 +47,9 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
- Output.Position.y = 1.0f - Output.Position.y; // flip y
+ Output.Position.y = 1.0f - Output.Position.y;
Output.Position.xy -= 0.5f; // center
- Output.Position.xy *= 2.0f * (ScreenDims / QuadDims); // zoom
+ Output.Position.xy *= 2.0f; // zoom
Output.TexCoord = Input.TexCoord;