diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-08-25 23:16:41 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-26 02:16:41 +0000 |
commit | 923089a29825cad8159a63616d14dcbd7161cb3c (patch) | |
tree | 99c7e39baba29a743dcccbdb046b2db3d5148d45 /Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs | |
parent | d9aa15eb243bc1b40892c9fcfcbb0e9ef66cfa63 (diff) |
Fast path for Inline-to-Memory texture data transfers (#3610)1.1.233
* Fast path for Inline-to-Memory texture data transfers
* Only do it for block linear textures to be on the safe side
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs b/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs index c0939057..6120d295 100644 --- a/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs +++ b/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs @@ -29,6 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory private int _dstHeight; private int _dstStride; private int _dstGobBlocksInY; + private int _dstGobBlocksInZ; private int _lineLengthIn; private int _lineCount; @@ -117,6 +118,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory _dstHeight = (int)state.SetDstHeight; _dstStride = (int)state.PitchOut; _dstGobBlocksInY = 1 << (int)state.SetDstBlockSizeHeight; + _dstGobBlocksInZ = 1 << (int)state.SetDstBlockSizeDepth; _lineLengthIn = (int)state.LineLengthIn; _lineCount = (int)state.LineCount; @@ -176,6 +178,31 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory } else { + // TODO: Verify if the destination X/Y and width/height are taken into account + // for linear texture transfers. If not, we can use the fast path for that aswell. + // Right now the copy code at the bottom assumes that it is used on both which might be incorrect. + if (!_isLinear) + { + var target = memoryManager.Physical.TextureCache.FindTexture( + memoryManager, + _dstGpuVa, + 1, + _dstStride, + _dstHeight, + _lineLengthIn, + _lineCount, + _isLinear, + _dstGobBlocksInY, + _dstGobBlocksInZ); + + if (target != null) + { + target.SetData(data, 0, 0, new GAL.Rectangle<int>(_dstX, _dstY, _lineLengthIn / target.Info.FormatInfo.BytesPerPixel, _lineCount)); + + return; + } + } + var dstCalculator = new OffsetCalculator( _dstWidth, _dstHeight, |