فهرست منبع

Calculate width from stride on texture copies

gdk 6 سال پیش
والد
کامیت
1bb08742c1
2فایلهای تغییر یافته به همراه14 افزوده شده و 6 حذف شده
  1. 12 1
      Ryujinx.Graphics.Gpu/Image/TextureManager.cs
  2. 2 5
      Ryujinx.Graphics.Texture/LayoutConverter.cs

+ 12 - 1
Ryujinx.Graphics.Gpu/Image/TextureManager.cs

@@ -245,9 +245,20 @@ namespace Ryujinx.Graphics.Gpu.Image
 
             FormatInfo formatInfo = copyTexture.Format.Convert();
 
+            int width;
+
+            if (copyTexture.LinearLayout)
+            {
+                width = copyTexture.Stride / formatInfo.BytesPerPixel;
+            }
+            else
+            {
+                width = copyTexture.Width;
+            }
+
             TextureInfo info = new TextureInfo(
                 address,
-                copyTexture.Width,
+                width,
                 copyTexture.Height,
                 copyTexture.Depth,
                 1,

+ 2 - 5
Ryujinx.Graphics.Texture/LayoutConverter.cs

@@ -108,11 +108,8 @@ namespace Ryujinx.Graphics.Texture
         {
             int outOffs = 0;
 
-            int w = width;
-            int h = height;
-
-            w = BitUtils.DivRoundUp(w, blockWidth);
-            h = BitUtils.DivRoundUp(h, blockHeight);
+            int w = BitUtils.DivRoundUp(width,  blockWidth);
+            int h = BitUtils.DivRoundUp(height, blockHeight);
 
             int outStride = BitUtils.AlignUp(w * bytesPerPixel, AlignmentSize);