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

@ -56,7 +56,6 @@ namespace Ryujinx.Graphics.Gpu.Image
private const ulong TextureSizeCapacity8GiB = 6 * GiB;
private const ulong TextureSizeCapacity12GiB = 12 * GiB;
private const float MemoryScaleFactor = 0.50f;
private ulong _maxCacheMemoryUsage = DefaultTextureSizeCapacity;

View file

@ -10,7 +10,6 @@ namespace Ryujinx.Graphics.Gpu.Image
static class FormatTable
{
#pragma warning disable IDE0055 // Disable formatting
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
private enum TextureFormat : uint
{
// Formats
@ -249,7 +248,6 @@ namespace Ryujinx.Graphics.Gpu.Image
A5B5G5R1Unorm = A5B5G5R1 | RUnorm | GUnorm | BUnorm | AUnorm, // 0x24913
}
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
private enum VertexAttributeFormat : uint
{
// Width

View file

@ -248,6 +248,7 @@ namespace Ryujinx.Graphics.Gpu.Image
Items = null;
}
_memoryTracking.Dispose();
}
}

View file

@ -175,6 +175,7 @@ namespace Ryujinx.Graphics.Gpu.Image
case SamplerMinFilter.Linear:
return MinFilter.Linear;
}
break;
case SamplerMipFilter.Nearest:
@ -185,6 +186,7 @@ namespace Ryujinx.Graphics.Gpu.Image
case SamplerMinFilter.Linear:
return MinFilter.LinearMipmapNearest;
}
break;
case SamplerMipFilter.Linear:
@ -195,6 +197,7 @@ namespace Ryujinx.Graphics.Gpu.Image
case SamplerMinFilter.Linear:
return MinFilter.LinearMipmapLinear;
}
break;
}

View file

@ -1355,7 +1355,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>True if anisotropic filtering can be forced, false otherwise</returns>
private bool CanTextureForceAnisotropy()
{
if (!(Target == Target.Texture2D || Target == Target.Texture2DArray))
if (Target is not (Target.Texture2D or Target.Texture2DArray))
{
return false;
}
@ -1379,16 +1379,16 @@ namespace Ryujinx.Graphics.Gpu.Image
{
case Target.Texture1D:
case Target.Texture1DArray:
return target == Target.Texture1D || target == Target.Texture1DArray;
return target is Target.Texture1D or Target.Texture1DArray;
case Target.Texture2D:
case Target.Texture2DArray:
return target == Target.Texture2D || target == Target.Texture2DArray;
return target is Target.Texture2D or Target.Texture2DArray;
case Target.Cubemap:
case Target.CubemapArray:
return target == Target.Cubemap || target == Target.CubemapArray;
return target is Target.Cubemap or Target.CubemapArray;
case Target.Texture2DMultisample:
case Target.Texture2DMultisampleArray:
return target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray;
return target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray;
case Target.Texture3D:
return target == Target.Texture3D;
default:

View file

@ -784,8 +784,8 @@ namespace Ryujinx.Graphics.Gpu.Image
samplerHandle = samplerWordOffset;
}
if (handleType == TextureHandleType.SeparateSamplerId ||
handleType == TextureHandleType.SeparateConstantSamplerHandle)
if (handleType is TextureHandleType.SeparateSamplerId or
TextureHandleType.SeparateConstantSamplerHandle)
{
samplerHandle <<= 20;
}

View file

@ -207,8 +207,8 @@ namespace Ryujinx.Graphics.Gpu.Image
return false; // Flushing this format is not supported, as it may have been converted to another host format.
}
if (info.Target == Target.Texture2DMultisample ||
info.Target == Target.Texture2DMultisampleArray)
if (info.Target is Target.Texture2DMultisample or
Target.Texture2DMultisampleArray)
{
return false; // Flushing multisample textures is not supported, the host does not allow getting their data.
}
@ -758,43 +758,45 @@ namespace Ryujinx.Graphics.Gpu.Image
{
case Target.Texture1D:
case Target.Texture1DArray:
result = rhs.Target == Target.Texture1D ||
rhs.Target == Target.Texture1DArray;
result = rhs.Target is Target.Texture1D or
Target.Texture1DArray;
break;
case Target.Texture2D:
result = rhs.Target == Target.Texture2D ||
rhs.Target == Target.Texture2DArray;
result = rhs.Target is Target.Texture2D or
Target.Texture2DArray;
break;
case Target.Texture2DArray:
result = rhs.Target == Target.Texture2D ||
rhs.Target == Target.Texture2DArray;
result = rhs.Target is Target.Texture2D or
Target.Texture2DArray;
if (rhs.Target == Target.Cubemap || rhs.Target == Target.CubemapArray)
if (rhs.Target is Target.Cubemap or Target.CubemapArray)
{
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
}
break;
case Target.Cubemap:
case Target.CubemapArray:
result = rhs.Target == Target.Cubemap ||
rhs.Target == Target.CubemapArray;
result = rhs.Target is Target.Cubemap or
Target.CubemapArray;
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
{
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
}
break;
case Target.Texture2DMultisample:
case Target.Texture2DMultisampleArray:
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
{
return TextureViewCompatibility.CopyOnly;
}
result = rhs.Target == Target.Texture2DMultisample ||
rhs.Target == Target.Texture2DMultisampleArray;
result = rhs.Target is Target.Texture2DMultisample or
Target.Texture2DMultisampleArray;
break;
case Target.Texture3D:

View file

@ -218,7 +218,6 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
/// <summary>
/// Flushes incompatible overlaps if the storage format requires it, and they have been modified.
/// This allows unsupported host formats to accept data written to format aliased textures.
@ -1133,7 +1132,6 @@ namespace Ryujinx.Graphics.Gpu.Image
SignalAllDirty();
}
/// <summary>
/// Removes a view from the group, removing it from all overlap lists.
/// </summary>

View file

@ -216,7 +216,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>The number of texture layers</returns>
public static int GetLayers(Target target, int depthOrLayers)
{
if (target == Target.Texture2DArray || target == Target.Texture2DMultisampleArray)
if (target is Target.Texture2DArray or Target.Texture2DMultisampleArray)
{
return depthOrLayers;
}
@ -241,7 +241,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>The number of texture slices</returns>
public int GetSlices()
{
if (Target == Target.Texture3D || Target == Target.Texture2DArray || Target == Target.Texture2DMultisampleArray)
if (Target is Target.Texture3D or Target.Texture2DArray or Target.Texture2DMultisampleArray)
{
return DepthOrLayers;
}

View file

@ -454,6 +454,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// If this is null, a request was already queued to decrement reference.
texture.DecrementReferenceCount(this, request.ID);
}
continue;
}
}
@ -544,7 +545,7 @@ namespace Ryujinx.Graphics.Gpu.Image
int width = target == Target.TextureBuffer ? descriptor.UnpackBufferTextureWidth() : descriptor.UnpackWidth();
int height = descriptor.UnpackHeight();
if (target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray)
if (target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray)
{
// This is divided back before the backend texture is created.
width *= samplesInX;
@ -699,8 +700,8 @@ namespace Ryujinx.Graphics.Gpu.Image
{
int maxSize = width;
if (target != Target.Texture1D &&
target != Target.Texture1DArray)
if (target is not Target.Texture1D and
not Target.Texture1DArray)
{
maxSize = Math.Max(maxSize, height);
}
@ -761,8 +762,8 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>True if the swizzle component is equal to the red or green, false otherwise</returns>
private static bool IsRG(SwizzleComponent component)
{
return component == SwizzleComponent.Red ||
component == SwizzleComponent.Green;
return component is SwizzleComponent.Red or
SwizzleComponent.Green;
}
/// <summary>