Просмотр исходного кода

Force crop when presentation cached texture size mismatches (#2957)

gdkchan 4 лет назад
Родитель
Сommit
15131d4350
2 измененных файлов с 24 добавлено и 3 удалено
  1. 1 2
      Ryujinx.Graphics.GAL/ImageCrop.cs
  2. 23 1
      Ryujinx.Graphics.Gpu/Window.cs

+ 1 - 2
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;

+ 23 - 1
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);
             }