summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--bgfx/shaders/dx11/chains/hlsl/fs_distortion.binbin4208 -> 4216 bytes
-rw-r--r--bgfx/shaders/dx9/chains/hlsl/fs_distortion.binbin3197 -> 3145 bytes
-rw-r--r--bgfx/shaders/gles/chains/hlsl/fs_distortion.binbin5935 -> 5939 bytes
-rw-r--r--bgfx/shaders/glsl/chains/hlsl/fs_distortion.binbin5643 -> 5647 bytes
-rw-r--r--bgfx/shaders/metal/chains/hlsl/fs_distortion.binbin6224 -> 6209 bytes
-rw-r--r--hlsl/distortion.fx23
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc23
7 files changed, 24 insertions, 22 deletions
diff --git a/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin b/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin
index 0407e658a50..2c3c3418331 100644
--- a/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin
+++ b/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin b/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin
index 54217cd1127..b3c716df99e 100644
--- a/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin
+++ b/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin b/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin
index a1f750c9aac..6142d1c9568 100644
--- a/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin
+++ b/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin b/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin
index bb7ab279101..4046b407a05 100644
--- a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin
+++ b/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin
index d33db30a83c..b36016564a2 100644
--- a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin
+++ b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin
Binary files differ
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx
index c7128bccfef..7624d962a58 100644
--- a/hlsl/distortion.fx
+++ b/hlsl/distortion.fx
@@ -232,20 +232,13 @@ float2 GetTextureCoords(float2 coord, float distortionAmount, float cubicDistort
return coord;
}
-float2 GetQuadCoords(float2 coord, float distortionAmount, float cubicDistortionAmount)
+float2 GetQuadCoords(float2 coord, float2 scale, float distortionAmount, float cubicDistortionAmount)
{
// center coordinates
coord -= 0.5f;
- // keep coords inside of the quad bounds of a single screen
- if (ScreenCount == 1)
- {
- // base-target dimensions (without oversampling)
- float2 BaseTargetDims = TargetDims / TargetScale;
-
- // apply base-target/quad difference
- coord *= BaseTargetDims / (SwapXY ? QuadDims.yx : QuadDims.xy);
- }
+ // apply scale
+ coord *= scale;
// distort coordinates
coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);
@@ -271,12 +264,20 @@ float4 ps_main(PS_INPUT Input) : COLOR
// base-target dimensions (without oversampling)
float2 BaseTargetDims = TargetDims / TargetScale;
+ BaseTargetDims = SwapXY
+ ? BaseTargetDims.yx
+ : BaseTargetDims.xy;
+
+ // base-target/quad difference scale
+ float2 BaseTargetQuadScale = ScreenCount == 1
+ ? BaseTargetDims / QuadDims // keeps the coords inside of the quad bounds of a single screen
+ : 1.0f;
// Screen Texture Curvature
float2 BaseCoord = GetTextureCoords(Input.TexCoord, distortionAmount, cubicDistortionAmount);
// Screen Quad Curvature
- float2 QuadCoord = GetQuadCoords(Input.TexCoord, distortCornerAmount, 0.0f);
+ float2 QuadCoord = GetQuadCoords(Input.TexCoord, BaseTargetQuadScale, distortCornerAmount, 0.0f);
// clip border
clip(BaseCoord < 0.0f - TexelDims || BaseCoord > 1.0f + TexelDims ? -1 : 1);
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc
index dda16f150e6..36f4fa9eaad 100644
--- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc
@@ -157,20 +157,13 @@ vec2 GetTextureCoords(vec2 coord, float distortionAmount, float cubicDistortionA
return coord;
}
-vec2 GetQuadCoords(vec2 coord, float distortionAmount, float cubicDistortionAmount)
+vec2 GetQuadCoords(vec2 coord, vec2 scale, float distortionAmount, float cubicDistortionAmount)
{
// center coordinates
coord -= 0.5;
- // keep coords inside of the quad bounds of a single screen
- if (u_screen_count.x > 0.0 && u_screen_count.x < 2.0)
- {
- // base-target dimensions (without oversampling)
- vec2 BaseTargetDims = u_target_dims.xy / u_target_scale.xy;
-
- // apply base-target/quad difference
- coord *= BaseTargetDims / ((u_swap_xy.x > 0.0) ? u_quad_dims.yx : u_quad_dims.xy);
- }
+ // apply scale
+ coord *= scale;
// distort coordinates
coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);
@@ -197,12 +190,20 @@ void main()
// base-target dimensions (without oversampling)
vec2 BaseTargetDims = u_target_dims.xy / u_target_scale.xy;
+ BaseTargetDims = (u_swap_xy.x > 0.0)
+ ? BaseTargetDims.yx
+ : BaseTargetDims.xy;
+
+ // base-target/quad difference scale
+ vec2 BaseTargetQuadScale = (u_screen_count.x > 0.0 && u_screen_count.x < 2.0)
+ ? BaseTargetDims / u_quad_dims.xy // keeps the coords inside of the quad bounds of a single screen
+ : vec2(1.0, 1.0);
// Screen Texture Curvature
vec2 BaseCoord = GetTextureCoords(v_texcoord0, distortionAmount, cubicDistortionAmount);
// Screen Quad Curvature
- vec2 QuadCoord = GetQuadCoords(v_texcoord0, distortCornerAmount, 0.0);
+ vec2 QuadCoord = GetQuadCoords(v_texcoord0, BaseTargetQuadScale, distortCornerAmount, 0.0);
// Color
vec4 BaseColor = texture2D(s_tex, BaseCoord);