Speed up buffer -> texture copies.

No longer copies byte by byte. Fast path when formats are identical.
This commit is contained in:
riperiperi
2020-05-22 00:17:25 +01:00
parent fc2d5086e7
commit 8a7e25de71
5 changed files with 147 additions and 21 deletions

View File

@ -102,6 +102,23 @@ namespace Ryujinx.Graphics.Texture
return offset;
}
public (int offset, int size) GetRectangleRange(int x, int y, int width, int height)
{
// Justification:
// The offset is a combination of separate x and y parts.
// Both components increase with input and never overlap bits.
// Therefore for each component, the minimum input value is the lowest that component can go. Opposite goes for maximum.
int start = GetOffset(x, y, 0);
int end = GetOffset(x + width, y + height, 0);
return (start, (end - start) + _texBpp);
}
public bool LayoutMatches(BlockLinearLayout other)
{
return _robSize == other._robSize && _sliceSize == other._sliceSize && _texBpp == other._texBpp && _bhMask == other._bhMask && _bdMask == other._bdMask;
}
// Functions for built in iteration.
// Components of the offset can be updated separately, and combined to save some time.