From a87f7f202973d2ab0db088f97b3538ae724bbe69 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 26 Dec 2021 13:05:26 -0300 Subject: [PATCH] Fix DMA copy fast path line size when xCount < stride (#2942) --- Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs | 1 + Ryujinx.Graphics.Gpu/Image/Texture.cs | 1 + Ryujinx.Graphics.Texture/LayoutConverter.cs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs b/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs index 856d52a9..c00e2bef 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs @@ -222,6 +222,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma target.Info.Height, 1, 1, + xCount * srcBpp, srcStride, target.Info.FormatInfo.BytesPerPixel, srcSpan); diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index a13edc69..590356e3 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -760,6 +760,7 @@ namespace Ryujinx.Graphics.Gpu.Image Info.FormatInfo.BlockWidth, Info.FormatInfo.BlockHeight, Info.Stride, + Info.Stride, Info.FormatInfo.BytesPerPixel, data); } diff --git a/Ryujinx.Graphics.Texture/LayoutConverter.cs b/Ryujinx.Graphics.Texture/LayoutConverter.cs index 970d08cb..1039ea26 100644 --- a/Ryujinx.Graphics.Texture/LayoutConverter.cs +++ b/Ryujinx.Graphics.Texture/LayoutConverter.cs @@ -248,6 +248,7 @@ namespace Ryujinx.Graphics.Texture int height, int blockWidth, int blockHeight, + int lineSize, int stride, int bytesPerPixel, ReadOnlySpan data) @@ -256,7 +257,7 @@ namespace Ryujinx.Graphics.Texture int h = BitUtils.DivRoundUp(height, blockHeight); int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment); - int lineSize = Math.Min(stride, outStride); + lineSize = Math.Min(lineSize, outStride); Span output = new byte[h * outStride];