forked from Mirror/Ryujinx
Fix I2M texture copies when line length is not a multiple of 4 (#2938)
* Fix I2M texture copies when line length is not a multiple of 4 * Do not copy padding bytes for 1D copies * Nit
This commit is contained in:
parent
0b1185284c
commit
451673ada5
1 changed files with 12 additions and 3 deletions
|
@ -99,9 +99,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|||
_isLinear = (argument & 1) != 0;
|
||||
|
||||
_offset = 0;
|
||||
_size = (int)(state.LineLengthIn * state.LineCount);
|
||||
_size = (int)(BitUtils.AlignUp(state.LineLengthIn, 4) * state.LineCount);
|
||||
|
||||
int count = BitUtils.DivRoundUp(_size, 4);
|
||||
int count = _size / 4;
|
||||
|
||||
if (_buffer == null || _buffer.Length < count)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|||
|
||||
if (_isLinear && _lineCount == 1)
|
||||
{
|
||||
memoryManager.WriteTrackedResource(_dstGpuVa, data);
|
||||
memoryManager.WriteTrackedResource(_dstGpuVa, data.Slice(0, _lineLengthIn));
|
||||
_context.AdvanceSequence();
|
||||
}
|
||||
else
|
||||
|
@ -224,6 +224,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|||
|
||||
memoryManager.Write(dstAddress, data[srcOffset]);
|
||||
}
|
||||
|
||||
// All lines must be aligned to 4 bytes, as the data is pushed one word at a time.
|
||||
// If our copy length is not a multiple of 4, then we need to skip the padding bytes here.
|
||||
int misalignment = _lineLengthIn & 3;
|
||||
|
||||
if (misalignment != 0)
|
||||
{
|
||||
srcOffset += 4 - misalignment;
|
||||
}
|
||||
}
|
||||
|
||||
_context.AdvanceSequence();
|
||||
|
|
Reference in a new issue