From 7c989f88bdab65dfa7783e824a180220ba829bd0 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 28 Jun 2023 20:20:10 +0200 Subject: [PATCH] [Ryujinx.Graphics.GAL] Address dotnet-format issues (#5366) * dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1069 warnings * Address remaining dotnet format analyzer warnings * Address review comments * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Revert formatting changes for while and for-loops * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Address review feedback * Add trailing commas * Remove SuppressMessage for IDE0066 * Make explicit Equals implementation implicit --- src/Ryujinx.Graphics.GAL/AddressMode.cs | 4 +- .../AdvancedBlendDescriptor.cs | 2 +- src/Ryujinx.Graphics.GAL/AdvancedBlendOp.cs | 4 +- .../AdvancedBlendOverlap.cs | 2 +- src/Ryujinx.Graphics.GAL/AntiAliasing.cs | 2 +- src/Ryujinx.Graphics.GAL/BlendDescriptor.cs | 22 +++--- src/Ryujinx.Graphics.GAL/BlendFactor.cs | 36 ++++----- src/Ryujinx.Graphics.GAL/BlendOp.cs | 10 +-- src/Ryujinx.Graphics.GAL/BufferAccess.cs | 2 +- src/Ryujinx.Graphics.GAL/BufferAssignment.cs | 2 +- src/Ryujinx.Graphics.GAL/BufferHandle.cs | 2 +- src/Ryujinx.Graphics.GAL/BufferRange.cs | 8 +- src/Ryujinx.Graphics.GAL/Capabilities.cs | 2 +- src/Ryujinx.Graphics.GAL/CompareMode.cs | 4 +- src/Ryujinx.Graphics.GAL/CompareOp.cs | 16 ++-- src/Ryujinx.Graphics.GAL/CounterType.cs | 4 +- src/Ryujinx.Graphics.GAL/DepthMode.cs | 4 +- src/Ryujinx.Graphics.GAL/DepthStencilMode.cs | 4 +- .../DepthTestDescriptor.cs | 10 +-- src/Ryujinx.Graphics.GAL/DeviceInfo.cs | 2 +- src/Ryujinx.Graphics.GAL/Extents2D.cs | 6 +- src/Ryujinx.Graphics.GAL/Extents2DF.cs | 2 +- src/Ryujinx.Graphics.GAL/Face.cs | 8 +- src/Ryujinx.Graphics.GAL/Format.cs | 4 +- src/Ryujinx.Graphics.GAL/FrontFace.cs | 6 +- src/Ryujinx.Graphics.GAL/ISampler.cs | 2 +- src/Ryujinx.Graphics.GAL/ITexture.cs | 3 +- src/Ryujinx.Graphics.GAL/ImageCrop.cs | 44 +++++------ src/Ryujinx.Graphics.GAL/IndexType.cs | 4 +- src/Ryujinx.Graphics.GAL/LogicalOp.cs | 2 +- src/Ryujinx.Graphics.GAL/MagFilter.cs | 4 +- src/Ryujinx.Graphics.GAL/MinFilter.cs | 4 +- .../Multithreading/BufferMap.cs | 24 +++--- .../Multithreading/CommandHelper.cs | 6 +- .../Multithreading/CommandType.cs | 2 +- .../Multithreading/Commands/BarrierCommand.cs | 2 +- .../Commands/BeginTransformFeedbackCommand.cs | 2 +- .../Commands/Buffer/BufferDisposeCommand.cs | 2 +- .../Commands/Buffer/BufferGetDataCommand.cs | 3 +- .../Commands/Buffer/BufferSetDataCommand.cs | 2 +- .../Commands/ClearBufferCommand.cs | 2 +- .../Commands/ClearRenderTargetColorCommand.cs | 2 +- .../ClearRenderTargetDepthStencilCommand.cs | 2 +- .../Commands/CommandBufferBarrierCommand.cs | 2 +- .../Commands/CopyBufferCommand.cs | 2 +- .../CounterEventDisposeCommand.cs | 2 +- .../CounterEvent/CounterEventFlushCommand.cs | 2 +- .../Commands/DispatchComputeCommand.cs | 2 +- .../Multithreading/Commands/DrawCommand.cs | 2 +- .../Commands/DrawIndexedCommand.cs | 2 +- .../Commands/DrawIndexedIndirectCommand.cs | 2 +- .../DrawIndexedIndirectCountCommand.cs | 2 +- .../Commands/DrawIndirectCommand.cs | 2 +- .../Commands/DrawIndirectCountCommand.cs | 2 +- .../Commands/DrawTextureCommand.cs | 2 +- .../EndHostConditionalRenderingCommand.cs | 2 +- .../Commands/EndTransformFeedbackCommand.cs | 2 +- .../Program/ProgramCheckLinkCommand.cs | 2 +- .../Commands/Program/ProgramDisposeCommand.cs | 2 +- .../Program/ProgramGetBinaryCommand.cs | 2 +- .../Commands/Renderer/ActionCommand.cs | 2 +- .../Renderer/CreateBufferAccessCommand.cs | 2 +- .../Commands/Renderer/CreateBufferCommand.cs | 2 +- .../Renderer/CreateHostBufferCommand.cs | 2 +- .../Commands/Renderer/CreateProgramCommand.cs | 2 +- .../Commands/Renderer/CreateSamplerCommand.cs | 2 +- .../Commands/Renderer/CreateSyncCommand.cs | 2 +- .../Commands/Renderer/CreateTextureCommand.cs | 2 +- .../Renderer/GetCapabilitiesCommand.cs | 2 +- .../Commands/Renderer/PreFrameCommand.cs | 2 +- .../Commands/Renderer/ReportCounterCommand.cs | 2 +- .../Commands/Renderer/ResetCounterCommand.cs | 2 +- .../Renderer/UpdateCountersCommand.cs | 2 +- .../Commands/Sampler/SamplerDisposeCommand.cs | 2 +- .../Commands/SetAlphaTestCommand.cs | 2 +- .../Commands/SetBlendStateAdvancedCommand.cs | 2 +- .../Commands/SetBlendStateCommand.cs | 2 +- .../Commands/SetDepthBiasCommand.cs | 2 +- .../Commands/SetDepthClampCommand.cs | 2 +- .../Commands/SetDepthModeCommand.cs | 2 +- .../Commands/SetDepthTestCommand.cs | 2 +- .../Commands/SetFaceCullingCommand.cs | 2 +- .../Commands/SetFrontFaceCommand.cs | 2 +- .../Commands/SetImageCommand.cs | 2 +- .../Commands/SetIndexBufferCommand.cs | 2 +- .../Commands/SetLineParametersCommand.cs | 2 +- .../Commands/SetLogicOpStateCommand.cs | 2 +- .../Commands/SetMultisampleStateCommand.cs | 2 +- .../Commands/SetPatchParametersCommand.cs | 2 +- .../Commands/SetPointParametersCommand.cs | 2 +- .../Commands/SetPolygonModeCommand.cs | 2 +- .../Commands/SetPrimitiveRestartCommand.cs | 2 +- .../Commands/SetPrimitiveTopologyCommand.cs | 2 +- .../Commands/SetProgramCommand.cs | 2 +- .../Commands/SetRasterizerDiscardCommand.cs | 2 +- .../SetRenderTargetColorMasksCommand.cs | 2 +- .../Commands/SetRenderTargetScaleCommand.cs | 2 +- .../Commands/SetRenderTargetsCommand.cs | 2 +- .../Commands/SetScissorsCommand.cs | 2 +- .../Commands/SetStencilTestCommand.cs | 2 +- .../Commands/SetStorageBuffersCommand.cs | 2 +- .../Commands/SetTextureAndSamplerCommand.cs | 2 +- .../SetTransformFeedbackBuffersCommand.cs | 2 +- .../Commands/SetUniformBuffersCommand.cs | 2 +- .../Commands/SetUserClipDistanceCommand.cs | 2 +- .../Commands/SetVertexAttribsCommand.cs | 2 +- .../Commands/SetVertexBuffersCommand.cs | 2 +- .../Commands/SetViewportsCommand.cs | 2 +- .../Texture/TextureCopyToBufferCommand.cs | 2 +- .../Commands/Texture/TextureCopyToCommand.cs | 2 +- .../Texture/TextureCopyToScaledCommand.cs | 2 +- .../Texture/TextureCopyToSliceCommand.cs | 2 +- .../Texture/TextureCreateViewCommand.cs | 2 +- .../Commands/Texture/TextureGetDataCommand.cs | 3 +- .../Texture/TextureGetDataSliceCommand.cs | 3 +- .../Commands/Texture/TextureReleaseCommand.cs | 2 +- .../Commands/Texture/TextureSetDataCommand.cs | 2 +- .../Texture/TextureSetDataSliceCommand.cs | 2 +- .../TextureSetDataSliceRegionCommand.cs | 2 +- .../Texture/TextureSetStorageCommand.cs | 2 +- .../Commands/TextureBarrierCommand.cs | 2 +- .../Commands/TextureBarrierTiledCommand.cs | 2 +- .../TryHostConditionalRenderingCommand.cs | 2 +- ...TryHostConditionalRenderingFlushCommand.cs | 2 +- .../Commands/UpdateRenderScaleCommand.cs | 2 +- .../Commands/Window/WindowPresentCommand.cs | 2 +- .../Multithreading/Model/CircularSpanPool.cs | 8 +- .../Multithreading/Model/SpanRef.cs | 4 +- .../Multithreading/Model/TableRef.cs | 4 +- .../Multithreading/Resources/ProgramQueue.cs | 6 +- .../Programs/BinaryProgramRequest.cs | 4 +- .../Programs/SourceProgramRequest.cs | 2 +- .../Resources/ThreadedCounterEvent.cs | 2 +- .../Resources/ThreadedProgram.cs | 6 +- .../Resources/ThreadedSampler.cs | 2 +- .../Resources/ThreadedTexture.cs | 11 ++- .../Multithreading/SyncMap.cs | 4 +- .../Multithreading/ThreadedPipeline.cs | 8 +- .../Multithreading/ThreadedRenderer.cs | 52 ++++++------ .../Multithreading/ThreadedWindow.cs | 4 +- src/Ryujinx.Graphics.GAL/Origin.cs | 2 +- src/Ryujinx.Graphics.GAL/PinnedSpan.cs | 8 +- src/Ryujinx.Graphics.GAL/PolygonMode.cs | 2 +- src/Ryujinx.Graphics.GAL/PolygonModeMask.cs | 4 +- src/Ryujinx.Graphics.GAL/PrimitiveTopology.cs | 2 +- src/Ryujinx.Graphics.GAL/ProgramLinkStatus.cs | 2 +- src/Ryujinx.Graphics.GAL/ResourceLayout.cs | 38 ++++++++- src/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs | 52 ++++++------ .../ScreenCaptureImageInfo.cs | 22 +++--- src/Ryujinx.Graphics.GAL/ShaderInfo.cs | 2 +- src/Ryujinx.Graphics.GAL/ShaderSource.cs | 2 +- src/Ryujinx.Graphics.GAL/StencilOp.cs | 14 ++-- .../StencilTestDescriptor.cs | 70 ++++++++-------- .../SupportBufferUpdater.cs | 7 +- src/Ryujinx.Graphics.GAL/SwizzleComponent.cs | 4 +- src/Ryujinx.Graphics.GAL/Target.cs | 4 +- src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs | 79 +++++++++++-------- src/Ryujinx.Graphics.GAL/UpscaleType.cs | 4 +- .../VertexBufferDescriptor.cs | 6 +- src/Ryujinx.Graphics.GAL/Viewport.cs | 26 +++--- src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs | 5 +- 161 files changed, 481 insertions(+), 439 deletions(-) diff --git a/src/Ryujinx.Graphics.GAL/AddressMode.cs b/src/Ryujinx.Graphics.GAL/AddressMode.cs index 153925b1..bf7d0393 100644 --- a/src/Ryujinx.Graphics.GAL/AddressMode.cs +++ b/src/Ryujinx.Graphics.GAL/AddressMode.cs @@ -9,6 +9,6 @@ namespace Ryujinx.Graphics.GAL Clamp, MirrorClampToEdge, MirrorClampToBorder, - MirrorClamp + MirrorClamp, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/AdvancedBlendDescriptor.cs b/src/Ryujinx.Graphics.GAL/AdvancedBlendDescriptor.cs index 1f1f7c3f..e91d9caa 100644 --- a/src/Ryujinx.Graphics.GAL/AdvancedBlendDescriptor.cs +++ b/src/Ryujinx.Graphics.GAL/AdvancedBlendDescriptor.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Graphics.GAL { - public struct AdvancedBlendDescriptor + public readonly struct AdvancedBlendDescriptor { public AdvancedBlendOp Op { get; } public AdvancedBlendOverlap Overlap { get; } diff --git a/src/Ryujinx.Graphics.GAL/AdvancedBlendOp.cs b/src/Ryujinx.Graphics.GAL/AdvancedBlendOp.cs index 4140bf49..2c7654f0 100644 --- a/src/Ryujinx.Graphics.GAL/AdvancedBlendOp.cs +++ b/src/Ryujinx.Graphics.GAL/AdvancedBlendOp.cs @@ -47,6 +47,6 @@ namespace Ryujinx.Graphics.GAL HslHue, HslSaturation, HslColor, - HslLuminosity + HslLuminosity, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/AdvancedBlendOverlap.cs b/src/Ryujinx.Graphics.GAL/AdvancedBlendOverlap.cs index d4feb2b3..abd95704 100644 --- a/src/Ryujinx.Graphics.GAL/AdvancedBlendOverlap.cs +++ b/src/Ryujinx.Graphics.GAL/AdvancedBlendOverlap.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Graphics.GAL { Uncorrelated, Disjoint, - Conjoint + Conjoint, } } diff --git a/src/Ryujinx.Graphics.GAL/AntiAliasing.cs b/src/Ryujinx.Graphics.GAL/AntiAliasing.cs index d4e5754d..9f526909 100644 --- a/src/Ryujinx.Graphics.GAL/AntiAliasing.cs +++ b/src/Ryujinx.Graphics.GAL/AntiAliasing.cs @@ -7,6 +7,6 @@ SmaaLow, SmaaMedium, SmaaHigh, - SmaaUltra + SmaaUltra, } } diff --git a/src/Ryujinx.Graphics.GAL/BlendDescriptor.cs b/src/Ryujinx.Graphics.GAL/BlendDescriptor.cs index 83b8afe2..d9cf3e49 100644 --- a/src/Ryujinx.Graphics.GAL/BlendDescriptor.cs +++ b/src/Ryujinx.Graphics.GAL/BlendDescriptor.cs @@ -4,30 +4,30 @@ namespace Ryujinx.Graphics.GAL { public bool Enable { get; } - public ColorF BlendConstant { get; } - public BlendOp ColorOp { get; } + public ColorF BlendConstant { get; } + public BlendOp ColorOp { get; } public BlendFactor ColorSrcFactor { get; } public BlendFactor ColorDstFactor { get; } - public BlendOp AlphaOp { get; } + public BlendOp AlphaOp { get; } public BlendFactor AlphaSrcFactor { get; } public BlendFactor AlphaDstFactor { get; } public BlendDescriptor( - bool enable, - ColorF blendConstant, - BlendOp colorOp, + bool enable, + ColorF blendConstant, + BlendOp colorOp, BlendFactor colorSrcFactor, BlendFactor colorDstFactor, - BlendOp alphaOp, + BlendOp alphaOp, BlendFactor alphaSrcFactor, BlendFactor alphaDstFactor) { - Enable = enable; - BlendConstant = blendConstant; - ColorOp = colorOp; + Enable = enable; + BlendConstant = blendConstant; + ColorOp = colorOp; ColorSrcFactor = colorSrcFactor; ColorDstFactor = colorDstFactor; - AlphaOp = alphaOp; + AlphaOp = alphaOp; AlphaSrcFactor = alphaSrcFactor; AlphaDstFactor = alphaDstFactor; } diff --git a/src/Ryujinx.Graphics.GAL/BlendFactor.cs b/src/Ryujinx.Graphics.GAL/BlendFactor.cs index 4149ad51..1dba229d 100644 --- a/src/Ryujinx.Graphics.GAL/BlendFactor.cs +++ b/src/Ryujinx.Graphics.GAL/BlendFactor.cs @@ -22,21 +22,21 @@ namespace Ryujinx.Graphics.GAL ConstantAlpha, OneMinusConstantAlpha, - ZeroGl = 0x4000, - OneGl = 0x4001, - SrcColorGl = 0x4300, - OneMinusSrcColorGl = 0x4301, - SrcAlphaGl = 0x4302, - OneMinusSrcAlphaGl = 0x4303, - DstAlphaGl = 0x4304, - OneMinusDstAlphaGl = 0x4305, - DstColorGl = 0x4306, - OneMinusDstColorGl = 0x4307, - SrcAlphaSaturateGl = 0x4308, - Src1ColorGl = 0xc900, - OneMinusSrc1ColorGl = 0xc901, - Src1AlphaGl = 0xc902, - OneMinusSrc1AlphaGl = 0xc903 + ZeroGl = 0x4000, + OneGl = 0x4001, + SrcColorGl = 0x4300, + OneMinusSrcColorGl = 0x4301, + SrcAlphaGl = 0x4302, + OneMinusSrcAlphaGl = 0x4303, + DstAlphaGl = 0x4304, + OneMinusDstAlphaGl = 0x4305, + DstColorGl = 0x4306, + OneMinusDstColorGl = 0x4307, + SrcAlphaSaturateGl = 0x4308, + Src1ColorGl = 0xc900, + OneMinusSrc1ColorGl = 0xc901, + Src1AlphaGl = 0xc902, + OneMinusSrc1AlphaGl = 0xc903, } public static class BlendFactorExtensions @@ -54,9 +54,9 @@ namespace Ryujinx.Graphics.GAL case BlendFactor.OneMinusSrc1Alpha: case BlendFactor.OneMinusSrc1AlphaGl: return true; + default: + return false; } - - return false; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/BlendOp.cs b/src/Ryujinx.Graphics.GAL/BlendOp.cs index b4a5a930..c3b67073 100644 --- a/src/Ryujinx.Graphics.GAL/BlendOp.cs +++ b/src/Ryujinx.Graphics.GAL/BlendOp.cs @@ -8,10 +8,10 @@ namespace Ryujinx.Graphics.GAL Minimum, Maximum, - AddGl = 0x8006, - MinimumGl = 0x8007, - MaximumGl = 0x8008, - SubtractGl = 0x800a, - ReverseSubtractGl = 0x800b + AddGl = 0x8006, + MinimumGl = 0x8007, + MaximumGl = 0x8008, + SubtractGl = 0x800a, + ReverseSubtractGl = 0x800b, } } diff --git a/src/Ryujinx.Graphics.GAL/BufferAccess.cs b/src/Ryujinx.Graphics.GAL/BufferAccess.cs index 3a2d6c9b..2f7d994f 100644 --- a/src/Ryujinx.Graphics.GAL/BufferAccess.cs +++ b/src/Ryujinx.Graphics.GAL/BufferAccess.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.GAL public enum BufferAccess { Default, - FlushPersistent + FlushPersistent, } } diff --git a/src/Ryujinx.Graphics.GAL/BufferAssignment.cs b/src/Ryujinx.Graphics.GAL/BufferAssignment.cs index d803d90b..d129135e 100644 --- a/src/Ryujinx.Graphics.GAL/BufferAssignment.cs +++ b/src/Ryujinx.Graphics.GAL/BufferAssignment.cs @@ -11,4 +11,4 @@ Range = range; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/BufferHandle.cs b/src/Ryujinx.Graphics.GAL/BufferHandle.cs index 5ba50d19..a2adea56 100644 --- a/src/Ryujinx.Graphics.GAL/BufferHandle.cs +++ b/src/Ryujinx.Graphics.GAL/BufferHandle.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.GAL { private readonly ulong _value; - public static BufferHandle Null => new BufferHandle(0); + public static BufferHandle Null => new(0); private BufferHandle(ulong value) => _value = value; } diff --git a/src/Ryujinx.Graphics.GAL/BufferRange.cs b/src/Ryujinx.Graphics.GAL/BufferRange.cs index ad9ebee4..483747f1 100644 --- a/src/Ryujinx.Graphics.GAL/BufferRange.cs +++ b/src/Ryujinx.Graphics.GAL/BufferRange.cs @@ -2,20 +2,20 @@ namespace Ryujinx.Graphics.GAL { public readonly struct BufferRange { - private static readonly BufferRange _empty = new BufferRange(BufferHandle.Null, 0, 0); + private static readonly BufferRange _empty = new(BufferHandle.Null, 0, 0); public static BufferRange Empty => _empty; public BufferHandle Handle { get; } public int Offset { get; } - public int Size { get; } + public int Size { get; } public BufferRange(BufferHandle handle, int offset, int size) { Handle = handle; Offset = offset; - Size = size; + Size = size; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Capabilities.cs b/src/Ryujinx.Graphics.GAL/Capabilities.cs index ef2da0b7..3c49a7dc 100644 --- a/src/Ryujinx.Graphics.GAL/Capabilities.cs +++ b/src/Ryujinx.Graphics.GAL/Capabilities.cs @@ -149,4 +149,4 @@ namespace Ryujinx.Graphics.GAL GatherBiasPrecision = gatherBiasPrecision; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/CompareMode.cs b/src/Ryujinx.Graphics.GAL/CompareMode.cs index 7a64d9bb..42ab14d6 100644 --- a/src/Ryujinx.Graphics.GAL/CompareMode.cs +++ b/src/Ryujinx.Graphics.GAL/CompareMode.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.GAL public enum CompareMode { None, - CompareRToTexture + CompareRToTexture, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/CompareOp.cs b/src/Ryujinx.Graphics.GAL/CompareOp.cs index 358ed2b4..8141ecca 100644 --- a/src/Ryujinx.Graphics.GAL/CompareOp.cs +++ b/src/Ryujinx.Graphics.GAL/CompareOp.cs @@ -11,13 +11,13 @@ namespace Ryujinx.Graphics.GAL GreaterOrEqual, Always, - NeverGl = 0x200, - LessGl = 0x201, - EqualGl = 0x202, - LessOrEqualGl = 0x203, - GreaterGl = 0x204, - NotEqualGl = 0x205, + NeverGl = 0x200, + LessGl = 0x201, + EqualGl = 0x202, + LessOrEqualGl = 0x203, + GreaterGl = 0x204, + NotEqualGl = 0x205, GreaterOrEqualGl = 0x206, - AlwaysGl = 0x207, + AlwaysGl = 0x207, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/CounterType.cs b/src/Ryujinx.Graphics.GAL/CounterType.cs index 9d7b3b98..58a4254b 100644 --- a/src/Ryujinx.Graphics.GAL/CounterType.cs +++ b/src/Ryujinx.Graphics.GAL/CounterType.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Graphics.GAL { SamplesPassed, PrimitivesGenerated, - TransformFeedbackPrimitivesWritten + TransformFeedbackPrimitivesWritten, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/DepthMode.cs b/src/Ryujinx.Graphics.GAL/DepthMode.cs index aafbb65a..52a3d9cf 100644 --- a/src/Ryujinx.Graphics.GAL/DepthMode.cs +++ b/src/Ryujinx.Graphics.GAL/DepthMode.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.GAL public enum DepthMode { MinusOneToOne, - ZeroToOne + ZeroToOne, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/DepthStencilMode.cs b/src/Ryujinx.Graphics.GAL/DepthStencilMode.cs index e80d0d4b..1031355f 100644 --- a/src/Ryujinx.Graphics.GAL/DepthStencilMode.cs +++ b/src/Ryujinx.Graphics.GAL/DepthStencilMode.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.GAL public enum DepthStencilMode { Depth, - Stencil + Stencil, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs b/src/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs index 4c593392..d0edb603 100644 --- a/src/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs +++ b/src/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs @@ -2,19 +2,19 @@ namespace Ryujinx.Graphics.GAL { public readonly struct DepthTestDescriptor { - public bool TestEnable { get; } + public bool TestEnable { get; } public bool WriteEnable { get; } public CompareOp Func { get; } public DepthTestDescriptor( - bool testEnable, - bool writeEnable, + bool testEnable, + bool writeEnable, CompareOp func) { - TestEnable = testEnable; + TestEnable = testEnable; WriteEnable = writeEnable; - Func = func; + Func = func; } } } diff --git a/src/Ryujinx.Graphics.GAL/DeviceInfo.cs b/src/Ryujinx.Graphics.GAL/DeviceInfo.cs index eb4a016f..04258460 100644 --- a/src/Ryujinx.Graphics.GAL/DeviceInfo.cs +++ b/src/Ryujinx.Graphics.GAL/DeviceInfo.cs @@ -15,4 +15,4 @@ namespace Ryujinx.Graphics.GAL IsDiscrete = isDiscrete; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Extents2D.cs b/src/Ryujinx.Graphics.GAL/Extents2D.cs index bac44f83..96fbc0f7 100644 --- a/src/Ryujinx.Graphics.GAL/Extents2D.cs +++ b/src/Ryujinx.Graphics.GAL/Extents2D.cs @@ -20,12 +20,12 @@ namespace Ryujinx.Graphics.GAL public Extents2D Reduce(int level) { int div = 1 << level; - + return new Extents2D( - X1 >> level, + X1 >> level, Y1 >> level, BitUtils.DivRoundUp(X2, div), BitUtils.DivRoundUp(Y2, div)); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Extents2DF.cs b/src/Ryujinx.Graphics.GAL/Extents2DF.cs index 43f0e25e..116e998e 100644 --- a/src/Ryujinx.Graphics.GAL/Extents2DF.cs +++ b/src/Ryujinx.Graphics.GAL/Extents2DF.cs @@ -15,4 +15,4 @@ namespace Ryujinx.Graphics.GAL Y2 = y2; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Face.cs b/src/Ryujinx.Graphics.GAL/Face.cs index 0587641f..73e43cf2 100644 --- a/src/Ryujinx.Graphics.GAL/Face.cs +++ b/src/Ryujinx.Graphics.GAL/Face.cs @@ -2,8 +2,8 @@ namespace Ryujinx.Graphics.GAL { public enum Face { - Front = 0x404, - Back = 0x405, - FrontAndBack = 0x408 + Front = 0x404, + Back = 0x405, + FrontAndBack = 0x408, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Format.cs b/src/Ryujinx.Graphics.GAL/Format.cs index 7e0e07d4..f6feec1c 100644 --- a/src/Ryujinx.Graphics.GAL/Format.cs +++ b/src/Ryujinx.Graphics.GAL/Format.cs @@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.GAL B5G5R5A1Unorm, A1B5G5R5Unorm, B8G8R8A8Unorm, - B8G8R8A8Srgb + B8G8R8A8Srgb, } public static class FormatExtensions @@ -665,4 +665,4 @@ namespace Ryujinx.Graphics.GAL return format.IsUint() || format.IsSint(); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/FrontFace.cs b/src/Ryujinx.Graphics.GAL/FrontFace.cs index aa6bfdc5..5dade276 100644 --- a/src/Ryujinx.Graphics.GAL/FrontFace.cs +++ b/src/Ryujinx.Graphics.GAL/FrontFace.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL { public enum FrontFace { - Clockwise = 0x900, - CounterClockwise = 0x901 + Clockwise = 0x900, + CounterClockwise = 0x901, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ISampler.cs b/src/Ryujinx.Graphics.GAL/ISampler.cs index 3aefc6a7..de70f663 100644 --- a/src/Ryujinx.Graphics.GAL/ISampler.cs +++ b/src/Ryujinx.Graphics.GAL/ISampler.cs @@ -3,4 +3,4 @@ using System; namespace Ryujinx.Graphics.GAL { public interface ISampler : IDisposable { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ITexture.cs b/src/Ryujinx.Graphics.GAL/ITexture.cs index 2f9f5fbf..d39b5949 100644 --- a/src/Ryujinx.Graphics.GAL/ITexture.cs +++ b/src/Ryujinx.Graphics.GAL/ITexture.cs @@ -1,5 +1,4 @@ using Ryujinx.Common.Memory; -using System; namespace Ryujinx.Graphics.GAL { @@ -25,4 +24,4 @@ namespace Ryujinx.Graphics.GAL void SetStorage(BufferRange buffer); void Release(); } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ImageCrop.cs b/src/Ryujinx.Graphics.GAL/ImageCrop.cs index e8220974..511b74f6 100644 --- a/src/Ryujinx.Graphics.GAL/ImageCrop.cs +++ b/src/Ryujinx.Graphics.GAL/ImageCrop.cs @@ -2,36 +2,36 @@ namespace Ryujinx.Graphics.GAL { public readonly struct ImageCrop { - public int Left { get; } - public int Right { get; } - public int Top { get; } - public int Bottom { get; } - public bool FlipX { get; } - public bool FlipY { get; } - public bool IsStretched { get; } + public int Left { get; } + public int Right { get; } + public int Top { get; } + public int Bottom { get; } + public bool FlipX { get; } + public bool FlipY { get; } + public bool IsStretched { get; } public float AspectRatioX { get; } public float AspectRatioY { get; } public ImageCrop( - int left, - int right, - int top, - int bottom, - bool flipX, - bool flipY, - bool isStretched, + int left, + int right, + int top, + int bottom, + bool flipX, + bool flipY, + bool isStretched, float aspectRatioX, float aspectRatioY) { - Left = left; - Right = right; - Top = top; - Bottom = bottom; - FlipX = flipX; - FlipY = flipY; - IsStretched = isStretched; + Left = left; + Right = right; + Top = top; + Bottom = bottom; + FlipX = flipX; + FlipY = flipY; + IsStretched = isStretched; AspectRatioX = aspectRatioX; AspectRatioY = aspectRatioY; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/IndexType.cs b/src/Ryujinx.Graphics.GAL/IndexType.cs index 4abf28d9..8bbefc83 100644 --- a/src/Ryujinx.Graphics.GAL/IndexType.cs +++ b/src/Ryujinx.Graphics.GAL/IndexType.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Graphics.GAL { UByte, UShort, - UInt + UInt, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/LogicalOp.cs b/src/Ryujinx.Graphics.GAL/LogicalOp.cs index 848215d0..8fe6c782 100644 --- a/src/Ryujinx.Graphics.GAL/LogicalOp.cs +++ b/src/Ryujinx.Graphics.GAL/LogicalOp.cs @@ -17,6 +17,6 @@ CopyInverted = 0x150C, OrInverted = 0x150D, Nand = 0x150E, - Set = 0x150F + Set = 0x150F, } } diff --git a/src/Ryujinx.Graphics.GAL/MagFilter.cs b/src/Ryujinx.Graphics.GAL/MagFilter.cs index f20d095e..d5cd6c7c 100644 --- a/src/Ryujinx.Graphics.GAL/MagFilter.cs +++ b/src/Ryujinx.Graphics.GAL/MagFilter.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.GAL public enum MagFilter { Nearest = 1, - Linear + Linear, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/MinFilter.cs b/src/Ryujinx.Graphics.GAL/MinFilter.cs index b7a0740b..f089947b 100644 --- a/src/Ryujinx.Graphics.GAL/MinFilter.cs +++ b/src/Ryujinx.Graphics.GAL/MinFilter.cs @@ -7,6 +7,6 @@ namespace Ryujinx.Graphics.GAL NearestMipmapNearest, LinearMipmapNearest, NearestMipmapLinear, - LinearMipmapLinear + LinearMipmapLinear, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/BufferMap.cs b/src/Ryujinx.Graphics.GAL/Multithreading/BufferMap.cs index 24b0af2d..c30df046 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/BufferMap.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/BufferMap.cs @@ -15,9 +15,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading { private ulong _bufferHandle = 0; - private Dictionary _bufferMap = new Dictionary(); - private HashSet _inFlight = new HashSet(); - private AutoResetEvent _inFlightChanged = new AutoResetEvent(false); + private readonly Dictionary _bufferMap = new(); + private readonly HashSet _inFlight = new(); + private readonly AutoResetEvent _inFlightChanged = new(false); internal BufferHandle CreateBufferHandle() { @@ -59,14 +59,12 @@ namespace Ryujinx.Graphics.GAL.Multithreading internal BufferHandle MapBuffer(BufferHandle handle) { // Maps a threaded buffer to a backend one. - // Threaded buffers are returned on creation as the buffer + // Threaded buffers are returned on creation as the buffer // isn't actually created until the queue runs the command. - BufferHandle result; - lock (_bufferMap) { - if (!_bufferMap.TryGetValue(handle, out result)) + if (!_bufferMap.TryGetValue(handle, out BufferHandle result)) { result = BufferHandle.Null; } @@ -79,11 +77,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading { // Blocks until the handle is available. - BufferHandle result; lock (_bufferMap) { - if (_bufferMap.TryGetValue(handle, out result)) + if (_bufferMap.TryGetValue(handle, out BufferHandle result)) { return result; } @@ -128,9 +125,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading for (int i = 0; i < ranges.Length; i++) { ref BufferRange range = ref ranges[i]; - BufferHandle result; - if (!_bufferMap.TryGetValue(range.Handle, out result)) + if (!_bufferMap.TryGetValue(range.Handle, out BufferHandle result)) { result = BufferHandle.Null; } @@ -152,9 +148,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading { ref BufferAssignment assignment = ref ranges[i]; BufferRange range = assignment.Range; - BufferHandle result; - if (!_bufferMap.TryGetValue(range.Handle, out result)) + if (!_bufferMap.TryGetValue(range.Handle, out BufferHandle result)) { result = BufferHandle.Null; } @@ -175,9 +170,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading for (int i = 0; i < ranges.Length; i++) { BufferRange range = ranges[i].Buffer; - BufferHandle result; - if (!_bufferMap.TryGetValue(range.Handle, out result)) + if (!_bufferMap.TryGetValue(range.Handle, out BufferHandle result)) { result = BufferHandle.Null; } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs b/src/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs index 9f6e483c..12c5245a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs @@ -17,8 +17,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading { private delegate void CommandDelegate(Span memory, ThreadedRenderer threaded, IRenderer renderer); - private static int _totalCommands = (int)Enum.GetValues().Max() + 1; - private static CommandDelegate[] _lookup = new CommandDelegate[_totalCommands]; + private static readonly int _totalCommands = (int)Enum.GetValues().Max() + 1; + private static readonly CommandDelegate[] _lookup = new CommandDelegate[_totalCommands]; [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ref T GetCommand(Span memory) @@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void RunCommand(Span memory, ThreadedRenderer threaded, IRenderer renderer) { - _lookup[memory[memory.Length - 1]](memory, threaded, renderer); + _lookup[memory[^1]](memory, threaded, renderer); } } } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs b/src/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs index 8d9c1ec8..1e73fba6 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs @@ -100,6 +100,6 @@ TextureBarrierTiled, TryHostConditionalRendering, TryHostConditionalRenderingFlush, - UpdateRenderScale + UpdateRenderScale, } } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BarrierCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BarrierCommand.cs index 4f8e1b08..4a73a3bc 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BarrierCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BarrierCommand.cs @@ -2,7 +2,7 @@ { struct BarrierCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.Barrier; + public readonly CommandType CommandType => CommandType.Barrier; public static void Run(ref BarrierCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BeginTransformFeedbackCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BeginTransformFeedbackCommand.cs index 50032635..538ff98d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BeginTransformFeedbackCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/BeginTransformFeedbackCommand.cs @@ -2,7 +2,7 @@ { struct BeginTransformFeedbackCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.BeginTransformFeedback; + public readonly CommandType CommandType => CommandType.BeginTransformFeedback; private PrimitiveTopology _topology; public void Set(PrimitiveTopology topology) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferDisposeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferDisposeCommand.cs index 5be42fff..03ee8560 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferDisposeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferDisposeCommand.cs @@ -2,7 +2,7 @@ { struct BufferDisposeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.BufferDispose; + public readonly CommandType CommandType => CommandType.BufferDispose; private BufferHandle _buffer; public void Set(BufferHandle buffer) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs index 031c6153..0e395022 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs @@ -1,11 +1,10 @@ using Ryujinx.Graphics.GAL.Multithreading.Model; -using System; namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Buffer { struct BufferGetDataCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.BufferGetData; + public readonly CommandType CommandType => CommandType.BufferGetData; private BufferHandle _buffer; private int _offset; private int _size; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferSetDataCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferSetDataCommand.cs index dcb8c2f2..30daf382 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferSetDataCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferSetDataCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Buffer { struct BufferSetDataCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.BufferSetData; + public readonly CommandType CommandType => CommandType.BufferSetData; private BufferHandle _buffer; private int _offset; private SpanRef _data; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearBufferCommand.cs index 1d70460a..777a8460 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearBufferCommand.cs @@ -2,7 +2,7 @@ { struct ClearBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ClearBuffer; + public readonly CommandType CommandType => CommandType.ClearBuffer; private BufferHandle _destination; private int _offset; private int _size; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetColorCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetColorCommand.cs index f8c2bdfe..3a24e181 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetColorCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetColorCommand.cs @@ -2,7 +2,7 @@ { struct ClearRenderTargetColorCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ClearRenderTargetColor; + public readonly CommandType CommandType => CommandType.ClearRenderTargetColor; private int _index; private int _layer; private int _layerCount; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetDepthStencilCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetDepthStencilCommand.cs index ca86673e..43c0e89a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetDepthStencilCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ClearRenderTargetDepthStencilCommand.cs @@ -2,7 +2,7 @@ { struct ClearRenderTargetDepthStencilCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ClearRenderTargetDepthStencil; + public readonly CommandType CommandType => CommandType.ClearRenderTargetDepthStencil; private int _layer; private int _layerCount; private float _depthValue; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CommandBufferBarrierCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CommandBufferBarrierCommand.cs index ad3ab0f8..97556233 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CommandBufferBarrierCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CommandBufferBarrierCommand.cs @@ -2,7 +2,7 @@ { struct CommandBufferBarrierCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CommandBufferBarrier; + public readonly CommandType CommandType => CommandType.CommandBufferBarrier; public static void Run(ref CommandBufferBarrierCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CopyBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CopyBufferCommand.cs index 43111bce..8cd9e7f1 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CopyBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CopyBufferCommand.cs @@ -2,7 +2,7 @@ { struct CopyBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CopyBuffer; + public readonly CommandType CommandType => CommandType.CopyBuffer; private BufferHandle _source; private BufferHandle _destination; private int _srcOffset; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventDisposeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventDisposeCommand.cs index e5250212..fd9868b1 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventDisposeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventDisposeCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.CounterEvent { struct CounterEventDisposeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CounterEventDispose; + public readonly CommandType CommandType => CommandType.CounterEventDispose; private TableRef _event; public void Set(TableRef evt) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventFlushCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventFlushCommand.cs index 608cf8f9..590169bc 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventFlushCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/CounterEvent/CounterEventFlushCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.CounterEvent { struct CounterEventFlushCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CounterEventFlush; + public readonly CommandType CommandType => CommandType.CounterEventFlush; private TableRef _event; public void Set(TableRef evt) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DispatchComputeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DispatchComputeCommand.cs index 29568837..1a7c94f4 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DispatchComputeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DispatchComputeCommand.cs @@ -2,7 +2,7 @@ { struct DispatchComputeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DispatchCompute; + public readonly CommandType CommandType => CommandType.DispatchCompute; private int _groupsX; private int _groupsY; private int _groupsZ; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawCommand.cs index 804eaa49..bd3cb89b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawCommand.cs @@ -2,7 +2,7 @@ { struct DrawIndexedCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawIndexed; + public readonly CommandType CommandType => CommandType.DrawIndexed; private int _indexCount; private int _instanceCount; private int _firstIndex; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedCommand.cs index 1b28afcd..c4d5ce66 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedCommand.cs @@ -2,7 +2,7 @@ { struct DrawCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.Draw; + public readonly CommandType CommandType => CommandType.Draw; private int _vertexCount; private int _instanceCount; private int _firstVertex; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCommand.cs index 521b2f0c..e4156e2b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCommand.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct DrawIndexedIndirectCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawIndexedIndirect; + public readonly CommandType CommandType => CommandType.DrawIndexedIndirect; private BufferRange _indirectBuffer; public void Set(BufferRange indirectBuffer) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCountCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCountCommand.cs index 6bdf376d..1f696622 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCountCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndexedIndirectCountCommand.cs @@ -2,7 +2,7 @@ { struct DrawIndexedIndirectCountCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawIndexedIndirectCount; + public readonly CommandType CommandType => CommandType.DrawIndexedIndirectCount; private BufferRange _indirectBuffer; private BufferRange _parameterBuffer; private int _maxDrawCount; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCommand.cs index e1947084..e2e93d3c 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCommand.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct DrawIndirectCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawIndirect; + public readonly CommandType CommandType => CommandType.DrawIndirect; private BufferRange _indirectBuffer; public void Set(BufferRange indirectBuffer) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCountCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCountCommand.cs index ef56ffb2..eae98e4b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCountCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawIndirectCountCommand.cs @@ -2,7 +2,7 @@ { struct DrawIndirectCountCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawIndirectCount; + public readonly CommandType CommandType => CommandType.DrawIndirectCount; private BufferRange _indirectBuffer; private BufferRange _parameterBuffer; private int _maxDrawCount; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawTextureCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawTextureCommand.cs index b3e9c4b5..1e9cfd83 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawTextureCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/DrawTextureCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct DrawTextureCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.DrawTexture; + public readonly CommandType CommandType => CommandType.DrawTexture; private TableRef _texture; private TableRef _sampler; private Extents2DF _srcRegion; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndHostConditionalRenderingCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndHostConditionalRenderingCommand.cs index 877af23b..5d30a901 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndHostConditionalRenderingCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndHostConditionalRenderingCommand.cs @@ -2,7 +2,7 @@ { struct EndHostConditionalRenderingCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.EndHostConditionalRendering; + public readonly CommandType CommandType => CommandType.EndHostConditionalRendering; public static void Run(ref EndHostConditionalRenderingCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndTransformFeedbackCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndTransformFeedbackCommand.cs index 33df325f..d050f477 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndTransformFeedbackCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/EndTransformFeedbackCommand.cs @@ -2,7 +2,7 @@ { struct EndTransformFeedbackCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.EndTransformFeedback; + public readonly CommandType CommandType => CommandType.EndTransformFeedback; public static void Run(ref EndTransformFeedbackCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramCheckLinkCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramCheckLinkCommand.cs index f3662424..b9c6e286 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramCheckLinkCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramCheckLinkCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Program { struct ProgramCheckLinkCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ProgramCheckLink; + public readonly CommandType CommandType => CommandType.ProgramCheckLink; private TableRef _program; private bool _blocking; private TableRef> _result; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramDisposeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramDisposeCommand.cs index d1ec4298..839a05bc 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramDisposeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramDisposeCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Program { struct ProgramDisposeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ProgramDispose; + public readonly CommandType CommandType => CommandType.ProgramDispose; private TableRef _program; public void Set(TableRef program) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramGetBinaryCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramGetBinaryCommand.cs index 16963245..b53fc8ac 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramGetBinaryCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Program/ProgramGetBinaryCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Program { struct ProgramGetBinaryCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ProgramGetBinary; + public readonly CommandType CommandType => CommandType.ProgramGetBinary; private TableRef _program; private TableRef> _result; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs index 41987da1..309a9cd0 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct ActionCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.Action; + public readonly CommandType CommandType => CommandType.Action; private TableRef _action; public void Set(TableRef action) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferAccessCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferAccessCommand.cs index ece98b70..5efa0a7a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferAccessCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferAccessCommand.cs @@ -2,7 +2,7 @@ { struct CreateBufferAccessCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateBufferAccess; + public readonly CommandType CommandType => CommandType.CreateBufferAccess; private BufferHandle _threadedHandle; private int _size; private BufferAccess _access; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs index b36d8bbe..214b3589 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs @@ -2,7 +2,7 @@ { struct CreateBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateBuffer; + public readonly CommandType CommandType => CommandType.CreateBuffer; private BufferHandle _threadedHandle; private int _size; private BufferHandle _storageHint; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateHostBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateHostBufferCommand.cs index e25f8468..1036e997 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateHostBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateHostBufferCommand.cs @@ -2,7 +2,7 @@ { struct CreateHostBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateHostBuffer; + public readonly CommandType CommandType => CommandType.CreateHostBuffer; private BufferHandle _threadedHandle; private nint _pointer; private int _size; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs index 19563e12..b0d24b99 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct CreateProgramCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateProgram; + public readonly CommandType CommandType => CommandType.CreateProgram; private TableRef _request; public void Set(TableRef request) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs index 6ab862d4..76188268 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct CreateSamplerCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateSampler; + public readonly CommandType CommandType => CommandType.CreateSampler; private TableRef _sampler; private SamplerCreateInfo _info; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs index 32afb051..138a4591 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs @@ -2,7 +2,7 @@ { struct CreateSyncCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateSync; + public readonly CommandType CommandType => CommandType.CreateSync; private ulong _id; private bool _strict; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs index 0347ded4..f52db30a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct CreateTextureCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.CreateTexture; + public readonly CommandType CommandType => CommandType.CreateTexture; private TableRef _texture; private TextureCreateInfo _info; private float _scale; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs index 4111dcfd..ade13ddf 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct GetCapabilitiesCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.GetCapabilities; + public readonly CommandType CommandType => CommandType.GetCapabilities; private TableRef> _result; public void Set(TableRef> result) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs index 820908f3..cf26194b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs @@ -2,7 +2,7 @@ { struct PreFrameCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.PreFrame; + public readonly CommandType CommandType => CommandType.PreFrame; public static void Run(ref PreFrameCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs index 4b0210cb..2a373f5b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer { struct ReportCounterCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ReportCounter; + public readonly CommandType CommandType => CommandType.ReportCounter; private TableRef _event; private CounterType _type; private TableRef> _resultHandler; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs index 3d796041..a20a6ca2 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs @@ -2,7 +2,7 @@ { struct ResetCounterCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.ResetCounter; + public readonly CommandType CommandType => CommandType.ResetCounter; private CounterType _type; public void Set(CounterType type) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs index c7076c0e..e04304c1 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs @@ -2,7 +2,7 @@ { struct UpdateCountersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.UpdateCounters; + public readonly CommandType CommandType => CommandType.UpdateCounters; public static void Run(ref UpdateCountersCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Sampler/SamplerDisposeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Sampler/SamplerDisposeCommand.cs index 9485e9a1..4a68a35d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Sampler/SamplerDisposeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Sampler/SamplerDisposeCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Sampler { struct SamplerDisposeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SamplerDispose; + public readonly CommandType CommandType => CommandType.SamplerDispose; private TableRef _sampler; public void Set(TableRef sampler) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetAlphaTestCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetAlphaTestCommand.cs index a96879ff..10bd3c5c 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetAlphaTestCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetAlphaTestCommand.cs @@ -2,7 +2,7 @@ { struct SetAlphaTestCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetAlphaTest; + public readonly CommandType CommandType => CommandType.SetAlphaTest; private bool _enable; private float _reference; private CompareOp _op; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateAdvancedCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateAdvancedCommand.cs index 2ec10a50..8405a8ee 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateAdvancedCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateAdvancedCommand.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetBlendStateAdvancedCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetBlendStateAdvanced; + public readonly CommandType CommandType => CommandType.SetBlendStateAdvanced; private AdvancedBlendDescriptor _blend; public void Set(AdvancedBlendDescriptor blend) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateCommand.cs index 68e48da5..de430b78 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetBlendStateCommand.cs @@ -2,7 +2,7 @@ { struct SetBlendStateCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetBlendState; + public readonly CommandType CommandType => CommandType.SetBlendState; private int _index; private BlendDescriptor _blend; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthBiasCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthBiasCommand.cs index eb8d4a72..c8bb8472 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthBiasCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthBiasCommand.cs @@ -2,7 +2,7 @@ { struct SetDepthBiasCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetDepthBias; + public readonly CommandType CommandType => CommandType.SetDepthBias; private PolygonModeMask _enables; private float _factor; private float _units; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthClampCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthClampCommand.cs index 15159cb4..b7cd2db9 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthClampCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthClampCommand.cs @@ -2,7 +2,7 @@ { struct SetDepthClampCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetDepthClamp; + public readonly CommandType CommandType => CommandType.SetDepthClamp; private bool _clamp; public void Set(bool clamp) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthModeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthModeCommand.cs index 3e169164..94bb6d49 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthModeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthModeCommand.cs @@ -2,7 +2,7 @@ { struct SetDepthModeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetDepthMode; + public readonly CommandType CommandType => CommandType.SetDepthMode; private DepthMode _mode; public void Set(DepthMode mode) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthTestCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthTestCommand.cs index 2abaeb78..1b316c1a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthTestCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetDepthTestCommand.cs @@ -2,7 +2,7 @@ { struct SetDepthTestCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetDepthTest; + public readonly CommandType CommandType => CommandType.SetDepthTest; private DepthTestDescriptor _depthTest; public void Set(DepthTestDescriptor depthTest) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFaceCullingCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFaceCullingCommand.cs index 54311e95..7823ab05 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFaceCullingCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFaceCullingCommand.cs @@ -2,7 +2,7 @@ { struct SetFaceCullingCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetFaceCulling; + public readonly CommandType CommandType => CommandType.SetFaceCulling; private bool _enable; private Face _face; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFrontFaceCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFrontFaceCommand.cs index e4d7b814..5d469447 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFrontFaceCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetFrontFaceCommand.cs @@ -2,7 +2,7 @@ { struct SetFrontFaceCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetFrontFace; + public readonly CommandType CommandType => CommandType.SetFrontFace; private FrontFace _frontFace; public void Set(FrontFace frontFace) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageCommand.cs index 7836acd7..d24174fe 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetImageCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetImage; + public readonly CommandType CommandType => CommandType.SetImage; private int _binding; private TableRef _texture; private Format _imageFormat; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetIndexBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetIndexBufferCommand.cs index ded44c55..6a06ab9b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetIndexBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetIndexBufferCommand.cs @@ -2,7 +2,7 @@ { struct SetIndexBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetIndexBuffer; + public readonly CommandType CommandType => CommandType.SetIndexBuffer; private BufferRange _buffer; private IndexType _type; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLineParametersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLineParametersCommand.cs index 68331932..4928360a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLineParametersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLineParametersCommand.cs @@ -2,7 +2,7 @@ { struct SetLineParametersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetLineParameters; + public readonly CommandType CommandType => CommandType.SetLineParameters; private float _width; private bool _smooth; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLogicOpStateCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLogicOpStateCommand.cs index 2d7fc169..5aecc777 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLogicOpStateCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetLogicOpStateCommand.cs @@ -2,7 +2,7 @@ { struct SetLogicOpStateCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetLogicOpState; + public readonly CommandType CommandType => CommandType.SetLogicOpState; private bool _enable; private LogicalOp _op; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs index f7b4969a..f30140c7 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetMultisampleStateCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetMultisampleState; + public readonly CommandType CommandType => CommandType.SetMultisampleState; private MultisampleDescriptor _multisample; public void Set(MultisampleDescriptor multisample) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs index 815bc3c2..6dbe4b7b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetPatchParametersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetPatchParameters; + public readonly CommandType CommandType => CommandType.SetPatchParameters; private int _vertices; private Array4 _defaultOuterLevel; private Array2 _defaultInnerLevel; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPointParametersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPointParametersCommand.cs index e3fad0f8..a0993fb2 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPointParametersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPointParametersCommand.cs @@ -2,7 +2,7 @@ { struct SetPointParametersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetPointParameters; + public readonly CommandType CommandType => CommandType.SetPointParameters; private float _size; private bool _isProgramPointSize; private bool _enablePointSprite; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs index ea2f838b..caa362c0 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetPolygonModeCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetPolygonMode; + public readonly CommandType CommandType => CommandType.SetPolygonMode; private PolygonMode _frontMode; private PolygonMode _backMode; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveRestartCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveRestartCommand.cs index 26b88b01..2289d8bd 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveRestartCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveRestartCommand.cs @@ -2,7 +2,7 @@ { struct SetPrimitiveRestartCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetPrimitiveRestart; + public readonly CommandType CommandType => CommandType.SetPrimitiveRestart; private bool _enable; private int _index; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveTopologyCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveTopologyCommand.cs index 062c4e57..1458a1fc 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveTopologyCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPrimitiveTopologyCommand.cs @@ -2,7 +2,7 @@ { struct SetPrimitiveTopologyCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetPrimitiveTopology; + public readonly CommandType CommandType => CommandType.SetPrimitiveTopology; private PrimitiveTopology _topology; public void Set(PrimitiveTopology topology) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetProgramCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetProgramCommand.cs index fa2e9a8a..5b011433 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetProgramCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetProgramCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetProgramCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetProgram; + public readonly CommandType CommandType => CommandType.SetProgram; private TableRef _program; public void Set(TableRef program) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRasterizerDiscardCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRasterizerDiscardCommand.cs index d2095a4f..64091100 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRasterizerDiscardCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRasterizerDiscardCommand.cs @@ -2,7 +2,7 @@ { struct SetRasterizerDiscardCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetRasterizerDiscard; + public readonly CommandType CommandType => CommandType.SetRasterizerDiscard; private bool _discard; public void Set(bool discard) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetColorMasksCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetColorMasksCommand.cs index c247ff3a..78d357ae 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetColorMasksCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetColorMasksCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetRenderTargetColorMasksCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetRenderTargetColorMasks; + public readonly CommandType CommandType => CommandType.SetRenderTargetColorMasks; private SpanRef _componentMask; public void Set(SpanRef componentMask) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetScaleCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetScaleCommand.cs index 7cb5ec11..7207fd9d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetScaleCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetScaleCommand.cs @@ -2,7 +2,7 @@ { struct SetRenderTargetScaleCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetRenderTargetScale; + public readonly CommandType CommandType => CommandType.SetRenderTargetScale; private float _scale; public void Set(float scale) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetsCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetsCommand.cs index 0b175a72..13ef32b5 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetsCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetRenderTargetsCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetRenderTargetsCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetRenderTargets; + public readonly CommandType CommandType => CommandType.SetRenderTargets; private TableRef _colors; private TableRef _depthStencil; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetScissorsCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetScissorsCommand.cs index 985d775e..9d7d59e2 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetScissorsCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetScissorsCommand.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetScissorsCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetScissor; + public readonly CommandType CommandType => CommandType.SetScissor; private SpanRef> _scissors; public void Set(SpanRef> scissors) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStencilTestCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStencilTestCommand.cs index 41bff97e..23bea88b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStencilTestCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStencilTestCommand.cs @@ -2,7 +2,7 @@ { struct SetStencilTestCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetStencilTest; + public readonly CommandType CommandType => CommandType.SetStencilTest; private StencilTestDescriptor _stencilTest; public void Set(StencilTestDescriptor stencilTest) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs index 6ecb0989..525576c6 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetStorageBuffersCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetStorageBuffersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetStorageBuffers; + public readonly CommandType CommandType => CommandType.SetStorageBuffers; private SpanRef _buffers; public void Set(SpanRef buffers) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureAndSamplerCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureAndSamplerCommand.cs index 5e8e0854..673da496 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureAndSamplerCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureAndSamplerCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetTextureAndSamplerCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetTextureAndSampler; + public readonly CommandType CommandType => CommandType.SetTextureAndSampler; private ShaderStage _stage; private int _binding; private TableRef _texture; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTransformFeedbackBuffersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTransformFeedbackBuffersCommand.cs index e0d4ef2d..cac837d9 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTransformFeedbackBuffersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTransformFeedbackBuffersCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetTransformFeedbackBuffersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetTransformFeedbackBuffers; + public readonly CommandType CommandType => CommandType.SetTransformFeedbackBuffers; private SpanRef _buffers; public void Set(SpanRef buffers) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUniformBuffersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUniformBuffersCommand.cs index 9e93db9e..516a2bd3 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUniformBuffersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUniformBuffersCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetUniformBuffersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetUniformBuffers; + public readonly CommandType CommandType => CommandType.SetUniformBuffers; private SpanRef _buffers; public void Set(SpanRef buffers) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUserClipDistanceCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUserClipDistanceCommand.cs index 4336ce49..d7500900 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUserClipDistanceCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetUserClipDistanceCommand.cs @@ -2,7 +2,7 @@ { struct SetUserClipDistanceCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetUserClipDistance; + public readonly CommandType CommandType => CommandType.SetUserClipDistance; private int _index; private bool _enableClip; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexAttribsCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexAttribsCommand.cs index e442c72d..18decb0b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexAttribsCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexAttribsCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetVertexAttribsCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetVertexAttribs; + public readonly CommandType CommandType => CommandType.SetVertexAttribs; private SpanRef _vertexAttribs; public void Set(SpanRef vertexAttribs) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexBuffersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexBuffersCommand.cs index 585da2a4..bcfb553d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexBuffersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetVertexBuffersCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetVertexBuffersCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetVertexBuffers; + public readonly CommandType CommandType => CommandType.SetVertexBuffers; private SpanRef _vertexBuffers; public void Set(SpanRef vertexBuffers) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetViewportsCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetViewportsCommand.cs index c18bd811..a0ad026a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetViewportsCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetViewportsCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct SetViewportsCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.SetViewports; + public readonly CommandType CommandType => CommandType.SetViewports; private SpanRef _viewports; private bool _disableTransform; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToBufferCommand.cs index ac0e07d6..d22cc9b7 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToBufferCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToBufferCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureCopyToBufferCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureCopyToBuffer; + public readonly CommandType CommandType => CommandType.TextureCopyToBuffer; private TableRef _texture; private BufferRange _range; private int _layer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs index 02d0b639..ddbf0e67 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureCopyToCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureCopyTo; + public readonly CommandType CommandType => CommandType.TextureCopyTo; private TableRef _texture; private TableRef _destination; private int _firstLayer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs index 6b83d3f8..b43ffea5 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureCopyToScaledCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureCopyToScaled; + public readonly CommandType CommandType => CommandType.TextureCopyToScaled; private TableRef _texture; private TableRef _destination; private Extents2D _srcRegion; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs index 2a340a70..4f5ab36f 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureCopyToSliceCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureCopyToSlice; + public readonly CommandType CommandType => CommandType.TextureCopyToSlice; private TableRef _texture; private TableRef _destination; private int _srcLayer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs index 09e9ca2f..9216e968 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureCreateViewCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureCreateView; + public readonly CommandType CommandType => CommandType.TextureCreateView; private TableRef _texture; private TableRef _destination; private TextureCreateInfo _info; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs index 91320d45..38010467 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs @@ -1,12 +1,11 @@ using Ryujinx.Graphics.GAL.Multithreading.Model; using Ryujinx.Graphics.GAL.Multithreading.Resources; -using System; namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureGetDataCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureGetData; + public readonly CommandType CommandType => CommandType.TextureGetData; private TableRef _texture; private TableRef>> _result; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs index ec06cc4d..e84cf2d2 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs @@ -1,12 +1,11 @@ using Ryujinx.Graphics.GAL.Multithreading.Model; using Ryujinx.Graphics.GAL.Multithreading.Resources; -using System; namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureGetDataSliceCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureGetDataSlice; + public readonly CommandType CommandType => CommandType.TextureGetDataSlice; private TableRef _texture; private TableRef>> _result; private int _layer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs index 61486e09..a9c528ae 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureReleaseCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureRelease; + public readonly CommandType CommandType => CommandType.TextureRelease; private TableRef _texture; public void Set(TableRef texture) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs index cfbaffd3..9aa2e4ee 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureSetDataCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureSetData; + public readonly CommandType CommandType => CommandType.TextureSetData; private TableRef _texture; private TableRef _data; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs index a7126f61..14fecadf 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureSetDataSliceCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureSetDataSlice; + public readonly CommandType CommandType => CommandType.TextureSetDataSlice; private TableRef _texture; private TableRef _data; private int _layer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceRegionCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceRegionCommand.cs index 4df83e08..4c80d9bc 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceRegionCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceRegionCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureSetDataSliceRegionCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureSetDataSliceRegion; + public readonly CommandType CommandType => CommandType.TextureSetDataSliceRegion; private TableRef _texture; private TableRef _data; private int _layer; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs index 2a1943a9..fafaa557 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture { struct TextureSetStorageCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureSetStorage; + public readonly CommandType CommandType => CommandType.TextureSetStorage; private TableRef _texture; private BufferRange _storage; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierCommand.cs index ce1a83a7..8b62d1ef 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierCommand.cs @@ -2,7 +2,7 @@ { struct TextureBarrierCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureBarrier; + public readonly CommandType CommandType => CommandType.TextureBarrier; public static void Run(ref TextureBarrierCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierTiledCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierTiledCommand.cs index c65ffe2e..1cae4109 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierTiledCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureBarrierTiledCommand.cs @@ -2,7 +2,7 @@ { struct TextureBarrierTiledCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TextureBarrierTiled; + public readonly CommandType CommandType => CommandType.TextureBarrierTiled; public static void Run(ref TextureBarrierTiledCommand command, ThreadedRenderer threaded, IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingCommand.cs index 9124ca1f..a06f0b5a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct TryHostConditionalRenderingCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TryHostConditionalRendering; + public readonly CommandType CommandType => CommandType.TryHostConditionalRendering; private TableRef _value; private ulong _compare; private bool _isEqual; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingFlushCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingFlushCommand.cs index a5d07640..eb920788 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingFlushCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TryHostConditionalRenderingFlushCommand.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct TryHostConditionalRenderingFlushCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.TryHostConditionalRenderingFlush; + public readonly CommandType CommandType => CommandType.TryHostConditionalRenderingFlush; private TableRef _value; private TableRef _compare; private bool _isEqual; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/UpdateRenderScaleCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/UpdateRenderScaleCommand.cs index ebe14150..c3c24045 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/UpdateRenderScaleCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/UpdateRenderScaleCommand.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands { struct UpdateRenderScaleCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.UpdateRenderScale; + public readonly CommandType CommandType => CommandType.UpdateRenderScale; private SpanRef _scales; private int _totalCount; private int _fragmentCount; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Window/WindowPresentCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Window/WindowPresentCommand.cs index 6a24cd35..67ec3521 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Window/WindowPresentCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Window/WindowPresentCommand.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Window { struct WindowPresentCommand : IGALCommand, IGALCommand { - public CommandType CommandType => CommandType.WindowPresent; + public readonly CommandType CommandType => CommandType.WindowPresent; private TableRef _texture; private ImageCrop _crop; private TableRef _swapBuffersCallback; diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Model/CircularSpanPool.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Model/CircularSpanPool.cs index 4ea1a2c7..10cab84c 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Model/CircularSpanPool.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Model/CircularSpanPool.cs @@ -12,9 +12,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Model /// class CircularSpanPool { - private ThreadedRenderer _renderer; - private byte[] _pool; - private int _size; + private readonly ThreadedRenderer _renderer; + private readonly byte[] _pool; + private readonly int _size; private int _producerPtr; private int _producerSkipPosition = -1; @@ -83,7 +83,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Model { int size = length * Unsafe.SizeOf(); - _consumerPtr = _consumerPtr + size; + _consumerPtr += size; } } } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Model/SpanRef.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Model/SpanRef.cs index 7dbebc76..1ed719a0 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Model/SpanRef.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Model/SpanRef.cs @@ -2,9 +2,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Model { - struct SpanRef where T : unmanaged + readonly struct SpanRef where T : unmanaged { - private int _packedLengthId; + private readonly int _packedLengthId; public SpanRef(ThreadedRenderer renderer, T[] data) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Model/TableRef.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Model/TableRef.cs index 166aa71a..e454df21 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Model/TableRef.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Model/TableRef.cs @@ -1,8 +1,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Model { - struct TableRef + readonly struct TableRef { - private int _index; + private readonly int _index; public TableRef(ThreadedRenderer renderer, T reference) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ProgramQueue.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ProgramQueue.cs index 3f982d31..87ab2f1b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ProgramQueue.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ProgramQueue.cs @@ -12,10 +12,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { private const int MaxConcurrentCompilations = 8; - private IRenderer _renderer; + private readonly IRenderer _renderer; - private Queue _toCompile; - private List _inProgress; + private readonly Queue _toCompile; + private readonly List _inProgress; public ProgramQueue(IRenderer renderer) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs index b4c6853f..e4df1c1b 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs @@ -4,8 +4,8 @@ { public ThreadedProgram Threaded { get; set; } - private byte[] _data; - private bool _hasFragmentShader; + private readonly byte[] _data; + private readonly bool _hasFragmentShader; private ShaderInfo _info; public BinaryProgramRequest(ThreadedProgram program, byte[] data, bool hasFragmentShader, ShaderInfo info) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs index ff06abb1..744b77e1 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs @@ -4,7 +4,7 @@ { public ThreadedProgram Threaded { get; set; } - private ShaderSource[] _shaders; + private readonly ShaderSource[] _shaders; private ShaderInfo _info; public SourceProgramRequest(ThreadedProgram program, ShaderSource[] shaders, ShaderInfo info) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedCounterEvent.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedCounterEvent.cs index 4b7471d6..e4e197eb 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedCounterEvent.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedCounterEvent.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { class ThreadedCounterEvent : ICounterEvent { - private ThreadedRenderer _renderer; + private readonly ThreadedRenderer _renderer; public ICounterEvent Base; public bool Invalid { get; set; } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedProgram.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedProgram.cs index 068d058e..7cbbce45 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedProgram.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedProgram.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { class ThreadedProgram : IProgram { - private ThreadedRenderer _renderer; + private readonly ThreadedRenderer _renderer; public IProgram Base; @@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources public byte[] GetBinary() { - ResultBox box = new ResultBox(); + ResultBox box = new(); _renderer.New().Set(Ref(this), Ref(box)); _renderer.InvokeCommand(); @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources public ProgramLinkStatus CheckProgramLink(bool blocking) { - ResultBox box = new ResultBox(); + ResultBox box = new(); _renderer.New().Set(Ref(this), blocking, Ref(box)); _renderer.InvokeCommand(); diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedSampler.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedSampler.cs index d8de9a70..62e628a7 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedSampler.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedSampler.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { class ThreadedSampler : ISampler { - private ThreadedRenderer _renderer; + private readonly ThreadedRenderer _renderer; public ISampler Base; public ThreadedSampler(ThreadedRenderer renderer) diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedTexture.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedTexture.cs index bb0b05fb..b82e286a 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedTexture.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Resources/ThreadedTexture.cs @@ -1,7 +1,6 @@ using Ryujinx.Common.Memory; using Ryujinx.Graphics.GAL.Multithreading.Commands.Texture; using Ryujinx.Graphics.GAL.Multithreading.Model; -using System; namespace Ryujinx.Graphics.GAL.Multithreading.Resources { @@ -10,8 +9,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources /// class ThreadedTexture : ITexture { - private ThreadedRenderer _renderer; - private TextureCreateInfo _info; + private readonly ThreadedRenderer _renderer; + private readonly TextureCreateInfo _info; public ITexture Base; public int Width => _info.Width; @@ -65,7 +64,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources public ITexture CreateView(TextureCreateInfo info, int firstLayer, int firstLevel) { - ThreadedTexture newTex = new ThreadedTexture(_renderer, info, ScaleFactor); + ThreadedTexture newTex = new(_renderer, info, ScaleFactor); _renderer.New().Set(Ref(this), Ref(newTex), info, firstLayer, firstLevel); _renderer.QueueCommand(); @@ -76,7 +75,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { if (_renderer.IsGpuThread()) { - ResultBox> box = new ResultBox>(); + ResultBox> box = new(); _renderer.New().Set(Ref(this), Ref(box)); _renderer.InvokeCommand(); @@ -94,7 +93,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources { if (_renderer.IsGpuThread()) { - ResultBox> box = new ResultBox>(); + ResultBox> box = new(); _renderer.New().Set(Ref(this), Ref(box), layer, level); _renderer.InvokeCommand(); diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/SyncMap.cs b/src/Ryujinx.Graphics.GAL/Multithreading/SyncMap.cs index ae09e852..d6e416ef 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/SyncMap.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/SyncMap.cs @@ -6,8 +6,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading { class SyncMap : IDisposable { - private HashSet _inFlight = new HashSet(); - private AutoResetEvent _inFlightChanged = new AutoResetEvent(false); + private readonly HashSet _inFlight = new(); + private readonly AutoResetEvent _inFlightChanged = new(false); internal void CreateSyncHandle(ulong id) { diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs index 1bdc9cf4..de6ba18d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs @@ -9,13 +9,11 @@ namespace Ryujinx.Graphics.GAL.Multithreading { public class ThreadedPipeline : IPipeline { - private ThreadedRenderer _renderer; - private IPipeline _impl; + private readonly ThreadedRenderer _renderer; - public ThreadedPipeline(ThreadedRenderer renderer, IPipeline impl) + public ThreadedPipeline(ThreadedRenderer renderer) { _renderer = renderer; - _impl = impl; } private TableRef Ref(T reference) @@ -373,7 +371,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading public void UpdateRenderScale(ReadOnlySpan scales, int totalCount, int fragmentCount) { - _renderer.New().Set(_renderer.CopySpan(scales.Slice(0, totalCount)), totalCount, fragmentCount); + _renderer.New().Set(_renderer.CopySpan(scales[..totalCount]), totalCount, fragmentCount); _renderer.QueueCommand(); } } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs index bc96f222..dc7aab36 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs @@ -26,24 +26,24 @@ namespace Ryujinx.Graphics.GAL.Multithreading private const int MaxRefsPerCommand = 2; private const int QueueCount = 10000; - private int _elementSize; - private IRenderer _baseRenderer; + private readonly int _elementSize; + private readonly IRenderer _baseRenderer; private Thread _gpuThread; private Thread _backendThread; private bool _running; - private AutoResetEvent _frameComplete = new AutoResetEvent(true); + private readonly AutoResetEvent _frameComplete = new(true); - private ManualResetEventSlim _galWorkAvailable; - private CircularSpanPool _spanPool; + private readonly ManualResetEventSlim _galWorkAvailable; + private readonly CircularSpanPool _spanPool; - private ManualResetEventSlim _invokeRun; - private AutoResetEvent _interruptRun; + private readonly ManualResetEventSlim _invokeRun; + private readonly AutoResetEvent _interruptRun; private bool _lastSampleCounterClear = true; - private byte[] _commandQueue; - private object[] _refQueue; + private readonly byte[] _commandQueue; + private readonly object[] _refQueue; private int _consumerPtr; private int _commandCount; @@ -79,7 +79,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading renderer.ScreenCaptured += (sender, info) => ScreenCaptured?.Invoke(this, info); renderer.SetInterruptAction(Interrupt); - Pipeline = new ThreadedPipeline(this, renderer.Pipeline); + Pipeline = new ThreadedPipeline(this); Window = new ThreadedWindow(this, renderer); Buffers = new BufferMap(); Sync = new SyncMap(); @@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading _gpuThread = new Thread(gpuLoop) { - Name = "GPU.MainThread" + Name = "GPU.MainThread", }; _gpuThread.Start(); @@ -137,7 +137,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading { int commandPtr = _consumerPtr; - Span command = new Span(_commandQueue, commandPtr * _elementSize, _elementSize); + Span command = new(_commandQueue, commandPtr * _elementSize, _elementSize); // Run the command. @@ -180,10 +180,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading _producerPtr = (_producerPtr + 1) % QueueCount; - Span memory = new Span(_commandQueue, taken * _elementSize, _elementSize); + Span memory = new(_commandQueue, taken * _elementSize, _elementSize); ref T result = ref Unsafe.As(ref MemoryMarshal.GetReference(memory)); - memory[memory.Length - 1] = (byte)((IGALCommand)result).CommandType; + memory[^1] = (byte)((IGALCommand)result).CommandType; return ref result; } @@ -294,7 +294,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading { var program = new ThreadedProgram(this); - SourceProgramRequest request = new SourceProgramRequest(program, shaders, info); + SourceProgramRequest request = new(program, shaders, info); Programs.Add(request); @@ -332,8 +332,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading } else { - var texture = new ThreadedTexture(this, info, scale); - texture.Base = _baseRenderer.CreateTexture(info, scale); + var texture = new ThreadedTexture(this, info, scale) + { + Base = _baseRenderer.CreateTexture(info, scale), + }; return texture; } @@ -349,7 +351,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading { if (IsGpuThread()) { - ResultBox> box = new ResultBox>(); + ResultBox> box = new(); New().Set(buffer, offset, size, Ref(box)); InvokeCommand(); @@ -363,7 +365,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading public Capabilities GetCapabilities() { - ResultBox box = new ResultBox(); + ResultBox box = new(); New().Set(Ref(box)); InvokeCommand(); @@ -393,7 +395,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading { var program = new ThreadedProgram(this); - BinaryProgramRequest request = new BinaryProgramRequest(program, programBinary, hasFragmentShader, info); + BinaryProgramRequest request = new(program, programBinary, hasFragmentShader, info); Programs.Add(request); New().Set(Ref((IProgramRequest)request)); @@ -410,7 +412,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading public ICounterEvent ReportCounter(CounterType type, EventHandler resultHandler, bool hostReserved) { - ThreadedCounterEvent evt = new ThreadedCounterEvent(this, type, _lastSampleCounterClear); + ThreadedCounterEvent evt = new(this, type, _lastSampleCounterClear); New().Set(Ref(evt), type, Ref(resultHandler), hostReserved); QueueCommand(); @@ -466,7 +468,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading { lock (_interruptLock) { - while (Interlocked.CompareExchange(ref _interruptAction, action, null) != null) { } + while (Interlocked.CompareExchange(ref _interruptAction, action, null) != null) + { + } _galWorkAvailable.Set(); @@ -497,6 +501,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading public void Dispose() { + GC.SuppressFinalize(this); + // Dispose must happen from the render thread, after all commands have completed. // Stop the GPU thread. @@ -520,4 +526,4 @@ namespace Ryujinx.Graphics.GAL.Multithreading Sync.Dispose(); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedWindow.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedWindow.cs index a647d37e..3c4d5414 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedWindow.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedWindow.cs @@ -7,8 +7,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading { public class ThreadedWindow : IWindow { - private ThreadedRenderer _renderer; - private IRenderer _impl; + private readonly ThreadedRenderer _renderer; + private readonly IRenderer _impl; public ThreadedWindow(ThreadedRenderer renderer, IRenderer impl) { diff --git a/src/Ryujinx.Graphics.GAL/Origin.cs b/src/Ryujinx.Graphics.GAL/Origin.cs index d1b69cfd..bc2a21f1 100644 --- a/src/Ryujinx.Graphics.GAL/Origin.cs +++ b/src/Ryujinx.Graphics.GAL/Origin.cs @@ -3,6 +3,6 @@ public enum Origin { UpperLeft, - LowerLeft + LowerLeft, } } diff --git a/src/Ryujinx.Graphics.GAL/PinnedSpan.cs b/src/Ryujinx.Graphics.GAL/PinnedSpan.cs index 275b3b86..d028f07c 100644 --- a/src/Ryujinx.Graphics.GAL/PinnedSpan.cs +++ b/src/Ryujinx.Graphics.GAL/PinnedSpan.cs @@ -4,11 +4,11 @@ using System.Runtime.InteropServices; namespace Ryujinx.Graphics.GAL { - public unsafe struct PinnedSpan : IDisposable where T : unmanaged + public readonly unsafe struct PinnedSpan : IDisposable where T : unmanaged { - private void* _ptr; - private int _size; - private Action _disposeAction; + private readonly void* _ptr; + private readonly int _size; + private readonly Action _disposeAction; /// /// Creates a new PinnedSpan from an existing ReadOnlySpan. The span *must* be pinned in memory. diff --git a/src/Ryujinx.Graphics.GAL/PolygonMode.cs b/src/Ryujinx.Graphics.GAL/PolygonMode.cs index d6110c1b..841a6f22 100644 --- a/src/Ryujinx.Graphics.GAL/PolygonMode.cs +++ b/src/Ryujinx.Graphics.GAL/PolygonMode.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Graphics.GAL { Point = 0x1b00, Line = 0x1b01, - Fill = 0x1b02 + Fill = 0x1b02, } } diff --git a/src/Ryujinx.Graphics.GAL/PolygonModeMask.cs b/src/Ryujinx.Graphics.GAL/PolygonModeMask.cs index 514b4231..c6ac4509 100644 --- a/src/Ryujinx.Graphics.GAL/PolygonModeMask.cs +++ b/src/Ryujinx.Graphics.GAL/PolygonModeMask.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL public enum PolygonModeMask { Point = 1 << 0, - Line = 1 << 1, - Fill = 1 << 2 + Line = 1 << 1, + Fill = 1 << 2, } } diff --git a/src/Ryujinx.Graphics.GAL/PrimitiveTopology.cs b/src/Ryujinx.Graphics.GAL/PrimitiveTopology.cs index ed567a68..91e6a68a 100644 --- a/src/Ryujinx.Graphics.GAL/PrimitiveTopology.cs +++ b/src/Ryujinx.Graphics.GAL/PrimitiveTopology.cs @@ -16,6 +16,6 @@ namespace Ryujinx.Graphics.GAL LineStripAdjacency, TrianglesAdjacency, TriangleStripAdjacency, - Patches + Patches, } } diff --git a/src/Ryujinx.Graphics.GAL/ProgramLinkStatus.cs b/src/Ryujinx.Graphics.GAL/ProgramLinkStatus.cs index 5ca1be8c..4dd3b4d5 100644 --- a/src/Ryujinx.Graphics.GAL/ProgramLinkStatus.cs +++ b/src/Ryujinx.Graphics.GAL/ProgramLinkStatus.cs @@ -4,6 +4,6 @@ { Incomplete, Success, - Failure + Failure, } } diff --git a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs index 3cde281f..200292ee 100644 --- a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs +++ b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.GAL TextureAndSampler, Image, BufferTexture, - BufferImage + BufferImage, } public enum ResourceAccess : byte @@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.GAL None = 0, Read = 1, Write = 2, - ReadWrite = Read | Write + ReadWrite = Read | Write, } [Flags] @@ -32,7 +32,7 @@ namespace Ryujinx.Graphics.GAL TessellationControl = 1 << 2, TessellationEvaluation = 1 << 3, Geometry = 1 << 4, - Fragment = 1 << 5 + Fragment = 1 << 5, } public readonly struct ResourceDescriptor : IEquatable @@ -64,6 +64,16 @@ namespace Ryujinx.Graphics.GAL { return Binding == other.Binding && Count == other.Count && Type == other.Type && Stages == other.Stages; } + + public static bool operator ==(ResourceDescriptor left, ResourceDescriptor right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceDescriptor left, ResourceDescriptor right) + { + return !(left == right); + } } public readonly struct ResourceUsage : IEquatable @@ -95,6 +105,16 @@ namespace Ryujinx.Graphics.GAL { return Binding == other.Binding && Type == other.Type && Stages == other.Stages && Access == other.Access; } + + public static bool operator ==(ResourceUsage left, ResourceUsage right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceUsage left, ResourceUsage right) + { + return !(left == right); + } } public readonly struct ResourceDescriptorCollection @@ -108,7 +128,7 @@ namespace Ryujinx.Graphics.GAL public override int GetHashCode() { - HashCode hasher = new HashCode(); + HashCode hasher = new(); if (Descriptors != null) { @@ -151,6 +171,16 @@ namespace Ryujinx.Graphics.GAL return true; } + + public static bool operator ==(ResourceDescriptorCollection left, ResourceDescriptorCollection right) + { + return left.Equals(right); + } + + public static bool operator !=(ResourceDescriptorCollection left, ResourceDescriptorCollection right) + { + return !(left == right); + } } public readonly struct ResourceUsageCollection diff --git a/src/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs b/src/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs index 990c302e..2374a066 100644 --- a/src/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs @@ -12,43 +12,43 @@ namespace Ryujinx.Graphics.GAL public AddressMode AddressP { get; } public CompareMode CompareMode { get; } - public CompareOp CompareOp { get; } + public CompareOp CompareOp { get; } public ColorF BorderColor { get; } - public float MinLod { get; } - public float MaxLod { get; } - public float MipLodBias { get; } + public float MinLod { get; } + public float MaxLod { get; } + public float MipLodBias { get; } public float MaxAnisotropy { get; } public SamplerCreateInfo( - MinFilter minFilter, - MagFilter magFilter, - bool seamlessCubemap, + MinFilter minFilter, + MagFilter magFilter, + bool seamlessCubemap, AddressMode addressU, AddressMode addressV, AddressMode addressP, CompareMode compareMode, - CompareOp compareOp, - ColorF borderColor, - float minLod, - float maxLod, - float mipLodBias, - float maxAnisotropy) + CompareOp compareOp, + ColorF borderColor, + float minLod, + float maxLod, + float mipLodBias, + float maxAnisotropy) { - MinFilter = minFilter; - MagFilter = magFilter; + MinFilter = minFilter; + MagFilter = magFilter; SeamlessCubemap = seamlessCubemap; - AddressU = addressU; - AddressV = addressV; - AddressP = addressP; - CompareMode = compareMode; - CompareOp = compareOp; - BorderColor = borderColor; - MinLod = minLod; - MaxLod = maxLod; - MipLodBias = mipLodBias; - MaxAnisotropy = maxAnisotropy; + AddressU = addressU; + AddressV = addressV; + AddressP = addressP; + CompareMode = compareMode; + CompareOp = compareOp; + BorderColor = borderColor; + MinLod = minLod; + MaxLod = maxLod; + MipLodBias = mipLodBias; + MaxAnisotropy = maxAnisotropy; } public static SamplerCreateInfo Create(MinFilter minFilter, MagFilter magFilter) @@ -69,4 +69,4 @@ namespace Ryujinx.Graphics.GAL 1f); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs b/src/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs index 129913ec..31ad1fec 100644 --- a/src/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs +++ b/src/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs @@ -4,19 +4,19 @@ namespace Ryujinx.Graphics.GAL { public ScreenCaptureImageInfo(int width, int height, bool isBgra, byte[] data, bool flipX, bool flipY) { - Width = width; + Width = width; Height = height; IsBgra = isBgra; - Data = data; - FlipX = flipX; - FlipY = flipY; + Data = data; + FlipX = flipX; + FlipY = flipY; } - public int Width { get; } - public int Height { get; } - public byte[] Data { get; } - public bool IsBgra { get; } - public bool FlipX { get; } - public bool FlipY { get; } + public int Width { get; } + public int Height { get; } + public byte[] Data { get; } + public bool IsBgra { get; } + public bool FlipX { get; } + public bool FlipY { get; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ShaderInfo.cs b/src/Ryujinx.Graphics.GAL/ShaderInfo.cs index 643f1bc5..2fd3227d 100644 --- a/src/Ryujinx.Graphics.GAL/ShaderInfo.cs +++ b/src/Ryujinx.Graphics.GAL/ShaderInfo.cs @@ -23,4 +23,4 @@ namespace Ryujinx.Graphics.GAL FromCache = fromCache; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/ShaderSource.cs b/src/Ryujinx.Graphics.GAL/ShaderSource.cs index 773c0a8a..bf678e60 100644 --- a/src/Ryujinx.Graphics.GAL/ShaderSource.cs +++ b/src/Ryujinx.Graphics.GAL/ShaderSource.cs @@ -26,4 +26,4 @@ namespace Ryujinx.Graphics.GAL { } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/StencilOp.cs b/src/Ryujinx.Graphics.GAL/StencilOp.cs index fe999b0f..fa87f0b5 100644 --- a/src/Ryujinx.Graphics.GAL/StencilOp.cs +++ b/src/Ryujinx.Graphics.GAL/StencilOp.cs @@ -11,13 +11,13 @@ namespace Ryujinx.Graphics.GAL IncrementAndWrap, DecrementAndWrap, - ZeroGl = 0x0, - InvertGl = 0x150a, - KeepGl = 0x1e00, - ReplaceGl = 0x1e01, + ZeroGl = 0x0, + InvertGl = 0x150a, + KeepGl = 0x1e00, + ReplaceGl = 0x1e01, IncrementAndClampGl = 0x1e02, DecrementAndClampGl = 0x1e03, - IncrementAndWrapGl = 0x8507, - DecrementAndWrapGl = 0x8508 + IncrementAndWrapGl = 0x8507, + DecrementAndWrapGl = 0x8508, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs b/src/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs index db46c957..4309aa95 100644 --- a/src/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs +++ b/src/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs @@ -4,53 +4,53 @@ namespace Ryujinx.Graphics.GAL { public bool TestEnable { get; } - public CompareOp FrontFunc { get; } - public StencilOp FrontSFail { get; } - public StencilOp FrontDpPass { get; } - public StencilOp FrontDpFail { get; } - public int FrontFuncRef { get; } - public int FrontFuncMask { get; } - public int FrontMask { get; } - public CompareOp BackFunc { get; } - public StencilOp BackSFail { get; } - public StencilOp BackDpPass { get; } - public StencilOp BackDpFail { get; } - public int BackFuncRef { get; } - public int BackFuncMask { get; } - public int BackMask { get; } + public CompareOp FrontFunc { get; } + public StencilOp FrontSFail { get; } + public StencilOp FrontDpPass { get; } + public StencilOp FrontDpFail { get; } + public int FrontFuncRef { get; } + public int FrontFuncMask { get; } + public int FrontMask { get; } + public CompareOp BackFunc { get; } + public StencilOp BackSFail { get; } + public StencilOp BackDpPass { get; } + public StencilOp BackDpFail { get; } + public int BackFuncRef { get; } + public int BackFuncMask { get; } + public int BackMask { get; } public StencilTestDescriptor( - bool testEnable, + bool testEnable, CompareOp frontFunc, StencilOp frontSFail, StencilOp frontDpPass, StencilOp frontDpFail, - int frontFuncRef, - int frontFuncMask, - int frontMask, + int frontFuncRef, + int frontFuncMask, + int frontMask, CompareOp backFunc, StencilOp backSFail, StencilOp backDpPass, StencilOp backDpFail, - int backFuncRef, - int backFuncMask, - int backMask) + int backFuncRef, + int backFuncMask, + int backMask) { - TestEnable = testEnable; - FrontFunc = frontFunc; - FrontSFail = frontSFail; - FrontDpPass = frontDpPass; - FrontDpFail = frontDpFail; - FrontFuncRef = frontFuncRef; + TestEnable = testEnable; + FrontFunc = frontFunc; + FrontSFail = frontSFail; + FrontDpPass = frontDpPass; + FrontDpFail = frontDpFail; + FrontFuncRef = frontFuncRef; FrontFuncMask = frontFuncMask; - FrontMask = frontMask; - BackFunc = backFunc; - BackSFail = backSFail; - BackDpPass = backDpPass; - BackDpFail = backDpFail; - BackFuncRef = backFuncRef; - BackFuncMask = backFuncMask; - BackMask = backMask; + FrontMask = frontMask; + BackFunc = backFunc; + BackSFail = backSFail; + BackDpPass = backDpPass; + BackDpFail = backDpFail; + BackFuncRef = backFuncRef; + BackFuncMask = backFuncMask; + BackMask = backMask; } } } diff --git a/src/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs index 6eeddb6c..84936e54 100644 --- a/src/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs +++ b/src/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs @@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.GAL public SupportBuffer Data; public BufferHandle Handle; - private IRenderer _renderer; + private readonly IRenderer _renderer; private int _startOffset = -1; private int _endOffset = -1; @@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.GAL private void UpdateGenericField(int baseOffset, ReadOnlySpan data, Span target, int offset, int count) where T : unmanaged { - data.Slice(0, count).CopyTo(target.Slice(offset)); + data[..count].CopyTo(target[offset..]); int elemSize = Unsafe.SizeOf(); @@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.GAL { ReadOnlySpan data = MemoryMarshal.Cast(MemoryMarshal.CreateSpan(ref Data, 1)); - _renderer.SetBufferData(Handle, _startOffset, data.Slice(_startOffset, _endOffset - _startOffset)); + _renderer.SetBufferData(Handle, _startOffset, data[_startOffset.._endOffset]); _startOffset = -1; _endOffset = -1; @@ -95,6 +95,7 @@ namespace Ryujinx.Graphics.GAL public void Dispose() { + GC.SuppressFinalize(this); _renderer.DeleteBuffer(Handle); } } diff --git a/src/Ryujinx.Graphics.GAL/SwizzleComponent.cs b/src/Ryujinx.Graphics.GAL/SwizzleComponent.cs index a405bd13..ee65e010 100644 --- a/src/Ryujinx.Graphics.GAL/SwizzleComponent.cs +++ b/src/Ryujinx.Graphics.GAL/SwizzleComponent.cs @@ -7,6 +7,6 @@ namespace Ryujinx.Graphics.GAL Red, Green, Blue, - Alpha + Alpha, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/Target.cs b/src/Ryujinx.Graphics.GAL/Target.cs index 711eea24..73497546 100644 --- a/src/Ryujinx.Graphics.GAL/Target.cs +++ b/src/Ryujinx.Graphics.GAL/Target.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.GAL Texture2DMultisampleArray, Cubemap, CubemapArray, - TextureBuffer + TextureBuffer, } public static class TargetExtensions @@ -31,4 +31,4 @@ namespace Ryujinx.Graphics.GAL target == Target.CubemapArray; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 52b3b11f..44090291 100644 --- a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -6,13 +6,13 @@ namespace Ryujinx.Graphics.GAL { public readonly struct TextureCreateInfo : IEquatable { - public int Width { get; } - public int Height { get; } - public int Depth { get; } - public int Levels { get; } - public int Samples { get; } - public int BlockWidth { get; } - public int BlockHeight { get; } + public int Width { get; } + public int Height { get; } + public int Depth { get; } + public int Levels { get; } + public int Samples { get; } + public int BlockWidth { get; } + public int BlockHeight { get; } public int BytesPerPixel { get; } public bool IsCompressed => (BlockWidth | BlockHeight) != 1; @@ -29,37 +29,37 @@ namespace Ryujinx.Graphics.GAL public SwizzleComponent SwizzleA { get; } public TextureCreateInfo( - int width, - int height, - int depth, - int levels, - int samples, - int blockWidth, - int blockHeight, - int bytesPerPixel, - Format format, + int width, + int height, + int depth, + int levels, + int samples, + int blockWidth, + int blockHeight, + int bytesPerPixel, + Format format, DepthStencilMode depthStencilMode, - Target target, + Target target, SwizzleComponent swizzleR, SwizzleComponent swizzleG, SwizzleComponent swizzleB, SwizzleComponent swizzleA) { - Width = width; - Height = height; - Depth = depth; - Levels = levels; - Samples = samples; - BlockWidth = blockWidth; - BlockHeight = blockHeight; - BytesPerPixel = bytesPerPixel; - Format = format; + Width = width; + Height = height; + Depth = depth; + Levels = levels; + Samples = samples; + BlockWidth = blockWidth; + BlockHeight = blockHeight; + BytesPerPixel = bytesPerPixel; + Format = format; DepthStencilMode = depthStencilMode; - Target = target; - SwizzleR = swizzleR; - SwizzleG = swizzleG; - SwizzleB = swizzleB; - SwizzleA = swizzleA; + Target = target; + SwizzleR = swizzleR; + SwizzleG = swizzleG; + SwizzleB = swizzleB; + SwizzleA = swizzleA; } public int GetMipSize(int level) @@ -142,7 +142,7 @@ namespace Ryujinx.Graphics.GAL return HashCode.Combine(Width, Height); } - bool IEquatable.Equals(TextureCreateInfo other) + public bool Equals(TextureCreateInfo other) { return Width == other.Width && Height == other.Height && @@ -160,5 +160,20 @@ namespace Ryujinx.Graphics.GAL SwizzleB == other.SwizzleB && SwizzleA == other.SwizzleA; } + + public override bool Equals(object obj) + { + return obj is TextureCreateInfo info && this.Equals(info); + } + + public static bool operator ==(TextureCreateInfo left, TextureCreateInfo right) + { + return left.Equals(right); + } + + public static bool operator !=(TextureCreateInfo left, TextureCreateInfo right) + { + return !(left == right); + } } } diff --git a/src/Ryujinx.Graphics.GAL/UpscaleType.cs b/src/Ryujinx.Graphics.GAL/UpscaleType.cs index 442b65f2..ca24199c 100644 --- a/src/Ryujinx.Graphics.GAL/UpscaleType.cs +++ b/src/Ryujinx.Graphics.GAL/UpscaleType.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Graphics.GAL { Bilinear, Nearest, - Fsr + Fsr, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs b/src/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs index 15f0dff8..8fd3c816 100644 --- a/src/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs +++ b/src/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.GAL { public BufferRange Buffer { get; } - public int Stride { get; } + public int Stride { get; } public int Divisor { get; } public VertexBufferDescriptor(BufferRange buffer, int stride, int divisor) { - Buffer = buffer; - Stride = stride; + Buffer = buffer; + Stride = stride; Divisor = divisor; } } diff --git a/src/Ryujinx.Graphics.GAL/Viewport.cs b/src/Ryujinx.Graphics.GAL/Viewport.cs index 94012c00..12d13b7c 100644 --- a/src/Ryujinx.Graphics.GAL/Viewport.cs +++ b/src/Ryujinx.Graphics.GAL/Viewport.cs @@ -10,24 +10,24 @@ namespace Ryujinx.Graphics.GAL public ViewportSwizzle SwizzleW { get; } public float DepthNear { get; } - public float DepthFar { get; } + public float DepthFar { get; } public Viewport( Rectangle region, - ViewportSwizzle swizzleX, - ViewportSwizzle swizzleY, - ViewportSwizzle swizzleZ, - ViewportSwizzle swizzleW, - float depthNear, - float depthFar) + ViewportSwizzle swizzleX, + ViewportSwizzle swizzleY, + ViewportSwizzle swizzleZ, + ViewportSwizzle swizzleW, + float depthNear, + float depthFar) { - Region = region; - SwizzleX = swizzleX; - SwizzleY = swizzleY; - SwizzleZ = swizzleZ; - SwizzleW = swizzleW; + Region = region; + SwizzleX = swizzleX; + SwizzleY = swizzleY; + SwizzleZ = swizzleZ; + SwizzleW = swizzleW; DepthNear = depthNear; - DepthFar = depthFar; + DepthFar = depthFar; } } } diff --git a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs index c24a2246..9352c816 100644 --- a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs +++ b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs @@ -1,5 +1,8 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.Graphics.GAL { + [SuppressMessage("Design", "CA1069: Enums values should not be duplicated")] public enum ViewportSwizzle { PositiveX = 0, @@ -11,6 +14,6 @@ namespace Ryujinx.Graphics.GAL PositiveW = 6, NegativeW = 7, - NegativeFlag = 1 + NegativeFlag = 1, } }