aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Texture
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-09-11 17:54:18 -0300
committerGitHub <noreply@github.com>2021-09-11 22:54:18 +0200
commitac4ec1a0151fd958d7ec58146169763b446836fe (patch)
tree35ee4908dba22e9552bd70b4b251a1f00ef9b1bc /Ryujinx.Graphics.Texture
parent016fc64b3df8e039e62f3022139244061a00ec30 (diff)
Account for negative strides on DMA copy (#2623)
* Account for negative strides on DMA copy * Should account for non-zero Y
Diffstat (limited to 'Ryujinx.Graphics.Texture')
-rw-r--r--Ryujinx.Graphics.Texture/OffsetCalculator.cs7
1 files changed, 4 insertions, 3 deletions
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
{