aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-12-31 12:00:42 -0300
committerGitHub <noreply@github.com>2021-12-31 12:00:42 -0300
commit15131d435021646d39d3bd7f370acf8466556eb4 (patch)
treead1d818e11f96f1267a056aff7b9eb0c5454d20e
parentc05c8e09d48eb36beef02fda885ec0fd36135463 (diff)
Force crop when presentation cached texture size mismatches (#2957)
-rw-r--r--Ryujinx.Graphics.GAL/ImageCrop.cs3
-rw-r--r--Ryujinx.Graphics.Gpu/Window.cs24
2 files changed, 24 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.GAL/ImageCrop.cs b/Ryujinx.Graphics.GAL/ImageCrop.cs
index ae81cfef..a7d571de 100644
--- a/Ryujinx.Graphics.GAL/ImageCrop.cs
+++ b/Ryujinx.Graphics.GAL/ImageCrop.cs
@@ -21,8 +21,7 @@ namespace Ryujinx.Graphics.GAL
bool flipY,
bool isStretched,
float aspectRatioX,
- float aspectRatioY
- )
+ float aspectRatioY)
{
Left = left;
Right = right;
diff --git a/Ryujinx.Graphics.Gpu/Window.cs b/Ryujinx.Graphics.Gpu/Window.cs
index 1432ef3b..9a4dfb9a 100644
--- a/Ryujinx.Graphics.Gpu/Window.cs
+++ b/Ryujinx.Graphics.Gpu/Window.cs
@@ -201,7 +201,29 @@ namespace Ryujinx.Graphics.Gpu
texture.SynchronizeMemory();
- _context.Renderer.Window.Present(texture.HostTexture, pt.Crop, swapBuffersCallback);
+ ImageCrop crop = pt.Crop;
+
+ if (texture.Info.Width > pt.Info.Width || texture.Info.Height > pt.Info.Height)
+ {
+ int top = crop.Top;
+ int bottom = crop.Bottom;
+ int left = crop.Left;
+ int right = crop.Right;
+
+ if (top == 0 && bottom == 0)
+ {
+ bottom = Math.Min(texture.Info.Height, pt.Info.Height);
+ }
+
+ if (left == 0 && right == 0)
+ {
+ right = Math.Min(texture.Info.Width, pt.Info.Width);
+ }
+
+ crop = new ImageCrop(left, right, top, bottom, crop.FlipX, crop.FlipY, crop.IsStretched, crop.AspectRatioX, crop.AspectRatioY);
+ }
+
+ _context.Renderer.Window.Present(texture.HostTexture, crop, swapBuffersCallback);
pt.ReleaseCallback(pt.UserObj);
}