diff --git a/hlsl/artwork_support/post.fx b/hlsl/artwork_support/post.fx index e4c2098744a..f3d49d4dbaf 100644 --- a/hlsl/artwork_support/post.fx +++ b/hlsl/artwork_support/post.fx @@ -112,6 +112,7 @@ uniform float2 ShadowUVOffset = float2(0.0f, 0.0f); uniform bool OrientationSwapXY = false; // false landscape, true portrait for default screen orientation uniform bool RotationSwapXY = false; // swapped default screen orientation due to screen rotation +uniform int RotationType = 0; // 0 = 0°, 1 = 90°, 2 = 180°, 3 = 270° uniform bool PrepareBloom = false; // disables some effects for rendering bloom textures uniform bool PrepareVector = false; @@ -221,9 +222,17 @@ float GetSpotAddend(float2 coord, float amount) : QuadDims.y / QuadDims.x); // upper right quadrant - float2 spotOffset = OrientationSwapXY - ? float2(0.25f, 0.25f) - : float2(-0.25f, 0.25f); + float2 spotOffset = PrepareVector + ? RotationType == 1 // 90° + ? float2(-0.25f, -0.25f) + : RotationType == 2 // 180° + ? float2(0.25f, -0.25f) + : RotationType == 3 // 270° + ? float2(0.25f, 0.25f) + : float2(-0.25f, 0.25f) + : OrientationSwapXY + ? float2(0.25f, 0.25f) + : float2(-0.25f, 0.25f); float2 SpotCoord = coord; SpotCoord += spotOffset * RatioCorrection; @@ -257,17 +266,13 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount) ? QuadDims.yx / SourceRect : QuadDims.xy / SourceRect; - // raster graphics - if (!PrepareVector) - { - // alignment correction - float2 SourceTexelDims = 1.0f / SourceDims; - coord -= SourceTexelDims; - } + coord = PrepareVector + ? coord + : coord - 1.0f / SourceDims; // alignment correction (raster graphics) - float range = min(CanvasDims.x, CanvasDims.y) * 0.5; - float radius = range * max(radiusAmount, 0.01f); - float smooth = 1.0 / (range * max(smoothAmount, 0.01f)); + float range = min(QuadDims.x, QuadDims.y) * 0.5; + float radius = range * max(radiusAmount, 0.0025f); + float smooth = 1.0 / (range * max(smoothAmount, 0.0025f)); // compute box float box = roundBox(CanvasDims * (coord * 2.0f), CanvasDims * RatioCorrection, radius); diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx index b864d72348f..1524f27757c 100644 --- a/hlsl/distortion.fx +++ b/hlsl/distortion.fx @@ -196,9 +196,9 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount) // reduce smooth amount down to radius amount smoothAmount = min(smoothAmount, radiusAmount); - float range = min(ScreenDims.x, ScreenDims.y) * 0.5; - float radius = range * max(radiusAmount, 0.01f); - float smooth = 1.0 / (range * max(smoothAmount, 0.01f)); + float range = min(QuadDims.x, QuadDims.y) * 0.5; + float radius = range * max(radiusAmount, 0.0025f); + float smooth = 1.0 / (range * max(smoothAmount, 0.0025f)); // compute box float box = roundBox(ScreenDims * (coord * 2.0f), ScreenDims * RatioCorrection, radius); diff --git a/src/osd/modules/render/d3d/d3dhlsl.c b/src/osd/modules/render/d3d/d3dhlsl.c index 7b600d3c56f..3a3c80ce46c 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.c +++ b/src/osd/modules/render/d3d/d3dhlsl.c @@ -1462,6 +1462,14 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int bool rotation_swap_xy = (d3d->window().target()->orientation() & ROT90) == ROT90 || (d3d->window().target()->orientation() & ROT270) == ROT270; + int rotation_type = + (d3d->window().target()->orientation() & ROT90) == ROT90 + ? 1 + : (d3d->window().target()->orientation() & ROT180) == ROT180 + ? 2 + : (d3d->window().target()->orientation() & ROT270) == ROT270 + ? 3 + : 0; curr_effect = post_effect; curr_effect->update_uniforms(); @@ -1470,6 +1478,7 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int curr_effect->set_float("ScanlineOffset", texture->get_cur_frame() == 0 ? 0.0f : options->scanline_offset); curr_effect->set_bool("OrientationSwapXY", orientation_swap_xy); curr_effect->set_bool("RotationSwapXY", rotation_swap_xy); + curr_effect->set_int("RotationType", rotation_type); // backward compatibility curr_effect->set_bool("PrepareBloom", prepare_bloom); curr_effect->set_bool("PrepareVector", prepare_vector);