diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Vic/Image')
| -rw-r--r-- | src/Ryujinx.Graphics.Vic/Image/BufferPool.cs | 2 | ||||
| -rw-r--r-- | src/Ryujinx.Graphics.Vic/Image/InputSurface.cs | 6 | ||||
| -rw-r--r-- | src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs | 13 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/Ryujinx.Graphics.Vic/Image/BufferPool.cs b/src/Ryujinx.Graphics.Vic/Image/BufferPool.cs index cde7e6eb..1f7dc08a 100644 --- a/src/Ryujinx.Graphics.Vic/Image/BufferPool.cs +++ b/src/Ryujinx.Graphics.Vic/Image/BufferPool.cs @@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Vic.Image { int index = RentMinimum(length, out T[] bufferArray); - buffer = new Span<T>(bufferArray).Slice(0, length); + buffer = new Span<T>(bufferArray)[..length]; return index; } diff --git a/src/Ryujinx.Graphics.Vic/Image/InputSurface.cs b/src/Ryujinx.Graphics.Vic/Image/InputSurface.cs index 15ac0460..04994468 100644 --- a/src/Ryujinx.Graphics.Vic/Image/InputSurface.cs +++ b/src/Ryujinx.Graphics.Vic/Image/InputSurface.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Vic.Image { ref struct RentedBuffer { - public static RentedBuffer Empty => new RentedBuffer(Span<byte>.Empty, -1); + public static RentedBuffer Empty => new(Span<byte>.Empty, -1); public Span<byte> Data; public int Index; @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vic.Image Index = index; } - public void Return(BufferPool<byte> pool) + public readonly void Return(BufferPool<byte> pool) { if (Index != -1) { @@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Vic.Image Buffer2Index = buffer.Index; } - public void Return(BufferPool<byte> pool) + public readonly void Return(BufferPool<byte> pool) { if (Buffer0Index != -1) { diff --git a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs index 10fd9d8d..079b4ef1 100644 --- a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs +++ b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs @@ -21,7 +21,8 @@ namespace Ryujinx.Graphics.Vic.Image { switch (surfaceConfig.SlotPixelFormat) { - case PixelFormat.Y8___V8U8_N420: return ReadNv12(rm, ref config, ref surfaceConfig, ref offsets); + case PixelFormat.Y8___V8U8_N420: + return ReadNv12(rm, ref config, ref surfaceConfig, ref offsets); } Logger.Error?.Print(LogClass.Vic, $"Unsupported pixel format \"{surfaceConfig.SlotPixelFormat}\"."); @@ -46,7 +47,7 @@ namespace Ryujinx.Graphics.Vic.Image int yStride = GetPitch(width, 1); int uvStride = GetPitch(input.UvWidth, 2); - Surface output = new Surface(rm.SurfacePool, width, height); + Surface output = new(rm.SurfacePool, width, height); if (Sse41.IsSupported) { @@ -276,7 +277,7 @@ namespace Ryujinx.Graphics.Vic.Image int bytesPerPixel, int planes) { - InputSurface surface = new InputSurface(); + InputSurface surface = new(); surface.Initialize(); @@ -458,7 +459,7 @@ namespace Ryujinx.Graphics.Vic.Image int outSize = dstStride * height; int bufferIndex = rm.BufferPool.RentMinimum(outSize, out byte[] buffer); Span<byte> dst = buffer; - dst = dst.Slice(0, outSize); + dst = dst[..outSize]; for (int y = 0; y < height; y++) { @@ -485,9 +486,9 @@ namespace Ryujinx.Graphics.Vic.Image int outSize = dstStride * height; int bufferIndex = rm.BufferPool.RentMinimum(outSize, out byte[] buffer); Span<byte> dst = buffer; - dst = dst.Slice(0, outSize); + dst = dst[..outSize]; - LayoutConverter.ConvertBlockLinearToLinear(dst.Slice(dstStart), width, height, dstStride, bytesPerPixel, gobBlocksInY, src); + LayoutConverter.ConvertBlockLinearToLinear(dst[dstStart..], width, height, dstStride, bytesPerPixel, gobBlocksInY, src); return new RentedBuffer(dst, bufferIndex); } |
