Fix lineSize for LinearStrided -> Linear conversion (#2091)

Fixes a possible crash when width is greater than stride, which can happen due to alignment when copying textures.
This commit is contained in:
riperiperi 2021-03-10 00:24:46 +00:00 committed by GitHub
parent ede26556f2
commit dbce3455ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,7 +256,7 @@ namespace Ryujinx.Graphics.Texture
int h = BitUtils.DivRoundUp(height, blockHeight); int h = BitUtils.DivRoundUp(height, blockHeight);
int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment); int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment);
int lineSize = w * bytesPerPixel; int lineSize = Math.Min(stride, outStride);
Span<byte> output = new byte[h * outStride]; Span<byte> output = new byte[h * outStride];