aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-25 18:37:09 +0200
committerGitHub <noreply@github.com>2023-06-25 18:37:09 +0200
commitbc53d0046310293a90a4312fa9317bb698dded5c (patch)
tree1cb49891f7f116f2a872eca9a433102005007033
parentbddb2a148355ef2ce326d47e8e5217bd8af36a98 (diff)
[Ryujinx.Graphics.Vic] Address dotnet-format issues (#5374)1.1.913
* dotnet format style --severity info Some changes were manually reverted. * Restore a few unused methods and variables * Address review comments * Address most dotnet format whitespace warnings * Add comments to disabled warnings * Address IDE0251 warnings * dotnet format whitespace after rebase * Remove SuppressMessage attribute for removed rule
-rw-r--r--src/Ryujinx.Graphics.Vic/Image/BufferPool.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Image/InputSurface.cs6
-rw-r--r--src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs13
-rw-r--r--src/Ryujinx.Graphics.Vic/Rectangle.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Scaler.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/BlendingSlotStruct.cs6
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs8
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs2
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/LumaKeyStruct.cs6
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/MatrixStruct.cs10
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs8
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs8
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs10
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs20
-rw-r--r--src/Ryujinx.Graphics.Vic/Types/SlotSurfaceConfig.cs6
-rw-r--r--src/Ryujinx.Graphics.Vic/VicDevice.cs4
-rw-r--r--src/Ryujinx.Graphics.Vic/VicRegisters.cs4
19 files changed, 62 insertions, 59 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);
}
diff --git a/src/Ryujinx.Graphics.Vic/Rectangle.cs b/src/Ryujinx.Graphics.Vic/Rectangle.cs
index 8a8dd63a..b12560bd 100644
--- a/src/Ryujinx.Graphics.Vic/Rectangle.cs
+++ b/src/Ryujinx.Graphics.Vic/Rectangle.cs
@@ -15,4 +15,4 @@ namespace Ryujinx.Graphics.Vic
Height = height;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Vic/Scaler.cs b/src/Ryujinx.Graphics.Vic/Scaler.cs
index 18ae66c4..7d539299 100644
--- a/src/Ryujinx.Graphics.Vic/Scaler.cs
+++ b/src/Ryujinx.Graphics.Vic/Scaler.cs
@@ -121,4 +121,4 @@ namespace Ryujinx.Graphics.Vic
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Vic/Types/BlendingSlotStruct.cs b/src/Ryujinx.Graphics.Vic/Types/BlendingSlotStruct.cs
index 86da41d2..2cc6b1e2 100644
--- a/src/Ryujinx.Graphics.Vic/Types/BlendingSlotStruct.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/BlendingSlotStruct.cs
@@ -2,10 +2,10 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct BlendingSlotStruct
+ readonly struct BlendingSlotStruct
{
- private long _word0;
- private long _word1;
+ private readonly long _word0;
+ private readonly long _word1;
public int AlphaK1 => (int)_word0.Extract(0, 10);
public int AlphaK2 => (int)_word0.Extract(16, 10);
diff --git a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs
index ae582a92..da9888f7 100644
--- a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs
@@ -2,11 +2,11 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct ClearRectStruct
+ readonly struct ClearRectStruct
{
-#pragma warning disable CS0649
- private long _word0;
- private long _word1;
+#pragma warning disable CS0649 // Field is never assigned to
+ private readonly long _word0;
+ private readonly long _word1;
#pragma warning restore CS0649
public int ClearRect0Left => (int)_word0.Extract(0, 14);
diff --git a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs
index 5edc8183..bf94606c 100644
--- a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs
@@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Vic.Types
{
struct ConfigStruct
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public PipeConfig PipeConfig;
public OutputConfig OutputConfig;
public OutputSurfaceConfig OutputSurfaceConfig;
diff --git a/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs b/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs
index aa0654f0..216995b3 100644
--- a/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs
@@ -9,4 +9,4 @@ namespace Ryujinx.Graphics.Vic.Types
Disi1,
WeaveLumaBobFieldChroma
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs b/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs
index 91f5751b..f6007f92 100644
--- a/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs
@@ -76,4 +76,4 @@ namespace Ryujinx.Graphics.Vic.Types
return false;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Vic/Types/LumaKeyStruct.cs b/src/Ryujinx.Graphics.Vic/Types/LumaKeyStruct.cs
index 5d83bd71..0cb5e6d9 100644
--- a/src/Ryujinx.Graphics.Vic/Types/LumaKeyStruct.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/LumaKeyStruct.cs
@@ -2,10 +2,10 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct LumaKeyStruct
+ readonly struct LumaKeyStruct
{
- private long _word0;
- private long _word1;
+ private readonly long _word0;
+ private readonly long _word1;
public int LumaCoeff0 => (int)_word0.Extract(0, 20);
public int LumaCoeff1 => (int)_word0.Extract(20, 20);
diff --git a/src/Ryujinx.Graphics.Vic/Types/MatrixStruct.cs b/src/Ryujinx.Graphics.Vic/Types/MatrixStruct.cs
index c0a4c34e..f89a142f 100644
--- a/src/Ryujinx.Graphics.Vic/Types/MatrixStruct.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/MatrixStruct.cs
@@ -2,12 +2,12 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct MatrixStruct
+ readonly struct MatrixStruct
{
- private long _word0;
- private long _word1;
- private long _word2;
- private long _word3;
+ private readonly long _word0;
+ private readonly long _word1;
+ private readonly long _word2;
+ private readonly long _word3;
public int MatrixCoeff00 => (int)_word0.ExtractSx(0, 20);
public int MatrixCoeff10 => (int)_word0.ExtractSx(20, 20);
diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs
index 7b866994..10ceb240 100644
--- a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs
@@ -2,11 +2,11 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct OutputConfig
+ readonly struct OutputConfig
{
-#pragma warning disable CS0649
- private long _word0;
- private long _word1;
+#pragma warning disable CS0649 // Field is never assigned to
+ private readonly long _word0;
+ private readonly long _word1;
#pragma warning restore CS0649
public int AlphaFillMode => (int)_word0.Extract(0, 3);
diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs
index 6a8b21e1..ad236882 100644
--- a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs
@@ -2,11 +2,11 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct OutputSurfaceConfig
+ readonly struct OutputSurfaceConfig
{
-#pragma warning disable CS0649
- private long _word0;
- private long _word1;
+#pragma warning disable CS0649 // Field is never assigned to
+ private readonly long _word0;
+ private readonly long _word1;
#pragma warning restore CS0649
public PixelFormat OutPixelFormat => (PixelFormat)_word0.Extract(0, 7);
diff --git a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs
index 76720eb1..408bd83e 100644
--- a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs
@@ -2,12 +2,12 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct PipeConfig
+ readonly struct PipeConfig
{
-#pragma warning disable CS0169, CS0649
- private long _word0;
- private long _word1;
-#pragma warning restore CS0169, CS0649
+#pragma warning disable CS0169, CS0649, IDE0051 // Remove unused private member
+ private readonly long _word0;
+ private readonly long _word1;
+#pragma warning restore CS0169, CS0649, IDE0051
public int DownsampleHoriz => (int)_word0.Extract(0, 11);
public int DownsampleVert => (int)_word0.Extract(16, 11);
diff --git a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs
index aba61add..4031bf99 100644
--- a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs
@@ -2,16 +2,18 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct SlotConfig
+ readonly struct SlotConfig
{
- private long _word0;
- private long _word1;
- private long _word2;
- private long _word3;
- private long _word4;
- private long _word5;
- private long _word6;
- private long _word7;
+ private readonly long _word0;
+ private readonly long _word1;
+ private readonly long _word2;
+ private readonly long _word3;
+ private readonly long _word4;
+ private readonly long _word5;
+ private readonly long _word6;
+#pragma warning disable IDE0051 // Remove unused private member
+ private readonly long _word7;
+#pragma warning restore IDE0051
public bool SlotEnable => _word0.Extract(0);
public bool DeNoise => _word0.Extract(1);
diff --git a/src/Ryujinx.Graphics.Vic/Types/SlotSurfaceConfig.cs b/src/Ryujinx.Graphics.Vic/Types/SlotSurfaceConfig.cs
index 4492c85f..0be0d4f4 100644
--- a/src/Ryujinx.Graphics.Vic/Types/SlotSurfaceConfig.cs
+++ b/src/Ryujinx.Graphics.Vic/Types/SlotSurfaceConfig.cs
@@ -2,10 +2,10 @@
namespace Ryujinx.Graphics.Vic.Types
{
- struct SlotSurfaceConfig
+ readonly struct SlotSurfaceConfig
{
- private long _word0;
- private long _word1;
+ private readonly long _word0;
+ private readonly long _word1;
public PixelFormat SlotPixelFormat => (PixelFormat)_word0.Extract(0, 7);
public int SlotChromaLocHoriz => (int)_word0.Extract(7, 2);
diff --git a/src/Ryujinx.Graphics.Vic/VicDevice.cs b/src/Ryujinx.Graphics.Vic/VicDevice.cs
index 8b66727d..b2bc98d8 100644
--- a/src/Ryujinx.Graphics.Vic/VicDevice.cs
+++ b/src/Ryujinx.Graphics.Vic/VicDevice.cs
@@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Vic
{
ConfigStruct config = ReadIndirect<ConfigStruct>(_state.State.SetConfigStructOffset);
- using Surface output = new Surface(
+ using Surface output = new(
_rm.SurfacePool,
config.OutputSurfaceConfig.OutSurfaceWidth + 1,
config.OutputSurfaceConfig.OutSurfaceHeight + 1);
@@ -58,7 +58,7 @@ namespace Ryujinx.Graphics.Vic
int targetW = Math.Min(output.Width - targetX, Math.Abs(x2 - x1));
int targetH = Math.Min(output.Height - targetY, Math.Abs(y2 - y1));
- Rectangle targetRect = new Rectangle(targetX, targetY, targetW, targetH);
+ Rectangle targetRect = new(targetX, targetY, targetW, targetH);
Blender.BlendOne(output, src, ref slot, targetRect);
}
diff --git a/src/Ryujinx.Graphics.Vic/VicRegisters.cs b/src/Ryujinx.Graphics.Vic/VicRegisters.cs
index 1c11b554..1e002839 100644
--- a/src/Ryujinx.Graphics.Vic/VicRegisters.cs
+++ b/src/Ryujinx.Graphics.Vic/VicRegisters.cs
@@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Vic
{
struct PlaneOffsets
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint LumaOffset;
public uint ChromaUOffset;
public uint ChromaVOffset;
@@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Vic
struct VicRegisters
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Array64<uint> Reserved0;
public uint Nop;
public Array15<uint> Reserved104;