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

@ -84,6 +84,7 @@ namespace Ryujinx.Graphics.OpenGL
{
Logger.Debug?.Print(LogClass.Gpu, $"{type} {severity}: {msg}", "GLDEBUG");
}
break;
}
}

View file

@ -228,14 +228,14 @@ namespace Ryujinx.Graphics.OpenGL
public static bool IsPackedDepthStencil(Format format)
{
return format == Format.D24UnormS8Uint ||
format == Format.D32FloatS8Uint ||
format == Format.S8UintD24Unorm;
return format is Format.D24UnormS8Uint or
Format.D32FloatS8Uint or
Format.S8UintD24Unorm;
}
public static bool IsDepthOnly(Format format)
{
return format == Format.D16Unorm || format == Format.D32Float || format == Format.X8UintD24Unorm;
return format is Format.D16Unorm or Format.D32Float or Format.X8UintD24Unorm;
}
}
}

View file

@ -43,13 +43,13 @@ namespace Ryujinx.Graphics.OpenGL
private static readonly Lazy<GpuVendor> _gpuVendor = new(GetGpuVendor);
private static bool IsIntel => _gpuVendor.Value == GpuVendor.IntelWindows || _gpuVendor.Value == GpuVendor.IntelUnix;
private static bool IsIntel => _gpuVendor.Value is GpuVendor.IntelWindows or GpuVendor.IntelUnix;
public static GpuVendor Vendor => _gpuVendor.Value;
private static readonly Lazy<float> _maxSupportedAnisotropy = new(GL.GetFloat((GetPName)All.MaxTextureMaxAnisotropy));
public static bool UsePersistentBufferForFlush => _gpuVendor.Value == GpuVendor.AmdWindows || _gpuVendor.Value == GpuVendor.Nvidia;
public static bool UsePersistentBufferForFlush => _gpuVendor.Value is GpuVendor.AmdWindows or GpuVendor.Nvidia;
public static bool SupportsAlphaToCoverageDitherControl => _supportsAlphaToCoverageDitherControl.Value;
public static bool SupportsAstcCompression => _supportsAstcCompression.Value;
@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.OpenGL
public static bool SupportsTextureShadowLod => _supportsTextureShadowLod.Value;
public static bool SupportsViewportSwizzle => _supportsViewportSwizzle.Value;
public static bool SupportsMismatchingViewFormat => _gpuVendor.Value != GpuVendor.AmdWindows && _gpuVendor.Value != GpuVendor.IntelWindows;
public static bool SupportsMismatchingViewFormat => _gpuVendor.Value is not GpuVendor.AmdWindows and not GpuVendor.IntelWindows;
public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia;
public static bool RequiresSyncFlush => _gpuVendor.Value == GpuVendor.AmdWindows || IsIntel;
@ -117,11 +117,11 @@ namespace Ryujinx.Graphics.OpenGL
return renderer.Contains("mesa") ? GpuVendor.IntelUnix : GpuVendor.IntelWindows;
}
else if (vendor == "ati technologies inc." || vendor == "advanced micro devices, inc.")
else if (vendor is "ati technologies inc." or "advanced micro devices, inc.")
{
return GpuVendor.AmdWindows;
}
else if (vendor == "amd" || vendor == "x.org")
else if (vendor is "amd" or "x.org")
{
return GpuVendor.AmdUnix;
}

View file

@ -290,7 +290,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
private static FramebufferAttachment AttachmentForFormat(Format format)
{
if (format == Format.D24UnormS8Uint || format == Format.D32FloatS8Uint)
if (format is Format.D24UnormS8Uint or Format.D32FloatS8Uint)
{
return FramebufferAttachment.DepthStencilAttachment;
}

View file

@ -358,7 +358,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
PixelFormat pixelFormat = format.PixelFormat;
PixelType pixelType = format.PixelType;
if (target == TextureTarget.TextureCubeMap || target == TextureTarget.TextureCubeMapArray)
if (target is TextureTarget.TextureCubeMap or TextureTarget.TextureCubeMapArray)
{
target = TextureTarget.TextureCubeMapPositiveX + (layer % 6);
}
@ -568,6 +568,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Texture1DArray:
@ -597,6 +598,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Texture2D:
@ -626,6 +628,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Texture2DArray:
@ -661,6 +664,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Cubemap:
@ -690,6 +694,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
}
}
@ -756,6 +761,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Texture1DArray:
@ -786,6 +792,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Texture2DArray:
@ -821,6 +828,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
format.PixelType,
data);
}
break;
case Target.Cubemap:
@ -855,6 +863,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
data + faceOffset);
}
}
break;
}

View file

@ -31,6 +31,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
long defaultValue = DefaultValue;
GL.BufferStorage(BufferTarget.QueryBuffer, sizeof(long), (nint)(&defaultValue), BufferStorageFlags.MapReadBit | BufferStorageFlags.MapWriteBit | BufferStorageFlags.MapPersistentBit);
}
_bufferMap = GL.MapBufferRange(BufferTarget.QueryBuffer, nint.Zero, sizeof(long), BufferAccessMask.MapReadBit | BufferAccessMask.MapWriteBit | BufferAccessMask.MapPersistentBit);
}

View file

@ -172,6 +172,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
{
return; // If not blocking, then return when we encounter an event that is not ready yet.
}
_events.Dequeue();
}
}

View file

@ -108,6 +108,7 @@ namespace Ryujinx.Graphics.OpenGL
texture.View.Dispose();
}
}
_textures.Clear();
}
}

View file

@ -27,7 +27,6 @@ namespace Ryujinx.Graphics.OpenGL
Handle = GL.FenceSync(SyncCondition.SyncGpuCommandsComplete, WaitSyncFlags.None),
};
if (HwCapabilities.RequiresSyncFlush)
{
// Force commands to flush up to the syncpoint.

View file

@ -104,8 +104,8 @@ namespace Ryujinx.Graphics.OpenGL
int offset = attrib.Offset;
int size = fmtInfo.Components;
bool isFloat = fmtInfo.PixelType == PixelType.Float ||
fmtInfo.PixelType == PixelType.HalfFloat;
bool isFloat = fmtInfo.PixelType is PixelType.Float or
PixelType.HalfFloat;
if (isFloat || fmtInfo.Normalized || fmtInfo.Scaled)
{

View file

@ -340,6 +340,7 @@ namespace Ryujinx.Graphics.OpenGL
_antiAliasing?.Dispose();
_antiAliasing = new SmaaPostProcessingEffect(_renderer, quality);
}
break;
}
}
@ -371,6 +372,7 @@ namespace Ryujinx.Graphics.OpenGL
_scalingFilter?.Dispose();
_scalingFilter = new FsrScalingFilter(_renderer);
}
_isLinear = false;
_scalingFilter.Level = _scalingFilterLevel;
@ -382,6 +384,7 @@ namespace Ryujinx.Graphics.OpenGL
_scalingFilter?.Dispose();
_scalingFilter = new AreaScalingFilter(_renderer);
}
_isLinear = false;
RecreateUpscalingTexture();