From ac4ec1a0151fd958d7ec58146169763b446836fe Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 11 Sep 2021 17:54:18 -0300 Subject: Account for negative strides on DMA copy (#2623) * Account for negative strides on DMA copy * Should account for non-zero Y --- Ryujinx.Graphics.Texture/OffsetCalculator.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Ryujinx.Graphics.Texture') diff --git a/Ryujinx.Graphics.Texture/OffsetCalculator.cs b/Ryujinx.Graphics.Texture/OffsetCalculator.cs index dd4b6e7f..d7472e2f 100644 --- a/Ryujinx.Graphics.Texture/OffsetCalculator.cs +++ b/Ryujinx.Graphics.Texture/OffsetCalculator.cs @@ -1,4 +1,5 @@ using Ryujinx.Common; +using System; using System.Runtime.CompilerServices; using static Ryujinx.Graphics.Texture.BlockLinearConstants; @@ -111,9 +112,9 @@ namespace Ryujinx.Graphics.Texture { if (_isLinear) { - int start = y * _stride + x * _bytesPerPixel; - int end = (y + height - 1) * _stride + (x + width) * _bytesPerPixel; - return (start, end - start); + int start = y * Math.Abs(_stride) + x * _bytesPerPixel; + int end = (y + height - 1) * Math.Abs(_stride) + (x + width) * _bytesPerPixel; + return (y * _stride + x * _bytesPerPixel, end - start); } else { -- cgit v1.2.3