Fix ~3500 analyser issues

See merge request ryubing/ryujinx!44
This commit is contained in:
MrKev
2025-05-30 17:08:34 -05:00
committed by LotP
parent 417df486b1
commit 361d0c5632
622 changed files with 3080 additions and 2652 deletions

View File

@@ -336,7 +336,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
public Status SetMaxAcquiredBufferCount(int maxAcquiredBufferCount)
{
if (maxAcquiredBufferCount < 0 || maxAcquiredBufferCount > BufferSlotArray.MaxAcquiredBuffers)
if (maxAcquiredBufferCount is < 0 or > BufferSlotArray.MaxAcquiredBuffers)
{
return Status.BadValue;
}

View File

@@ -126,7 +126,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
BufferState state = Slots[slot].BufferState;
if (state == BufferState.Queued || state == BufferState.Dequeued)
if (state is BufferState.Queued or BufferState.Dequeued)
{
maxBufferCount = slot + 1;
}

View File

@@ -636,6 +636,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
status = Status.Success;
}
break;
}
}
@@ -758,7 +759,6 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
return Status.BadValue;
}
if (maxBufferCount < Core.MaxBufferCountCached)
{
for (int slot = maxBufferCount; slot < Core.MaxBufferCountCached; slot++)
@@ -791,6 +791,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
freeSlot = slot;
}
break;
default:
break;

View File

@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
enum Status
{
Success = 0,

View File

@@ -189,7 +189,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
return Vi.ResultCode.InvalidValue;
}
if (layer.State != LayerState.ManagedClosed && layer.State != LayerState.ManagedOpened)
if (layer.State is not LayerState.ManagedClosed and not LayerState.ManagedOpened)
{
Logger.Error?.Print(LogClass.SurfaceFlinger, $"Failed to destroy managed layer {layerId} (permission denied)");
@@ -393,7 +393,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
PostFrameBuffer(layer, item);
}
else if (acquireStatus != Status.NoBufferAvailaible && acquireStatus != Status.InvalidOperation)
else if (acquireStatus is not Status.NoBufferAvailaible and not Status.InvalidOperation)
{
throw new InvalidOperationException();
}
@@ -421,8 +421,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Format format = ConvertColorFormat(item.GraphicBuffer.Object.Buffer.Surfaces[0].ColorFormat);
byte bytesPerPixel =
format == Format.B5G6R5Unorm ||
format == Format.R4G4B4A4Unorm ? (byte)2 : (byte)4;
format is Format.B5G6R5Unorm or
Format.R4G4B4A4Unorm ? (byte)2 : (byte)4;
int gobBlocksInY = 1 << item.GraphicBuffer.Object.Buffer.Surfaces[0].BlockHeightLog2;

View File

@@ -49,7 +49,6 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Logger.Error?.Print(LogClass.SurfaceFlinger, "Android fence didn't signal in 3000 ms");
Wait(gpuContext, Timeout.InfiniteTimeSpan);
}
}
public bool Wait(GpuContext gpuContext, TimeSpan timeout)

View File

@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
enum ColorFormat : ulong
{
#pragma warning disable IDE0055 // Disable formatting