From 68036515bae237abd7edd58497528f1473fab2ac Mon Sep 17 00:00:00 2001 From: Jezze Date: Thu, 29 Sep 2016 15:19:44 +0200 Subject: [PATCH] Fixed aspect ratio of rounded corners (nw) --- .../dx11/chains/hlsl/fs_distortion.bin | Bin 4208 -> 4216 bytes .../shaders/dx9/chains/hlsl/fs_distortion.bin | Bin 3197 -> 3145 bytes .../gles/chains/hlsl/fs_distortion.bin | Bin 5935 -> 5939 bytes .../glsl/chains/hlsl/fs_distortion.bin | Bin 5643 -> 5647 bytes .../metal/chains/hlsl/fs_distortion.bin | Bin 6224 -> 6209 bytes hlsl/distortion.fx | 23 +++++++++--------- .../bgfx/shaders/chains/hlsl/fs_distortion.sc | 23 +++++++++--------- 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 0407e658a50271b9f1cc830579643bb0eaa29ce6..2c3c3418331b005fe796aabe47e3c6d68cf711b6 100644 GIT binary patch delta 292 zcmeyM@Izq(7o&6rze|LZv-96=YTo@Zy}_QAFW9whco`WO7&0cSGVbT>;bUNM0P+@Z ze#^+t!sphY0OT+*Fafb!!(=8lH6;+&oPmMUh(Q1>{Ec6L0i@pz$`@muoW!QY2@*17 zVBlz)Y{({G?*x^!g3?-08fY5_$RK8*YB5%bfiOE+AQth!=18#KWAP3`=gd^jshbC14F`ORmT0CEqn|N4nW?* z&2JgmS@^_S6@VND1|}dDYn{x*rZzc;jf2r?aw(goxa zo8A4k&-PI{w;vboB%1;thEos3tjTmA1@MHWGCHMD&zf*4jywKS0uz CDj_%k delta 288 zcmZXPI|>3p5JcbncKyej8F>)F(8ORtj6Hxiu+QKohT{zc1216WJ;YmxcDo9K!9Yz{ z&#Rhi^{9?L=QgLlTcl=R%(nq@0Y2d+Q0D}}GmykgJhSZHUXaKwFCj*{0vr-+-I+-H z)~U}&d(}_%2)66FtG3SkO{w+e_(gEdrV$VkHt9x-@ZEYVSooga^E faQi^()t}NyhPwA(+6oaY%W09wMOJV+m%I1^Im0h| diff --git a/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin b/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin index a1f750c9aac002605c83e445b4ede88a2e76d492..6142d1c95684b3c9f27393d0617819b77e832e03 100644 GIT binary patch delta 632 zcmZ`$%}T>S5GHMtG^;%*TA>Qvf@ss$HJhZ^QUsx>co4k^-a=_}5L#RNM}i0*e1q}g zQ&h=Kz4=1w6Sy0b7!SQj5wFUwqQ-IT?Y}D{R z4xaaj>ogF?ci8TZY<$a(IK<*K_)4#&15F*CKqGz8>4d<}W~*JmS10*G{O; zIl&xM=R*}k0&#FDViQNjW&DS^am-a!U~UO&fGDY}2Df3eaY1AaO{p>md624t4zE&v zo$>*rCaguIH{e^k$WhJ5|F2ZW8mU4-%pOxS7J|vCQ)_HH{z4kw;XFUtU_+k~ol9X1 zb+{BaU`fdfCQv0;GUGw8OFRgZ#DXwkq8u{On{u9D|6maryd0o1FI}|F%cEbscl03( KHSd0Tmihs~-?TRX delta 543 zcmdn2w_a}p7bBy>W^P6`7NO+){Gyb23u`U~1t@cJ0h^(WC0HOeuOzj|8LYxm!4|Gy zBeS@xp#exmNp3+|Vo|)I0Z>*$18RU?g@P7LtzLzug0=!&rV>e}Qd4s>&?F{9!^xKH znxcjvBMkKnK+569PA+HH!6CDQ-IUQ_@;i2UNs!ZEHUQ0s>o%OM!4WEC0hUGf$>fO~ zvb;tJ9~&A0y(~5Pub|W9$AUtFhQ=T%gx`!O|76jf{7_JY$7AYc diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin b/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin index bb7ab279101c14a20d4bbfafc52739c5c49a1b14..4046b407a055560d4d1bf1febf009a273f0a5d43 100644 GIT binary patch delta 670 zcmeCy>DSr7#mK}Ux|xS@1v6JkZb4aMQM`pU*W`_Yia{{0f~^9SX|7jUVa=tWP^*xd zQ=F<$4P+|7OiTfcJfC7;mvCV<5>XID8kAB delta 631 zcmeCz>DJl6#mMwWWHS%r3TC0?{QRPncnfPT1qCQ`vJ{6@eOYRRyUvFJ|zCd|iVXfk=Dpq_xC3DC0A_`=e}l=zg)+~Ub^1?53 diff --git a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin index d33db30a83ce74f897f39e1ecccc5c83c5046b3b..b36016564a28b24b37df255711ebdd0548c9146a 100644 GIT binary patch delta 717 zcmca$aL|C;E!cyFvH8jY)uo@7NmXn`YVgyrSIe8^}NIldnOQ5kDFzXcb724w`g*_zE5hfFh@4WrTI18nlr zh9H;2Z3Nl}*Ka)e2V0Dlp#fMP)vwwL270DY*MOr5>KhZJ05h4~!>%X~lR&b>1ZW8? zCMPGbN=$a+ly?OQYCwGeP8%BVATmJ?A|MAjh)nd5g2-g@Do$5MlgS@AQ<)46CWmpE ff~X!YZ4kACOC3Z#08^VexU)DIEjAYm-(>*+^zG5e delta 582 zcmX?TaKV7vE!cyFvH8r)r33T2h4e0pEAA}?)-(WS82Yb^9 z?lohOa)eKfCx2kE7J>!_LY2wnMqyJ{LldAgCQsxOVXT;JEiA(V;!jp!6LW-^Q466U z!DMKJ@DPxVu1}WH48n7@oG(rk=5Cic1?vF6UAQk{3Ya=AT?y9E|3hQ-trb000udr-uLl 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);