|
@@ -99,9 +99,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|
|
_isLinear = (argument & 1) != 0;
|
|
_isLinear = (argument & 1) != 0;
|
|
|
|
|
|
|
|
_offset = 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)
|
|
if (_buffer == null || _buffer.Length < count)
|
|
|
{
|
|
{
|
|
@@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|
|
|
|
|
|
|
if (_isLinear && _lineCount == 1)
|
|
if (_isLinear && _lineCount == 1)
|
|
|
{
|
|
{
|
|
|
- memoryManager.WriteTrackedResource(_dstGpuVa, data);
|
|
|
|
|
|
|
+ memoryManager.WriteTrackedResource(_dstGpuVa, data.Slice(0, _lineLengthIn));
|
|
|
_context.AdvanceSequence();
|
|
_context.AdvanceSequence();
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -224,6 +224,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
|
|
|
|
|
|
|
memoryManager.Write(dstAddress, data[srcOffset]);
|
|
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();
|
|
_context.AdvanceSequence();
|