aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Engine
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-02 02:47:54 +0200
committerGitHub <noreply@github.com>2023-07-02 02:47:54 +0200
commit3b46bb73f781a011705ecbc8a1d3207dfb145829 (patch)
tree1d5d2714c7001775b512bc14ce91a1ebbfc808df /src/Ryujinx.Graphics.Gpu/Engine
parent2457cfc9118a6ebb6008945c919edfd8b46af5e7 (diff)
[Ryujinx.Graphics.Gpu] Address dotnet-format issues (#5367)
* 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 IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1069 warnings * Address or silence dotnet format CA2211 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 * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Another rebase, another dotnet format run * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Replace MmeShadowScratch with Array256<uint> * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Address IDE0251 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First pass of dotnet format * Add unsafe dotnet format changes * Fix typos * Add trailing commas * Disable formatting for FormatTable * Address review feedback
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs10
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs204
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeQmd.cs270
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/ConditionalRenderEnabled.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs70
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs84
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs24
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs22
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs3
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs92
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoDevice.cs12
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs8
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs48
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/AluOperation.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/AluRegOperation.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/AssignmentOperation.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs3
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLEFunctionName.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs14
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs21
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/SetMmeShadowRamControlMode.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/ShaderTexture.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendPreGenTable.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendUcode.cs10
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/UcodeAssembler.cs52
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs10
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs22
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs7
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/RenderTargetUpdateFlags.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/SemaphoreUpdater.cs19
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs30
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs170
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs12
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs206
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs2
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs104
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs12
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs14
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs4
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs14
56 files changed, 847 insertions, 806 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
index d8103ac7..67743de3 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
@@ -1,9 +1,7 @@
using Ryujinx.Graphics.Device;
-using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
using Ryujinx.Graphics.Gpu.Engine.Threed;
using Ryujinx.Graphics.Gpu.Engine.Types;
-using Ryujinx.Graphics.Gpu.Image;
using Ryujinx.Graphics.Gpu.Shader;
using Ryujinx.Graphics.Shader;
using System;
@@ -39,7 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
{
{ nameof(ComputeClassState.LaunchDma), new RwCallback(LaunchDma, null) },
{ nameof(ComputeClassState.LoadInlineData), new RwCallback(LoadInlineData, null) },
- { nameof(ComputeClassState.SendSignalingPcasB), new RwCallback(SendSignalingPcasB, null) }
+ { nameof(ComputeClassState.SendSignalingPcasB), new RwCallback(SendSignalingPcasB, null) },
});
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
@@ -128,12 +126,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
ulong samplerPoolGpuVa = ((ulong)_state.State.SetTexSamplerPoolAOffsetUpper << 32) | _state.State.SetTexSamplerPoolB;
ulong texturePoolGpuVa = ((ulong)_state.State.SetTexHeaderPoolAOffsetUpper << 32) | _state.State.SetTexHeaderPoolB;
- GpuChannelPoolState poolState = new GpuChannelPoolState(
+ GpuChannelPoolState poolState = new(
texturePoolGpuVa,
_state.State.SetTexHeaderPoolCMaximumIndex,
_state.State.SetBindlessTextureConstantBufferSlotSelect);
- GpuChannelComputeState computeState = new GpuChannelComputeState(
+ GpuChannelComputeState computeState = new(
qmd.CtaThreadDimension0,
qmd.CtaThreadDimension1,
qmd.CtaThreadDimension2,
@@ -189,8 +187,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
cs = memoryManager.Physical.ShaderCache.GetComputeShader(_channel, poolState, computeState, shaderGpuVa);
_context.Renderer.Pipeline.SetProgram(cs.HostProgram);
-
- info = cs.Shaders[0].Info;
}
_channel.BufferManager.SetComputeBufferBindings(cs.Bindings);
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs
index 73dd31b2..0b192ef6 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs
@@ -98,24 +98,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
/// </summary>
unsafe struct ComputeClassState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetObject;
- public int SetObjectClassId => (int)(SetObject & 0xFFFF);
- public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
+ public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
+ public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
public fixed uint Reserved04[63];
public uint NoOperation;
public uint SetNotifyA;
- public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
+ public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
public uint SetNotifyB;
public uint Notify;
- public NotifyType NotifyType => (NotifyType)(Notify);
+ public readonly NotifyType NotifyType => (NotifyType)(Notify);
public uint WaitForIdle;
public fixed uint Reserved114[7];
public uint SetGlobalRenderEnableA;
- public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
+ public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
public uint SetGlobalRenderEnableB;
public uint SetGlobalRenderEnableC;
- public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
+ public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
public uint SendGoIdle;
public uint PmTrigger;
public uint PmTriggerWfi;
@@ -126,34 +126,34 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint LineLengthIn;
public uint LineCount;
public uint OffsetOutUpper;
- public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
+ public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
public uint OffsetOut;
public uint PitchOut;
public uint SetDstBlockSize;
- public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
- public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
- public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
+ public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
+ public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
+ public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
public uint SetDstWidth;
public uint SetDstHeight;
public uint SetDstDepth;
public uint SetDstLayer;
public uint SetDstOriginBytesX;
- public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
+ public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
public uint SetDstOriginSamplesY;
- public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
+ public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
public uint LaunchDma;
- public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
- public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
- public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
- public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
- public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
- public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
- public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
- public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
+ public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
+ public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
+ public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
+ public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
+ public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
+ public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
+ public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
+ public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
public uint LoadInlineData;
public fixed uint Reserved1B8[9];
public uint SetI2mSemaphoreA;
- public int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
+ public readonly int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
public uint SetI2mSemaphoreB;
public uint SetI2mSemaphoreC;
public fixed uint Reserved1E8[2];
@@ -162,20 +162,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetI2mSpareNoop02;
public uint SetI2mSpareNoop03;
public uint SetValidSpanOverflowAreaA;
- public int SetValidSpanOverflowAreaAAddressUpper => (int)(SetValidSpanOverflowAreaA & 0xFF);
+ public readonly int SetValidSpanOverflowAreaAAddressUpper => (int)(SetValidSpanOverflowAreaA & 0xFF);
public uint SetValidSpanOverflowAreaB;
public uint SetValidSpanOverflowAreaC;
public uint SetCoalesceWaitingPeriodUnit;
public uint PerfmonTransfer;
public uint SetShaderSharedMemoryWindow;
public uint SetSelectMaxwellTextureHeaders;
- public bool SetSelectMaxwellTextureHeadersV => (SetSelectMaxwellTextureHeaders & 0x1) != 0;
+ public readonly bool SetSelectMaxwellTextureHeadersV => (SetSelectMaxwellTextureHeaders & 0x1) != 0;
public uint InvalidateShaderCaches;
- public bool InvalidateShaderCachesInstruction => (InvalidateShaderCaches & 0x1) != 0;
- public bool InvalidateShaderCachesData => (InvalidateShaderCaches & 0x10) != 0;
- public bool InvalidateShaderCachesConstant => (InvalidateShaderCaches & 0x1000) != 0;
- public bool InvalidateShaderCachesLocks => (InvalidateShaderCaches & 0x2) != 0;
- public bool InvalidateShaderCachesFlushData => (InvalidateShaderCaches & 0x4) != 0;
+ public readonly bool InvalidateShaderCachesInstruction => (InvalidateShaderCaches & 0x1) != 0;
+ public readonly bool InvalidateShaderCachesData => (InvalidateShaderCaches & 0x10) != 0;
+ public readonly bool InvalidateShaderCachesConstant => (InvalidateShaderCaches & 0x1000) != 0;
+ public readonly bool InvalidateShaderCachesLocks => (InvalidateShaderCaches & 0x2) != 0;
+ public readonly bool InvalidateShaderCachesFlushData => (InvalidateShaderCaches & 0x4) != 0;
public uint SetReservedSwMethod00;
public uint SetReservedSwMethod01;
public uint SetReservedSwMethod02;
@@ -185,13 +185,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetReservedSwMethod06;
public uint SetReservedSwMethod07;
public uint SetCwdControl;
- public SetCwdControlSmSelection SetCwdControlSmSelection => (SetCwdControlSmSelection)(SetCwdControl & 0x1);
+ public readonly SetCwdControlSmSelection SetCwdControlSmSelection => (SetCwdControlSmSelection)(SetCwdControl & 0x1);
public uint InvalidateTextureHeaderCacheNoWfi;
- public InvalidateCacheLines InvalidateTextureHeaderCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureHeaderCacheNoWfi & 0x1);
- public int InvalidateTextureHeaderCacheNoWfiTag => (int)((InvalidateTextureHeaderCacheNoWfi >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateTextureHeaderCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureHeaderCacheNoWfi & 0x1);
+ public readonly int InvalidateTextureHeaderCacheNoWfiTag => (int)((InvalidateTextureHeaderCacheNoWfi >> 4) & 0x3FFFFF);
public uint SetCwdRefCounter;
- public int SetCwdRefCounterSelect => (int)(SetCwdRefCounter & 0x3F);
- public int SetCwdRefCounterValue => (int)((SetCwdRefCounter >> 8) & 0xFFFF);
+ public readonly int SetCwdRefCounterSelect => (int)(SetCwdRefCounter & 0x3F);
+ public readonly int SetCwdRefCounterValue => (int)((SetCwdRefCounter >> 8) & 0xFFFF);
public uint SetReservedSwMethod08;
public uint SetReservedSwMethod09;
public uint SetReservedSwMethod10;
@@ -201,59 +201,59 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetReservedSwMethod14;
public uint SetReservedSwMethod15;
public uint SetGwcScgType;
- public SetGwcScgTypeScgType SetGwcScgTypeScgType => (SetGwcScgTypeScgType)(SetGwcScgType & 0x1);
+ public readonly SetGwcScgTypeScgType SetGwcScgTypeScgType => (SetGwcScgTypeScgType)(SetGwcScgType & 0x1);
public uint SetScgControl;
- public int SetScgControlCompute1MaxSmCount => (int)(SetScgControl & 0x1FF);
+ public readonly int SetScgControlCompute1MaxSmCount => (int)(SetScgControl & 0x1FF);
public uint InvalidateConstantBufferCacheA;
- public int InvalidateConstantBufferCacheAAddressUpper => (int)(InvalidateConstantBufferCacheA & 0xFF);
+ public readonly int InvalidateConstantBufferCacheAAddressUpper => (int)(InvalidateConstantBufferCacheA & 0xFF);
public uint InvalidateConstantBufferCacheB;
public uint InvalidateConstantBufferCacheC;
- public int InvalidateConstantBufferCacheCByteCount => (int)(InvalidateConstantBufferCacheC & 0x1FFFF);
- public bool InvalidateConstantBufferCacheCThruL2 => (InvalidateConstantBufferCacheC & 0x80000000) != 0;
+ public readonly int InvalidateConstantBufferCacheCByteCount => (int)(InvalidateConstantBufferCacheC & 0x1FFFF);
+ public readonly bool InvalidateConstantBufferCacheCThruL2 => (InvalidateConstantBufferCacheC & 0x80000000) != 0;
public uint SetComputeClassVersion;
- public int SetComputeClassVersionCurrent => (int)(SetComputeClassVersion & 0xFFFF);
- public int SetComputeClassVersionOldestSupported => (int)((SetComputeClassVersion >> 16) & 0xFFFF);
+ public readonly int SetComputeClassVersionCurrent => (int)(SetComputeClassVersion & 0xFFFF);
+ public readonly int SetComputeClassVersionOldestSupported => (int)((SetComputeClassVersion >> 16) & 0xFFFF);
public uint CheckComputeClassVersion;
- public int CheckComputeClassVersionCurrent => (int)(CheckComputeClassVersion & 0xFFFF);
- public int CheckComputeClassVersionOldestSupported => (int)((CheckComputeClassVersion >> 16) & 0xFFFF);
+ public readonly int CheckComputeClassVersionCurrent => (int)(CheckComputeClassVersion & 0xFFFF);
+ public readonly int CheckComputeClassVersionOldestSupported => (int)((CheckComputeClassVersion >> 16) & 0xFFFF);
public uint SetQmdVersion;
- public int SetQmdVersionCurrent => (int)(SetQmdVersion & 0xFFFF);
- public int SetQmdVersionOldestSupported => (int)((SetQmdVersion >> 16) & 0xFFFF);
+ public readonly int SetQmdVersionCurrent => (int)(SetQmdVersion & 0xFFFF);
+ public readonly int SetQmdVersionOldestSupported => (int)((SetQmdVersion >> 16) & 0xFFFF);
public uint SetWfiConfig;
- public bool SetWfiConfigEnableScgTypeWfi => (SetWfiConfig & 0x1) != 0;
+ public readonly bool SetWfiConfigEnableScgTypeWfi => (SetWfiConfig & 0x1) != 0;
public uint CheckQmdVersion;
- public int CheckQmdVersionCurrent => (int)(CheckQmdVersion & 0xFFFF);
- public int CheckQmdVersionOldestSupported => (int)((CheckQmdVersion >> 16) & 0xFFFF);
+ public readonly int CheckQmdVersionCurrent => (int)(CheckQmdVersion & 0xFFFF);
+ public readonly int CheckQmdVersionOldestSupported => (int)((CheckQmdVersion >> 16) & 0xFFFF);
public uint WaitForIdleScgType;
public uint InvalidateSkedCaches;
- public bool InvalidateSkedCachesV => (InvalidateSkedCaches & 0x1) != 0;
+ public readonly bool InvalidateSkedCachesV => (InvalidateSkedCaches & 0x1) != 0;
public uint SetScgRenderEnableControl;
- public bool SetScgRenderEnableControlCompute1UsesRenderEnable => (SetScgRenderEnableControl & 0x1) != 0;
+ public readonly bool SetScgRenderEnableControlCompute1UsesRenderEnable => (SetScgRenderEnableControl & 0x1) != 0;
public fixed uint Reserved2A0[4];
public uint SetCwdSlotCount;
- public int SetCwdSlotCountV => (int)(SetCwdSlotCount & 0xFF);
+ public readonly int SetCwdSlotCountV => (int)(SetCwdSlotCount & 0xFF);
public uint SendPcasA;
public uint SendPcasB;
- public int SendPcasBFrom => (int)(SendPcasB & 0xFFFFFF);
- public int SendPcasBDelta => (int)((SendPcasB >> 24) & 0xFF);
+ public readonly int SendPcasBFrom => (int)(SendPcasB & 0xFFFFFF);
+ public readonly int SendPcasBDelta => (int)((SendPcasB >> 24) & 0xFF);
public uint SendSignalingPcasB;
- public bool SendSignalingPcasBInvalidate => (SendSignalingPcasB & 0x1) != 0;
- public bool SendSignalingPcasBSchedule => (SendSignalingPcasB & 0x2) != 0;
+ public readonly bool SendSignalingPcasBInvalidate => (SendSignalingPcasB & 0x1) != 0;
+ public readonly bool SendSignalingPcasBSchedule => (SendSignalingPcasB & 0x2) != 0;
public fixed uint Reserved2C0[9];
public uint SetShaderLocalMemoryNonThrottledA;
- public int SetShaderLocalMemoryNonThrottledASizeUpper => (int)(SetShaderLocalMemoryNonThrottledA & 0xFF);
+ public readonly int SetShaderLocalMemoryNonThrottledASizeUpper => (int)(SetShaderLocalMemoryNonThrottledA & 0xFF);
public uint SetShaderLocalMemoryNonThrottledB;
public uint SetShaderLocalMemoryNonThrottledC;
- public int SetShaderLocalMemoryNonThrottledCMaxSmCount => (int)(SetShaderLocalMemoryNonThrottledC & 0x1FF);
+ public readonly int SetShaderLocalMemoryNonThrottledCMaxSmCount => (int)(SetShaderLocalMemoryNonThrottledC & 0x1FF);
public uint SetShaderLocalMemoryThrottledA;
- public int SetShaderLocalMemoryThrottledASizeUpper => (int)(SetShaderLocalMemoryThrottledA & 0xFF);
+ public readonly int SetShaderLocalMemoryThrottledASizeUpper => (int)(SetShaderLocalMemoryThrottledA & 0xFF);
public uint SetShaderLocalMemoryThrottledB;
public uint SetShaderLocalMemoryThrottledC;
- public int SetShaderLocalMemoryThrottledCMaxSmCount => (int)(SetShaderLocalMemoryThrottledC & 0x1FF);
+ public readonly int SetShaderLocalMemoryThrottledCMaxSmCount => (int)(SetShaderLocalMemoryThrottledC & 0x1FF);
public fixed uint Reserved2FC[5];
public uint SetSpaVersion;
- public int SetSpaVersionMinor => (int)(SetSpaVersion & 0xFF);
- public int SetSpaVersionMajor => (int)((SetSpaVersion >> 8) & 0xFF);
+ public readonly int SetSpaVersionMinor => (int)(SetSpaVersion & 0xFF);
+ public readonly int SetSpaVersionMajor => (int)((SetSpaVersion >> 8) & 0xFF);
public fixed uint Reserved314[123];
public uint SetFalcon00;
public uint SetFalcon01;
@@ -291,14 +291,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetShaderLocalMemoryWindow;
public fixed uint Reserved780[4];
public uint SetShaderLocalMemoryA;
- public int SetShaderLocalMemoryAAddressUpper => (int)(SetShaderLocalMemoryA & 0xFF);
+ public readonly int SetShaderLocalMemoryAAddressUpper => (int)(SetShaderLocalMemoryA & 0xFF);
public uint SetShaderLocalMemoryB;
public fixed uint Reserved798[383];
public uint SetShaderCacheControl;
- public bool SetShaderCacheControlIcachePrefetchEnable => (SetShaderCacheControl & 0x1) != 0;
+ public readonly bool SetShaderCacheControlIcachePrefetchEnable => (SetShaderCacheControl & 0x1) != 0;
public fixed uint ReservedD98[19];
public uint SetSmTimeoutInterval;
- public int SetSmTimeoutIntervalCounterBit => (int)(SetSmTimeoutInterval & 0x3F);
+ public readonly int SetSmTimeoutIntervalCounterBit => (int)(SetSmTimeoutInterval & 0x3F);
public fixed uint ReservedDE8[87];
public uint SetSpareNoop12;
public uint SetSpareNoop13;
@@ -319,62 +319,62 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetSpareNoop11;
public fixed uint Reserved1070[103];
public uint InvalidateSamplerCacheAll;
- public bool InvalidateSamplerCacheAllV => (InvalidateSamplerCacheAll & 0x1) != 0;
+ public readonly bool InvalidateSamplerCacheAllV => (InvalidateSamplerCacheAll & 0x1) != 0;
public uint InvalidateTextureHeaderCacheAll;
- public bool InvalidateTextureHeaderCacheAllV => (InvalidateTextureHeaderCacheAll & 0x1) != 0;
+ public readonly bool InvalidateTextureHeaderCacheAllV => (InvalidateTextureHeaderCacheAll & 0x1) != 0;
public fixed uint Reserved1214[29];
public uint InvalidateTextureDataCacheNoWfi;
- public InvalidateCacheLines InvalidateTextureDataCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureDataCacheNoWfi & 0x1);
- public int InvalidateTextureDataCacheNoWfiTag => (int)((InvalidateTextureDataCacheNoWfi >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateTextureDataCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureDataCacheNoWfi & 0x1);
+ public readonly int InvalidateTextureDataCacheNoWfiTag => (int)((InvalidateTextureDataCacheNoWfi >> 4) & 0x3FFFFF);
public fixed uint Reserved128C[7];
public uint ActivatePerfSettingsForComputeContext;
- public bool ActivatePerfSettingsForComputeContextAll => (ActivatePerfSettingsForComputeContext & 0x1) != 0;
+ public readonly bool ActivatePerfSettingsForComputeContextAll => (ActivatePerfSettingsForComputeContext & 0x1) != 0;
public fixed uint Reserved12AC[33];
public uint InvalidateSamplerCache;
- public InvalidateCacheLines InvalidateSamplerCacheLines => (InvalidateCacheLines)(InvalidateSamplerCache & 0x1);
- public int InvalidateSamplerCacheTag => (int)((InvalidateSamplerCache >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateSamplerCacheLines => (InvalidateCacheLines)(InvalidateSamplerCache & 0x1);
+ public readonly int InvalidateSamplerCacheTag => (int)((InvalidateSamplerCache >> 4) & 0x3FFFFF);
public uint InvalidateTextureHeaderCache;
- public InvalidateCacheLines InvalidateTextureHeaderCacheLines => (InvalidateCacheLines)(InvalidateTextureHeaderCache & 0x1);
- public int InvalidateTextureHeaderCacheTag => (int)((InvalidateTextureHeaderCache >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateTextureHeaderCacheLines => (InvalidateCacheLines)(InvalidateTextureHeaderCache & 0x1);
+ public readonly int InvalidateTextureHeaderCacheTag => (int)((InvalidateTextureHeaderCache >> 4) & 0x3FFFFF);
public uint InvalidateTextureDataCache;
- public InvalidateCacheLines InvalidateTextureDataCacheLines => (InvalidateCacheLines)(InvalidateTextureDataCache & 0x1);
- public int InvalidateTextureDataCacheTag => (int)((InvalidateTextureDataCache >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateTextureDataCacheLines => (InvalidateCacheLines)(InvalidateTextureDataCache & 0x1);
+ public readonly int InvalidateTextureDataCacheTag => (int)((InvalidateTextureDataCache >> 4) & 0x3FFFFF);
public fixed uint Reserved133C[58];
public uint InvalidateSamplerCacheNoWfi;
- public InvalidateCacheLines InvalidateSamplerCacheNoWfiLines => (InvalidateCacheLines)(InvalidateSamplerCacheNoWfi & 0x1);
- public int InvalidateSamplerCacheNoWfiTag => (int)((InvalidateSamplerCacheNoWfi >> 4) & 0x3FFFFF);
+ public readonly InvalidateCacheLines InvalidateSamplerCacheNoWfiLines => (InvalidateCacheLines)(InvalidateSamplerCacheNoWfi & 0x1);
+ public readonly int InvalidateSamplerCacheNoWfiTag => (int)((InvalidateSamplerCacheNoWfi >> 4) & 0x3FFFFF);
public fixed uint Reserved1428[64];
public uint SetShaderExceptions;
- public bool SetShaderExceptionsEnable => (SetShaderExceptions & 0x1) != 0;
+ public readonly bool SetShaderExceptionsEnable => (SetShaderExceptions & 0x1) != 0;
public fixed uint Reserved152C[9];
public uint SetRenderEnableA;
- public int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
+ public readonly int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
public uint SetRenderEnableB;
public uint SetRenderEnableC;
- public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
+ public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
public uint SetTexSamplerPoolA;
- public int SetTexSamplerPoolAOffsetUpper => (int)(SetTexSamplerPoolA & 0xFF);
+ public readonly int SetTexSamplerPoolAOffsetUpper => (int)(SetTexSamplerPoolA & 0xFF);
public uint SetTexSamplerPoolB;
public uint SetTexSamplerPoolC;
- public int SetTexSamplerPoolCMaximumIndex => (int)(SetTexSamplerPoolC & 0xFFFFF);
+ public readonly int SetTexSamplerPoolCMaximumIndex => (int)(SetTexSamplerPoolC & 0xFFFFF);
public fixed uint Reserved1568[3];
public uint SetTexHeaderPoolA;
- public int SetTexHeaderPoolAOffsetUpper => (int)(SetTexHeaderPoolA & 0xFF);
+ public readonly int SetTexHeaderPoolAOffsetUpper => (int)(SetTexHeaderPoolA & 0xFF);
public uint SetTexHeaderPoolB;
public uint SetTexHeaderPoolC;
- public int SetTexHeaderPoolCMaximumIndex => (int)(SetTexHeaderPoolC & 0x3FFFFF);
+ public readonly int SetTexHeaderPoolCMaximumIndex => (int)(SetTexHeaderPoolC & 0x3FFFFF);
public fixed uint Reserved1580[34];
public uint SetProgramRegionA;
- public int SetProgramRegionAAddressUpper => (int)(SetProgramRegionA & 0xFF);
+ public readonly int SetProgramRegionAAddressUpper => (int)(SetProgramRegionA & 0xFF);
public uint SetProgramRegionB;
public fixed uint Reserved1610[34];
public uint InvalidateShaderCachesNoWfi;
- public bool InvalidateShaderCachesNoWfiInstruction => (InvalidateShaderCachesNoWfi & 0x1) != 0;
- public bool InvalidateShaderCachesNoWfiGlobalData => (InvalidateShaderCachesNoWfi & 0x10) != 0;
- public bool InvalidateShaderCachesNoWfiConstant => (InvalidateShaderCachesNoWfi & 0x1000) != 0;
+ public readonly bool InvalidateShaderCachesNoWfiInstruction => (InvalidateShaderCachesNoWfi & 0x1) != 0;
+ public readonly bool InvalidateShaderCachesNoWfiGlobalData => (InvalidateShaderCachesNoWfi & 0x10) != 0;
+ public readonly bool InvalidateShaderCachesNoWfiConstant => (InvalidateShaderCachesNoWfi & 0x1000) != 0;
public fixed uint Reserved169C[170];
public uint SetRenderEnableOverride;
- public SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
+ public readonly SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
public fixed uint Reserved1948[57];
public uint PipeNop;
public uint SetSpare00;
@@ -383,20 +383,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public uint SetSpare03;
public fixed uint Reserved1A40[48];
public uint SetReportSemaphoreA;
- public int SetReportSemaphoreAOffsetUpper => (int)(SetReportSemaphoreA & 0xFF);
+ public readonly int SetReportSemaphoreAOffsetUpper => (int)(SetReportSemaphoreA & 0xFF);
public uint SetReportSemaphoreB;
public uint SetReportSemaphoreC;
public uint SetReportSemaphoreD;
- public SetReportSemaphoreDOperation SetReportSemaphoreDOperation => (SetReportSemaphoreDOperation)(SetReportSemaphoreD & 0x3);
- public bool SetReportSemaphoreDAwakenEnable => (SetReportSemaphoreD & 0x100000) != 0;
- public SetReportSemaphoreDStructureSize SetReportSemaphoreDStructureSize => (SetReportSemaphoreDStructureSize)((SetReportSemaphoreD >> 28) & 0x1);
- public bool SetReportSemaphoreDFlushDisable => (SetReportSemaphoreD & 0x4) != 0;
- public bool SetReportSemaphoreDReductionEnable => (SetReportSemaphoreD & 0x8) != 0;
- public SetReportSemaphoreDReductionOp SetReportSemaphoreDReductionOp => (SetReportSemaphoreDReductionOp)((SetReportSemaphoreD >> 9) & 0x7);
- public SetReportSemaphoreDReductionFormat SetReportSemaphoreDReductionFormat => (SetReportSemaphoreDReductionFormat)((SetReportSemaphoreD >> 17) & 0x3);
+ public readonly SetReportSemaphoreDOperation SetReportSemaphoreDOperation => (SetReportSemaphoreDOperation)(SetReportSemaphoreD & 0x3);
+ public readonly bool SetReportSemaphoreDAwakenEnable => (SetReportSemaphoreD & 0x100000) != 0;
+ public readonly SetReportSemaphoreDStructureSize SetReportSemaphoreDStructureSize => (SetReportSemaphoreDStructureSize)((SetReportSemaphoreD >> 28) & 0x1);
+ public readonly bool SetReportSemaphoreDFlushDisable => (SetReportSemaphoreD & 0x4) != 0;
+ public readonly bool SetReportSemaphoreDReductionEnable => (SetReportSemaphoreD & 0x8) != 0;
+ public readonly SetReportSemaphoreDReductionOp SetReportSemaphoreDReductionOp => (SetReportSemaphoreDReductionOp)((SetReportSemaphoreD >> 9) & 0x7);
+ public readonly SetReportSemaphoreDReductionFormat SetReportSemaphoreDReductionFormat => (SetReportSemaphoreDReductionFormat)((SetReportSemaphoreD >> 17) & 0x3);
public fixed uint Reserved1B10[702];
public uint SetBindlessTexture;
- public int SetBindlessTextureConstantBufferSlotSelect => (int)(SetBindlessTexture & 0x7);
+ public readonly int SetBindlessTextureConstantBufferSlotSelect => (int)(SetBindlessTexture & 0x7);
public uint SetTrapHandler;
public fixed uint Reserved2610[843];
public Array8<uint> SetShaderPerformanceCounterValueUpper;
@@ -423,13 +423,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
public bool SetShaderPerformanceCounterControlBWindowed(int i) => (SetShaderPerformanceCounterControlB[i] & 0x8) != 0;
public int SetShaderPerformanceCounterControlBFunc(int i) => (int)((SetShaderPerformanceCounterControlB[i] >> 4) & 0xFFFF);
public uint SetShaderPerformanceCounterTrapControl;
- public int SetShaderPerformanceCounterTrapControlMask => (int)(SetShaderPerformanceCounterTrapControl & 0xFF);
+ public readonly int SetShaderPerformanceCounterTrapControlMask => (int)(SetShaderPerformanceCounterTrapControl & 0xFF);
public uint StartShaderPerformanceCounter;
- public int StartShaderPerformanceCounterCounterMask => (int)(StartShaderPerformanceCounter & 0xFF);
+ public readonly int StartShaderPerformanceCounterCounterMask => (int)(StartShaderPerformanceCounter & 0xFF);
public uint StopShaderPerformanceCounter;
- public int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF);
+ public readonly int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF);
public fixed uint Reserved33E8[6];
- public MmeShadowScratch SetMmeShadowScratch;
+ public Array256<uint> SetMmeShadowScratch;
#pragma warning restore CS0649
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeQmd.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeQmd.cs
index 1b20e41c..4e750ff5 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeQmd.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeQmd.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum DependentQmdType
{
Queue,
- Grid
+ Grid,
}
/// <summary>
@@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum ReleaseMembarType
{
FeNone,
- FeSysmembar
+ FeSysmembar,
}
/// <summary>
@@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
{
L1None,
L1Sysmembar,
- L1Membar
+ L1Membar,
}
/// <summary>
@@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum Fp32NanBehavior
{
Legacy,
- Fp64Compatible
+ Fp64Compatible,
}
/// <summary>
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum Fp32F2iNanBehavior
{
PassZero,
- PassIndefinite
+ PassIndefinite,
}
/// <summary>
@@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum ApiVisibleCallLimit
{
_32,
- NoCheck
+ NoCheck,
}
/// <summary>
@@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum SharedMemoryBankMapping
{
FourBytesPerBank,
- EightBytesPerBank
+ EightBytesPerBank,
}
/// <summary>
@@ -74,7 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum Fp32NarrowInstruction
{
KeepDenorms,
- FlushDenorms
+ FlushDenorms,
}
/// <summary>
@@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
{
DirectlyAddressableMemorySize16kb,
DirectlyAddressableMemorySize32kb,
- DirectlyAddressableMemorySize48kb
+ DirectlyAddressableMemorySize48kb,
}
/// <summary>
@@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
RedDec,
RedAnd,
RedOr,
- RedXor
+ RedXor,
}
/// <summary>
@@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum ReductionFormat
{
Unsigned32,
- Signed32
+ Signed32,
}
/// <summary>
@@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
enum StructureSize
{
FourWords,
- OneWord
+ OneWord,
}
/// <summary>
@@ -127,129 +127,129 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
{
private fixed int _words[64];
- public int OuterPut => BitRange(30, 0);
- public bool OuterOverflow => Bit(31);
- public int OuterGet => BitRange(62, 32);
- public bool OuterStickyOverflow => Bit(63);
- public int InnerGet => BitRange(94, 64);
- public bool InnerOverflow => Bit(95);
- public int InnerPut => BitRange(126, 96);
- public bool InnerStickyOverflow => Bit(127);
- public int QmdReservedAA => BitRange(159, 128);
- public int DependentQmdPointer => BitRange(191, 160);
- public int QmdGroupId => BitRange(197, 192);
- public bool SmGlobalCachingEnable => Bit(198);
- public bool RunCtaInOneSmPartition => Bit(199);
- public bool IsQueue => Bit(200);
- public bool AddToHeadOfQmdGroupLinkedList => Bit(201);
- public bool SemaphoreReleaseEnable0 => Bit(202);
- public bool SemaphoreReleaseEnable1 => Bit(203);
- public bool RequireSchedulingPcas => Bit(204);
- public bool DependentQmdScheduleEnable => Bit(205);
- public DependentQmdType DependentQmdType => (DependentQmdType)BitRange(206, 206);
- public bool DependentQmdFieldCopy => Bit(207);
- public int QmdReservedB => BitRange(223, 208);
- public int CircularQueueSize => BitRange(248, 224);
- public bool QmdReservedC => Bit(249);
- public bool InvalidateTextureHeaderCache => Bit(250);
- public bool InvalidateTextureSamplerCache => Bit(251);
- public bool InvalidateTextureDataCache => Bit(252);
- public bool InvalidateShaderDataCache => Bit(253);
- public bool InvalidateInstructionCache => Bit(254);
- public bool InvalidateShaderConstantCache => Bit(255);
- public int ProgramOffset => BitRange(287, 256);
- public int CircularQueueAddrLower => BitRange(319, 288);
- public int CircularQueueAddrUpper => BitRange(327, 320);
- public int QmdReservedD => BitRange(335, 328);
- public int CircularQueueEntrySize => BitRange(351, 336);
- public int CwdReferenceCountId => BitRange(357, 352);
- public int CwdReferenceCountDeltaMinusOne => BitRange(365, 358);
- public ReleaseMembarType ReleaseMembarType => (ReleaseMembarType)BitRange(366, 366);
- public bool CwdReferenceCountIncrEnable => Bit(367);
- public CwdMembarType CwdMembarType => (CwdMembarType)BitRange(369, 368);
- public bool SequentiallyRunCtas => Bit(370);
- public bool CwdReferenceCountDecrEnable => Bit(371);
- public bool Throttled => Bit(372);
- public Fp32NanBehavior Fp32NanBehavior => (Fp32NanBehavior)BitRange(376, 376);
- public Fp32F2iNanBehavior Fp32F2iNanBehavior => (Fp32F2iNanBehavior)BitRange(377, 377);
- public ApiVisibleCallLimit ApiVisibleCallLimit => (ApiVisibleCallLimit)BitRange(378, 378);
- public SharedMemoryBankMapping SharedMemoryBankMapping => (SharedMemoryBankMapping)BitRange(379, 379);
- public SamplerIndex SamplerIndex => (SamplerIndex)BitRange(382, 382);
- public Fp32NarrowInstruction Fp32NarrowInstruction => (Fp32NarrowInstruction)BitRange(383, 383);
- public int CtaRasterWidth => BitRange(415, 384);
- public int CtaRasterHeight => BitRange(431, 416);
- public int CtaRasterDepth => BitRange(447, 432);
- public int CtaRasterWidthResume => BitRange(479, 448);
- public int CtaRasterHeightResume => BitRange(495, 480);
- public int CtaRasterDepthResume => BitRange(511, 496);
- public int QueueEntriesPerCtaMinusOne => BitRange(518, 512);
- public int CoalesceWaitingPeriod => BitRange(529, 522);
- public int SharedMemorySize => BitRange(561, 544);
- public int QmdReservedG => BitRange(575, 562);
- public int QmdVersion => BitRange(579, 576);
- public int QmdMajorVersion => BitRange(583, 580);
- public int QmdReservedH => BitRange(591, 584);
- public int CtaThreadDimension0 => BitRange(607, 592);
- public int CtaThreadDimension1 => BitRange(623, 608);
- public int CtaThreadDimension2 => BitRange(639, 624);
- public bool ConstantBufferValid(int i) => Bit(640 + i * 1);
- public int QmdReservedI => BitRange(668, 648);
- public L1Configuration L1Configuration => (L1Configuration)BitRange(671, 669);
- public int SmDisableMaskLower => BitRange(703, 672);
- public int SmDisableMaskUpper => BitRange(735, 704);
- public int Release0AddressLower => BitRange(767, 736);
- public int Release0AddressUpper => BitRange(775, 768);
- public int QmdReservedJ => BitRange(783, 776);
- public ReductionOp Release0ReductionOp => (ReductionOp)BitRange(790, 788);
- public bool QmdReservedK => Bit(791);
- public ReductionFormat Release0ReductionFormat => (ReductionFormat)BitRange(793, 792);
- public bool Release0ReductionEnable => Bit(794);
- public StructureSize Release0StructureSize => (StructureSize)BitRange(799, 799);
- public int Release0Payload => BitRange(831, 800);
- public int Release1AddressLower => BitRange(863, 832);
- public int Release1AddressUpper => BitRange(871, 864);
- public int QmdReservedL => BitRange(879, 872);
- public ReductionOp Release1ReductionOp => (ReductionOp)BitRange(886, 884);
- public bool QmdReservedM => Bit(887);
- public ReductionFormat Release1ReductionFormat => (ReductionFormat)BitRange(889, 888);
- public bool Release1ReductionEnable => Bit(890);
- public StructureSize Release1StructureSize => (StructureSize)BitRange(895, 895);
- public int Release1Payload => BitRange(927, 896);
- public int ConstantBufferAddrLower(int i) => BitRange(959 + i * 64, 928 + i * 64);
- public int ConstantBufferAddrUpper(int i) => BitRange(967 + i * 64, 960 + i * 64);
- public int ConstantBufferReservedAddr(int i) => BitRange(973 + i * 64, 968 + i * 64);
- public bool ConstantBufferInvalidate(int i) => Bit(974 + i * 64);
- public int ConstantBufferSize(int i) => BitRange(991 + i * 64, 975 + i * 64);
- public int ShaderLocalMemoryLowSize => BitRange(1463, 1440);
- public int QmdReservedN => BitRange(1466, 1464);
- public int BarrierCount => BitRange(1471, 1467);
- public int ShaderLocalMemoryHighSize => BitRange(1495, 1472);
- public int RegisterCount => BitRange(1503, 1496);
- public int ShaderLocalMemoryCrsSize => BitRange(1527, 1504);
- public int SassVersion => BitRange(1535, 1528);
- public int HwOnlyInnerGet => BitRange(1566, 1536);
- public bool HwOnlyRequireSchedulingPcas => Bit(1567);
- public int HwOnlyInnerPut => BitRange(1598, 1568);
- public bool HwOnlyScgType => Bit(1599);
- public int HwOnlySpanListHeadIndex => BitRange(1629, 1600);
- public bool QmdReservedQ => Bit(1630);
- public bool HwOnlySpanListHeadIndexValid => Bit(1631);
- public int HwOnlySkedNextQmdPointer => BitRange(1663, 1632);
- public int QmdSpareE => BitRange(1695, 1664);
- public int QmdSpareF => BitRange(1727, 1696);
- public int QmdSpareG => BitRange(1759, 1728);
- public int QmdSpareH => BitRange(1791, 1760);
- public int QmdSpareI => BitRange(1823, 1792);
- public int QmdSpareJ => BitRange(1855, 1824);
- public int QmdSpareK => BitRange(1887, 1856);
- public int QmdSpareL => BitRange(1919, 1888);
- public int QmdSpareM => BitRange(1951, 1920);
- public int QmdSpareN => BitRange(1983, 1952);
- public int DebugIdUpper => BitRange(2015, 1984);
- public int DebugIdLower => BitRange(2047, 2016);
+ public readonly int OuterPut => BitRange(30, 0);
+ public readonly bool OuterOverflow => Bit(31);
+ public readonly int OuterGet => BitRange(62, 32);
+ public readonly bool OuterStickyOverflow => Bit(63);
+ public readonly int InnerGet => BitRange(94, 64);
+ public readonly bool InnerOverflow => Bit(95);
+ public readonly int InnerPut => BitRange(126, 96);
+ public readonly bool InnerStickyOverflow => Bit(127);
+ public readonly int QmdReservedAA => BitRange(159, 128);
+ public readonly int DependentQmdPointer => BitRange(191, 160);
+ public readonly int QmdGroupId => BitRange(197, 192);
+ public readonly bool SmGlobalCachingEnable => Bit(198);
+ public readonly bool RunCtaInOneSmPartition => Bit(199);
+ public readonly bool IsQueue => Bit(200);
+ public readonly bool AddToHeadOfQmdGroupLinkedList => Bit(201);
+ public readonly bool SemaphoreReleaseEnable0 => Bit(202);
+ public readonly bool SemaphoreReleaseEnable1 => Bit(203);
+ public readonly bool RequireSchedulingPcas => Bit(204);
+ public readonly bool DependentQmdScheduleEnable => Bit(205);
+ public readonly DependentQmdType DependentQmdType => (DependentQmdType)BitRange(206, 206);
+ public readonly bool DependentQmdFieldCopy => Bit(207);
+ public readonly int QmdReservedB => BitRange(223, 208);
+ public readonly int CircularQueueSize => BitRange(248, 224);
+ public readonly bool QmdReservedC => Bit(249);
+ public readonly bool InvalidateTextureHeaderCache => Bit(250);
+ public readonly bool InvalidateTextureSamplerCache => Bit(251);
+ public readonly bool InvalidateTextureDataCache => Bit(252);
+ public readonly bool InvalidateShaderDataCache => Bit(253);
+ public readonly bool InvalidateInstructionCache => Bit(254);
+ public readonly bool InvalidateShaderConstantCache => Bit(255);
+ public readonly int ProgramOffset => BitRange(287, 256);
+ public readonly int CircularQueueAddrLower => BitRange(319, 288);
+ public readonly int CircularQueueAddrUpper => BitRange(327, 320);
+ public readonly int QmdReservedD => BitRange(335, 328);
+ public readonly int CircularQueueEntrySize => BitRange(351, 336);
+ public readonly int CwdReferenceCountId => BitRange(357, 352);
+ public readonly int CwdReferenceCountDeltaMinusOne => BitRange(365, 358);
+ public readonly ReleaseMembarType ReleaseMembarType => (ReleaseMembarType)BitRange(366, 366);
+ public readonly bool CwdReferenceCountIncrEnable => Bit(367);
+ public readonly CwdMembarType CwdMembarType => (CwdMembarType)BitRange(369, 368);
+ public readonly bool SequentiallyRunCtas => Bit(370);
+ public readonly bool CwdReferenceCountDecrEnable => Bit(371);
+ public readonly bool Throttled => Bit(372);
+ public readonly Fp32NanBehavior Fp32NanBehavior => (Fp32NanBehavior)BitRange(376, 376);
+ public readonly Fp32F2iNanBehavior Fp32F2iNanBehavior => (Fp32F2iNanBehavior)BitRange(377, 377);
+ public readonly ApiVisibleCallLimit ApiVisibleCallLimit => (ApiVisibleCallLimit)BitRange(378, 378);
+ public readonly SharedMemoryBankMapping SharedMemoryBankMapping => (SharedMemoryBankMapping)BitRange(379, 379);
+ public readonly SamplerIndex SamplerIndex => (SamplerIndex)BitRange(382, 382);
+ public readonly Fp32NarrowInstruction Fp32NarrowInstruction => (Fp32NarrowInstruction)BitRange(383, 383);
+ public readonly int CtaRasterWidth => BitRange(415, 384);
+ public readonly int CtaRasterHeight => BitRange(431, 416);
+ public readonly int CtaRasterDepth => BitRange(447, 432);
+ public readonly int CtaRasterWidthResume => BitRange(479, 448);
+ public readonly int CtaRasterHeightResume => BitRange(495, 480);
+ public readonly int CtaRasterDepthResume => BitRange(511, 496);
+ public readonly int QueueEntriesPerCtaMinusOne => BitRange(518, 512);
+ public readonly int CoalesceWaitingPeriod => BitRange(529, 522);
+ public readonly int SharedMemorySize => BitRange(561, 544);
+ public readonly int QmdReservedG => BitRange(575, 562);
+ public readonly int QmdVersion => BitRange(579, 576);
+ public readonly int QmdMajorVersion => BitRange(583, 580);
+ public readonly int QmdReservedH => BitRange(591, 584);
+ public readonly int CtaThreadDimension0 => BitRange(607, 592);
+ public readonly int CtaThreadDimension1 => BitRange(623, 608);
+ public readonly int CtaThreadDimension2 => BitRange(639, 624);
+ public readonly bool ConstantBufferValid(int i) => Bit(640 + i * 1);
+ public readonly int QmdReservedI => BitRange(668, 648);
+ public readonly L1Configuration L1Configuration => (L1Configuration)BitRange(671, 669);
+ public readonly int SmDisableMaskLower => BitRange(703, 672);
+ public readonly int SmDisableMaskUpper => BitRange(735, 704);
+ public readonly int Release0AddressLower => BitRange(767, 736);
+ public readonly int Release0AddressUpper => BitRange(775, 768);
+ public readonly int QmdReservedJ => BitRange(783, 776);
+ public readonly ReductionOp Release0ReductionOp => (ReductionOp)BitRange(790, 788);
+ public readonly bool QmdReservedK => Bit(791);
+ public readonly ReductionFormat Release0ReductionFormat => (ReductionFormat)BitRange(793, 792);
+ public readonly bool Release0ReductionEnable => Bit(794);
+ public readonly StructureSize Release0StructureSize => (StructureSize)BitRange(799, 799);
+ public readonly int Release0Payload => BitRange(831, 800);
+ public readonly int Release1AddressLower => BitRange(863, 832);
+ public readonly int Release1AddressUpper => BitRange(871, 864);
+ public readonly int QmdReservedL => BitRange(879, 872);
+ public readonly ReductionOp Release1ReductionOp => (ReductionOp)BitRange(886, 884);
+ public readonly bool QmdReservedM => Bit(887);
+ public readonly ReductionFormat Release1ReductionFormat => (ReductionFormat)BitRange(889, 888);
+ public readonly bool Release1ReductionEnable => Bit(890);
+ public readonly StructureSize Release1StructureSize => (StructureSize)BitRange(895, 895);
+ public readonly int Release1Payload => BitRange(927, 896);
+ public readonly int ConstantBufferAddrLower(int i) => BitRange(959 + i * 64, 928 + i * 64);
+ public readonly int ConstantBufferAddrUpper(int i) => BitRange(967 + i * 64, 960 + i * 64);
+ public readonly int ConstantBufferReservedAddr(int i) => BitRange(973 + i * 64, 968 + i * 64);
+ public readonly bool ConstantBufferInvalidate(int i) => Bit(974 + i * 64);
+ public readonly int ConstantBufferSize(int i) => BitRange(991 + i * 64, 975 + i * 64);
+ public readonly int ShaderLocalMemoryLowSize => BitRange(1463, 1440);
+ public readonly int QmdReservedN => BitRange(1466, 1464);
+ public readonly int BarrierCount => BitRange(1471, 1467);
+ public readonly int ShaderLocalMemoryHighSize => BitRange(1495, 1472);
+ public readonly int RegisterCount => BitRange(1503, 1496);
+ public readonly int ShaderLocalMemoryCrsSize => BitRange(1527, 1504);
+ public readonly int SassVersion => BitRange(1535, 1528);
+ public readonly int HwOnlyInnerGet => BitRange(1566, 1536);
+ public readonly bool HwOnlyRequireSchedulingPcas => Bit(1567);
+ public readonly int HwOnlyInnerPut => BitRange(1598, 1568);
+ public readonly bool HwOnlyScgType => Bit(1599);
+ public readonly int HwOnlySpanListHeadIndex => BitRange(1629, 1600);
+ public readonly bool QmdReservedQ => Bit(1630);
+ public readonly bool HwOnlySpanListHeadIndexValid => Bit(1631);
+ public readonly int HwOnlySkedNextQmdPointer => BitRange(1663, 1632);
+ public readonly int QmdSpareE => BitRange(1695, 1664);
+ public readonly int QmdSpareF => BitRange(1727, 1696);
+ public readonly int QmdSpareG => BitRange(1759, 1728);
+ public readonly int QmdSpareH => BitRange(1791, 1760);
+ public readonly int QmdSpareI => BitRange(1823, 1792);
+ public readonly int QmdSpareJ => BitRange(1855, 1824);
+ public readonly int QmdSpareK => BitRange(1887, 1856);
+ public readonly int QmdSpareL => BitRange(1919, 1888);
+ public readonly int QmdSpareM => BitRange(1951, 1920);
+ public readonly int QmdSpareN => BitRange(1983, 1952);
+ public readonly int DebugIdUpper => BitRange(2015, 1984);
+ public readonly int DebugIdLower => BitRange(2047, 2016);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private bool Bit(int bit)
+ private readonly bool Bit(int bit)
{
if ((uint)bit >= 64 * 32)
{
@@ -260,7 +260,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private int BitRange(int upper, int lower)
+ private readonly int BitRange(int upper, int lower)
{
if ((uint)lower >= 64 * 32)
{
@@ -272,4 +272,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
return (_words[lower >> 5] >> (lower & 31)) & mask;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/ConditionalRenderEnabled.cs b/src/Ryujinx.Graphics.Gpu/Engine/ConditionalRenderEnabled.cs
index 5581b5cc..52d7f69f 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/ConditionalRenderEnabled.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/ConditionalRenderEnabled.cs
@@ -7,6 +7,6 @@
{
False,
True,
- Host
+ Host,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
index fd93cd8b..e6557780 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
@@ -30,13 +30,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
SrcLinear = 1 << 7,
DstLinear = 1 << 8,
MultiLineEnable = 1 << 9,
- RemapEnable = 1 << 10
+ RemapEnable = 1 << 10,
}
/// <summary>
/// Texture parameters for copy.
/// </summary>
- private struct TextureParams
+ private readonly struct TextureParams
{
/// <summary>
/// Copy region X coordinate.
@@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
_3dEngine = threedEngine;
_state = new DeviceState<DmaClassState>(new Dictionary<string, RwCallback>
{
- { nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) }
+ { nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) },
});
}
@@ -345,8 +345,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
// all be rewritten to use pooled arrays, but that gets complicated with packed data and strides
Span<byte> dstSpan = memoryManager.GetSpan(dstGpuVa + (ulong)dstBaseOffset, dstSize).ToArray();
- TextureParams srcParams = new TextureParams(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
- TextureParams dstParams = new TextureParams(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
+ TextureParams srcParams = new(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
+ TextureParams dstParams = new(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
// If remapping is enabled, we always copy the components directly, in order.
// If it's enabled, but the mapping is just XYZW, we also copy them in order.
@@ -363,13 +363,26 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
switch (srcBpp)
{
- case 1: Copy<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 2: Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 4: Copy<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 8: Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 12: Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 16: Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams); break;
- default: throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
+ case 1:
+ Copy<byte>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 2:
+ Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 4:
+ Copy<uint>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 8:
+ Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 12:
+ Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 16:
+ Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ default:
+ throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
}
}
else
@@ -378,11 +391,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
switch (componentSize)
{
- case 1: CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 2: CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 3: CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams); break;
- case 4: CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
- default: throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
+ case 1:
+ CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 2:
+ CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 3:
+ CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ case 4:
+ CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams);
+ break;
+ default:
+ throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
}
}
@@ -526,28 +548,28 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
0 => _state.State.SetRemapComponentsDstX,
1 => _state.State.SetRemapComponentsDstY,
2 => _state.State.SetRemapComponentsDstZ,
- _ => _state.State.SetRemapComponentsDstW
+ _ => _state.State.SetRemapComponentsDstW,
};
switch (componentsDst)
{
case SetRemapComponentsDst.SrcX:
- Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan, dst, src);
+ Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan, dst, src);
break;
case SetRemapComponentsDst.SrcY:
- Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>()), dst, src);
+ Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[Unsafe.SizeOf<T>()..], dst, src);
break;
case SetRemapComponentsDst.SrcZ:
- Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 2), dst, src);
+ Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 2)..], dst, src);
break;
case SetRemapComponentsDst.SrcW:
- Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 3), dst, src);
+ Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 3)..], dst, src);
break;
case SetRemapComponentsDst.ConstA:
- Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
+ Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
break;
case SetRemapComponentsDst.ConstB:
- Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
+ Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
break;
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs
index 6f3b91f2..d8588736 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs
@@ -179,49 +179,49 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
/// </summary>
unsafe struct DmaClassState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public fixed uint Reserved00[64];
public uint Nop;
public fixed uint Reserved104[15];
public uint PmTrigger;
public fixed uint Reserved144[63];
public uint SetSemaphoreA;
- public int SetSemaphoreAUpper => (int)(SetSemaphoreA & 0xFF);
+ public readonly int SetSemaphoreAUpper => (int)(SetSemaphoreA & 0xFF);
public uint SetSemaphoreB;
public uint SetSemaphorePayload;
public fixed uint Reserved24C[2];
public uint SetRenderEnableA;
- public int SetRenderEnableAUpper => (int)(SetRenderEnableA & 0xFF);
+ public readonly int SetRenderEnableAUpper => (int)(SetRenderEnableA & 0xFF);
public uint SetRenderEnableB;
public uint SetRenderEnableC;
- public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
+ public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
public uint SetSrcPhysMode;
- public SetPhysModeTarget SetSrcPhysModeTarget => (SetPhysModeTarget)(SetSrcPhysMode & 0x3);
+ public readonly SetPhysModeTarget SetSrcPhysModeTarget => (SetPhysModeTarget)(SetSrcPhysMode & 0x3);
public uint SetDstPhysMode;
- public SetPhysModeTarget SetDstPhysModeTarget => (SetPhysModeTarget)(SetDstPhysMode & 0x3);
+ public readonly SetPhysModeTarget SetDstPhysModeTarget => (SetPhysModeTarget)(SetDstPhysMode & 0x3);
public fixed uint Reserved268[38];
public uint LaunchDma;
- public LaunchDmaDataTransferType LaunchDmaDataTransferType => (LaunchDmaDataTransferType)(LaunchDma & 0x3);
- public bool LaunchDmaFlushEnable => (LaunchDma & 0x4) != 0;
- public LaunchDmaSemaphoreType LaunchDmaSemaphoreType => (LaunchDmaSemaphoreType)((LaunchDma >> 3) & 0x3);
- public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 5) & 0x3);
- public LaunchDmaMemoryLayout LaunchDmaSrcMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 7) & 0x1);
- public LaunchDmaMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 8) & 0x1);
- public bool LaunchDmaMultiLineEnable => (LaunchDma & 0x200) != 0;
- public bool LaunchDmaRemapEnable => (LaunchDma & 0x400) != 0;
- public bool LaunchDmaForceRmwdisable => (LaunchDma & 0x800) != 0;
- public LaunchDmaType LaunchDmaSrcType => (LaunchDmaType)((LaunchDma >> 12) & 0x1);
- public LaunchDmaType LaunchDmaDstType => (LaunchDmaType)((LaunchDma >> 13) & 0x1);
- public LaunchDmaSemaphoreReduction LaunchDmaSemaphoreReduction => (LaunchDmaSemaphoreReduction)((LaunchDma >> 14) & 0xF);
- public LaunchDmaSemaphoreReductionSign LaunchDmaSemaphoreReductionSign => (LaunchDmaSemaphoreReductionSign)((LaunchDma >> 18) & 0x1);
- public bool LaunchDmaSemaphoreReductionEnable => (LaunchDma & 0x80000) != 0;
- public LaunchDmaBypassL2 LaunchDmaBypassL2 => (LaunchDmaBypassL2)((LaunchDma >> 20) & 0x1);
+ public readonly LaunchDmaDataTransferType LaunchDmaDataTransferType => (LaunchDmaDataTransferType)(LaunchDma & 0x3);
+ public readonly bool LaunchDmaFlushEnable => (LaunchDma & 0x4) != 0;
+ public readonly LaunchDmaSemaphoreType LaunchDmaSemaphoreType => (LaunchDmaSemaphoreType)((LaunchDma >> 3) & 0x3);
+ public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 5) & 0x3);
+ public readonly LaunchDmaMemoryLayout LaunchDmaSrcMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 7) & 0x1);
+ public readonly LaunchDmaMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 8) & 0x1);
+ public readonly bool LaunchDmaMultiLineEnable => (LaunchDma & 0x200) != 0;
+ public readonly bool LaunchDmaRemapEnable => (LaunchDma & 0x400) != 0;
+ public readonly bool LaunchDmaForceRmwdisable => (LaunchDma & 0x800) != 0;
+ public readonly LaunchDmaType LaunchDmaSrcType => (LaunchDmaType)((LaunchDma >> 12) & 0x1);
+ public readonly LaunchDmaType LaunchDmaDstType => (LaunchDmaType)((LaunchDma >> 13) & 0x1);
+ public readonly LaunchDmaSemaphoreReduction LaunchDmaSemaphoreReduction => (LaunchDmaSemaphoreReduction)((LaunchDma >> 14) & 0xF);
+ public readonly LaunchDmaSemaphoreReductionSign LaunchDmaSemaphoreReductionSign => (LaunchDmaSemaphoreReductionSign)((LaunchDma >> 18) & 0x1);
+ public readonly bool LaunchDmaSemaphoreReductionEnable => (LaunchDma & 0x80000) != 0;
+ public readonly LaunchDmaBypassL2 LaunchDmaBypassL2 => (LaunchDmaBypassL2)((LaunchDma >> 20) & 0x1);
public fixed uint Reserved304[63];
public uint OffsetInUpper;
- public int OffsetInUpperUpper => (int)(OffsetInUpper & 0xFF);
+ public readonly int OffsetInUpperUpper => (int)(OffsetInUpper & 0xFF);
public uint OffsetInLower;
public uint OffsetOutUpper;
- public int OffsetOutUpperUpper => (int)(OffsetOutUpper & 0xFF);
+ public readonly int OffsetOutUpperUpper => (int)(OffsetOutUpper & 0xFF);
public uint OffsetOutLower;
public uint PitchIn;
public uint PitchOut;
@@ -231,38 +231,38 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
public uint SetRemapConstA;
public uint SetRemapConstB;
public uint SetRemapComponents;
- public SetRemapComponentsDst SetRemapComponentsDstX => (SetRemapComponentsDst)(SetRemapComponents & 0x7);
- public SetRemapComponentsDst SetRemapComponentsDstY => (SetRemapComponentsDst)((SetRemapComponents >> 4) & 0x7);
- public SetRemapComponentsDst SetRemapComponentsDstZ => (SetRemapComponentsDst)((SetRemapComponents >> 8) & 0x7);
- public SetRemapComponentsDst SetRemapComponentsDstW => (SetRemapComponentsDst)((SetRemapComponents >> 12) & 0x7);
- public SetRemapComponentsComponentSize SetRemapComponentsComponentSize => (SetRemapComponentsComponentSize)((SetRemapComponents >> 16) & 0x3);
- public SetRemapComponentsNumComponents SetRemapComponentsNumSrcComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 20) & 0x3);
- public SetRemapComponentsNumComponents SetRemapComponentsNumDstComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 24) & 0x3);
+ public readonly SetRemapComponentsDst SetRemapComponentsDstX => (SetRemapComponentsDst)(SetRemapComponents & 0x7);
+ public readonly SetRemapComponentsDst SetRemapComponentsDstY => (SetRemapComponentsDst)((SetRemapComponents >> 4) & 0x7);
+ public readonly SetRemapComponentsDst SetRemapComponentsDstZ => (SetRemapComponentsDst)((SetRemapComponents >> 8) & 0x7);
+ public readonly SetRemapComponentsDst SetRemapComponentsDstW => (SetRemapComponentsDst)((SetRemapComponents >> 12) & 0x7);
+ public readonly SetRemapComponentsComponentSize SetRemapComponentsComponentSize => (SetRemapComponentsComponentSize)((SetRemapComponents >> 16) & 0x3);
+ public readonly SetRemapComponentsNumComponents SetRemapComponentsNumSrcComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 20) & 0x3);
+ public readonly SetRemapComponentsNumComponents SetRemapComponentsNumDstComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 24) & 0x3);
public uint SetDstBlockSize;
- public SetBlockSizeWidth SetDstBlockSizeWidth => (SetBlockSizeWidth)(SetDstBlockSize & 0xF);
- public SetBlockSizeHeight SetDstBlockSizeHeight => (SetBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
- public SetBlockSizeDepth SetDstBlockSizeDepth => (SetBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
- public SetBlockSizeGobHeight SetDstBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetDstBlockSize >> 12) & 0xF);
+ public readonly SetBlockSizeWidth SetDstBlockSizeWidth => (SetBlockSizeWidth)(SetDstBlockSize & 0xF);
+ public readonly SetBlockSizeHeight SetDstBlockSizeHeight => (SetBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
+ public readonly SetBlockSizeDepth SetDstBlockSizeDepth => (SetBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
+ public readonly SetBlockSizeGobHeight SetDstBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetDstBlockSize >> 12) & 0xF);
public uint SetDstWidth;
public uint SetDstHeight;
public uint SetDstDepth;
public uint SetDstLayer;
public uint SetDstOrigin;
- public int SetDstOriginX => (int)(SetDstOrigin & 0xFFFF);
- public int SetDstOriginY => (int)((SetDstOrigin >> 16) & 0xFFFF);
+ public readonly int SetDstOriginX => (int)(SetDstOrigin & 0xFFFF);
+ public readonly int SetDstOriginY => (int)((SetDstOrigin >> 16) & 0xFFFF);
public uint Reserved724;
public uint SetSrcBlockSize;
- public SetBlockSizeWidth SetSrcBlockSizeWidth => (SetBlockSizeWidth)(SetSrcBlockSize & 0xF);
- public SetBlockSizeHeight SetSrcBlockSizeHeight => (SetBlockSizeHeight)((SetSrcBlockSize >> 4) & 0xF);
- public SetBlockSizeDepth SetSrcBlockSizeDepth => (SetBlockSizeDepth)((SetSrcBlockSize >> 8) & 0xF);
- public SetBlockSizeGobHeight SetSrcBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetSrcBlockSize >> 12) & 0xF);
+ public readonly SetBlockSizeWidth SetSrcBlockSizeWidth => (SetBlockSizeWidth)(SetSrcBlockSize & 0xF);
+ public readonly SetBlockSizeHeight SetSrcBlockSizeHeight => (SetBlockSizeHeight)((SetSrcBlockSize >> 4) & 0xF);
+ public readonly SetBlockSizeDepth SetSrcBlockSizeDepth => (SetBlockSizeDepth)((SetSrcBlockSize >> 8) & 0xF);
+ public readonly SetBlockSizeGobHeight SetSrcBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetSrcBlockSize >> 12) & 0xF);
public uint SetSrcWidth;
public uint SetSrcHeight;
public uint SetSrcDepth;
public uint SetSrcLayer;
public uint SetSrcOrigin;
- public int SetSrcOriginX => (int)(SetSrcOrigin & 0xFFFF);
- public int SetSrcOriginY => (int)((SetSrcOrigin >> 16) & 0xFFFF);
+ public readonly int SetSrcOriginX => (int)(SetSrcOrigin & 0xFFFF);
+ public readonly int SetSrcOriginY => (int)((SetSrcOrigin >> 16) & 0xFFFF);
public fixed uint Reserved740[629];
public uint PmTriggerEnd;
public fixed uint Reserved1118[2490];
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs
index 6873ff40..8193c4a2 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs
@@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
/// </summary>
struct DmaTexture
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public MemoryLayout MemoryLayout;
public int Width;
public int Height;
@@ -17,4 +17,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
public ushort RegionY;
#pragma warning restore CS0649
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs
index d082ee9d..afa4db5e 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs
@@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Grp0SetSubDevMask = 1,
Grp0StoreSubDevMask = 2,
Grp0UseSubDevMask = 3,
- Grp2NonIncMethod = 0
+ Grp2NonIncMethod = Grp0IncMethod,
}
enum SecOp
@@ -20,22 +20,22 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
ImmdDataMethod = 4,
OneInc = 5,
Reserved6 = 6,
- EndPbSegment = 7
+ EndPbSegment = 7,
}
struct CompressedMethod
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Method;
#pragma warning restore CS0649
- public int MethodAddressOld => (int)((Method >> 2) & 0x7FF);
- public int MethodAddress => (int)(Method & 0xFFF);
- public int SubdeviceMask => (int)((Method >> 4) & 0xFFF);
- public int MethodSubchannel => (int)((Method >> 13) & 0x7);
- public TertOp TertOp => (TertOp)((Method >> 16) & 0x3);
- public int MethodCountOld => (int)((Method >> 18) & 0x7FF);
- public int MethodCount => (int)((Method >> 16) & 0x1FFF);
- public int ImmdData => (int)((Method >> 16) & 0x1FFF);
- public SecOp SecOp => (SecOp)((Method >> 29) & 0x7);
+ public readonly int MethodAddressOld => (int)((Method >> 2) & 0x7FF);
+ public readonly int MethodAddress => (int)(Method & 0xFFF);
+ public readonly int SubdeviceMask => (int)((Method >> 4) & 0xFFF);
+ public readonly int MethodSubchannel => (int)((Method >> 13) & 0x7);
+ public readonly TertOp TertOp => (TertOp)((Method >> 16) & 0x3);
+ public readonly int MethodCountOld => (int)((Method >> 18) & 0x7FF);
+ public readonly int MethodCount => (int)((Method >> 16) & 0x1FFF);
+ public readonly int ImmdData => (int)((Method >> 16) & 0x1FFF);
+ public readonly SecOp SecOp => (SecOp)((Method >> 29) & 0x7);
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs
index 31ba3217..81e28acf 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs
@@ -36,20 +36,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
struct GPEntry
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Entry0;
#pragma warning restore CS0649
- public Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1);
- public int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF);
- public int Entry0Operand => (int)(Entry0);
-#pragma warning disable CS0649
+ public readonly Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1);
+ public readonly int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF);
+ public readonly int Entry0Operand => (int)(Entry0);
+#pragma warning disable CS0649 // Field is never assigned to
public uint Entry1;
#pragma warning restore CS0649
- public int Entry1GetHi => (int)(Entry1 & 0xFF);
- public Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1);
- public Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1);
- public int Entry1Length => (int)((Entry1 >> 10) & 0x1FFFFF);
- public Entry1Sync Entry1Sync => (Entry1Sync)((Entry1 >> 31) & 0x1);
- public Entry1Opcode Entry1Opcode => (Entry1Opcode)(Entry1 & 0xFF);
+ public readonly int Entry1GetHi => (int)(Entry1 & 0xFF);
+ public readonly Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1);
+ public readonly Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1);
+ public readonly int Entry1Length => (int)((Entry1 >> 10) & 0x1FFFFF);
+ public readonly Entry1Sync Entry1Sync => (Entry1Sync)((Entry1 >> 31) & 0x1);
+ public readonly Entry1Opcode Entry1Opcode => (Entry1Opcode)(Entry1 & 0xFF);
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs
index 7a11c649..4bdbd1a0 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs
@@ -16,7 +16,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
private readonly GPFifoProcessor _parent;
private readonly DeviceState<GPFifoClassState> _state;
- private int _previousSubChannel;
private bool _createSyncPending;
private const int MacrosCount = 0x80;
@@ -45,7 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
{ nameof(GPFifoClassState.SetReference), new RwCallback(SetReference, null) },
{ nameof(GPFifoClassState.LoadMmeInstructionRam), new RwCallback(LoadMmeInstructionRam, null) },
{ nameof(GPFifoClassState.LoadMmeStartAddressRam), new RwCallback(LoadMmeStartAddressRam, null) },
- { nameof(GPFifoClassState.SetMmeShadowRamControl), new RwCallback(SetMmeShadowRamControl, null) }
+ { nameof(GPFifoClassState.SetMmeShadowRamControl), new RwCallback(SetMmeShadowRamControl, null) },
});
_macros = new Macro[MacrosCount];
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs
index ebfe1566..dd6ae1b4 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs
@@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Release = 2,
AcqGeq = 4,
AcqAnd = 8,
- Reduction = 16
+ Reduction = 16,
}
/// <summary>
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SemaphoredAcquireSwitch
{
Disabled = 0,
- Enabled = 1
+ Enabled = 1,
}
/// <summary>
@@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SemaphoredReleaseWfi
{
En = 0,
- Dis = 1
+ Dis = 1,
}
/// <summary>
@@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SemaphoredReleaseSize
{
SixteenBytes = 0,
- FourBytes = 1
+ FourBytes = 1,
}
/// <summary>
@@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Or = 4,
Add = 5,
Inc = 6,
- Dec = 7
+ Dec = 7,
}
/// <summary>
@@ -64,7 +64,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SemaphoredFormat
{
Signed = 0,
- Unsigned = 1
+ Unsigned = 1,
}
/// <summary>
@@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum MemOpCTlbInvalidatePdb
{
One = 0,
- All = 1
+ All = 1,
}
/// <summary>
@@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum MemOpCTlbInvalidateGpc
{
Enable = 0,
- Disable = 1
+ Disable = 1,
}
/// <summary>
@@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
{
VidMem = 0,
SysMemCoherent = 2,
- SysMemNoncoherent = 3
+ SysMemNoncoherent = 3,
}
/// <summary>
@@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
L2PeermemInvalidate = 13,
L2SysmemInvalidate = 14,
L2CleanComptags = 15,
- L2FlushDirty = 16
+ L2FlushDirty = 16,
}
/// <summary>
@@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SyncpointbOperation
{
Wait = 0,
- Incr = 1
+ Incr = 1,
}
/// <summary>
@@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum SyncpointbWaitSwitch
{
Dis = 0,
- En = 1
+ En = 1,
}
/// <summary>
@@ -132,7 +132,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
enum WfiScope
{
CurrentScgType = 0,
- All = 1
+ All = 1,
}
/// <summary>
@@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Nop = 0,
PbdmaTimeslice = 1,
RunlistTimeslice = 2,
- Tsg = 3
+ Tsg = 3,
}
/// <summary>
@@ -151,44 +151,44 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
/// </summary>
struct GPFifoClassState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetObject;
- public int SetObjectNvclass => (int)(SetObject & 0xFFFF);
- public int SetObjectEngine => (int)((SetObject >> 16) & 0x1F);
+ public readonly int SetObjectNvclass => (int)(SetObject & 0xFFFF);
+ public readonly int SetObjectEngine => (int)((SetObject >> 16) & 0x1F);
public uint Illegal;
- public int IllegalHandle => (int)(Illegal);
+ public readonly int IllegalHandle => (int)(Illegal);
public uint Nop;
- public int NopHandle => (int)(Nop);
+ public readonly int NopHandle => (int)(Nop);
public uint Reserved0C;
public uint Semaphorea;
- public int SemaphoreaOffsetUpper => (int)(Semaphorea & 0xFF);
+ public readonly int SemaphoreaOffsetUpper => (int)(Semaphorea & 0xFF);
public uint Semaphoreb;
- public int SemaphorebOffsetLower => (int)((Semaphoreb >> 2) & 0x3FFFFFFF);
+ public readonly int SemaphorebOffsetLower => (int)((Semaphoreb >> 2) & 0x3FFFFFFF);
public uint Semaphorec;
- public int SemaphorecPayload => (int)(Semaphorec);
+ public readonly int SemaphorecPayload => (int)(Semaphorec);
public uint Semaphored;
- public SemaphoredOperation SemaphoredOperation => (SemaphoredOperation)(Semaphored & 0x1F);
- public SemaphoredAcquireSwitch SemaphoredAcquireSwitch => (SemaphoredAcquireSwitch)((Semaphored >> 12) & 0x1);
- public SemaphoredReleaseWfi SemaphoredReleaseWfi => (SemaphoredReleaseWfi)((Semaphored >> 20) & 0x1);
- public SemaphoredReleaseSize SemaphoredReleaseSize => (SemaphoredReleaseSize)((Semaphored >> 24) & 0x1);
- public SemaphoredReduction SemaphoredReduction => (SemaphoredReduction)((Semaphored >> 27) & 0xF);
- public SemaphoredFormat SemaphoredFormat => (SemaphoredFormat)((Semaphored >> 31) & 0x1);
+ public readonly SemaphoredOperation SemaphoredOperation => (SemaphoredOperation)(Semaphored & 0x1F);
+ public readonly SemaphoredAcquireSwitch SemaphoredAcquireSwitch => (SemaphoredAcquireSwitch)((Semaphored >> 12) & 0x1);
+ public readonly SemaphoredReleaseWfi SemaphoredReleaseWfi => (SemaphoredReleaseWfi)((Semaphored >> 20) & 0x1);
+ public readonly SemaphoredReleaseSize SemaphoredReleaseSize => (SemaphoredReleaseSize)((Semaphored >> 24) & 0x1);
+ public readonly SemaphoredReduction SemaphoredReduction => (SemaphoredReduction)((Semaphored >> 27) & 0xF);
+ public readonly SemaphoredFormat SemaphoredFormat => (SemaphoredFormat)((Semaphored >> 31) & 0x1);
public uint NonStallInterrupt;
- public int NonStallInterruptHandle => (int)(NonStallInterrupt);
+ public readonly int NonStallInterruptHandle => (int)(NonStallInterrupt);
public uint FbFlush;
- public int FbFlushHandle => (int)(FbFlush);
+ public readonly int FbFlushHandle => (int)(FbFlush);
public uint Reserved28;
public uint Reserved2C;
public uint MemOpC;
- public int MemOpCOperandLow => (int)((MemOpC >> 2) & 0x3FFFFFFF);
- public MemOpCTlbInvalidatePdb MemOpCTlbInvalidatePdb => (MemOpCTlbInvalidatePdb)(MemOpC & 0x1);
- public MemOpCTlbInvalidateGpc MemOpCTlbInvalidateGpc => (MemOpCTlbInvalidateGpc)((MemOpC >> 1) & 0x1);
- public MemOpCTlbInvalidateTarget MemOpCTlbInvalidateTarget => (MemOpCTlbInvalidateTarget)((MemOpC >> 10) & 0x3);
- public int MemOpCTlbInvalidateAddrLo => (int)((MemOpC >> 12) & 0xFFFFF);
+ public readonly int MemOpCOperandLow => (int)((MemOpC >> 2) & 0x3FFFFFFF);
+ public readonly MemOpCTlbInvalidatePdb MemOpCTlbInvalidatePdb => (MemOpCTlbInvalidatePdb)(MemOpC & 0x1);
+ public readonly MemOpCTlbInvalidateGpc MemOpCTlbInvalidateGpc => (MemOpCTlbInvalidateGpc)((MemOpC >> 1) & 0x1);
+ public readonly MemOpCTlbInvalidateTarget MemOpCTlbInvalidateTarget => (MemOpCTlbInvalidateTarget)((MemOpC >> 10) & 0x3);
+ public readonly int MemOpCTlbInvalidateAddrLo => (int)((MemOpC >> 12) & 0xFFFFF);
public uint MemOpD;
- public int MemOpDOperandHigh => (int)(MemOpD & 0xFF);
- public MemOpDOperation MemOpDOperation => (MemOpDOperation)((MemOpD >> 27) & 0x1F);
- public int MemOpDTlbInvalidateAddrHi => (int)(MemOpD & 0xFF);
+ public readonly int MemOpDOperandHigh => (int)(MemOpD & 0xFF);
+ public readonly MemOpDOperation MemOpDOperation => (MemOpDOperation)((MemOpD >> 27) & 0x1F);
+ public readonly int MemOpDTlbInvalidateAddrHi => (int)(MemOpD & 0xFF);
public uint Reserved38;
public uint Reserved3C;
public uint Reserved40;
@@ -196,7 +196,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
public uint Reserved48;
public uint Reserved4C;
public uint SetReference;
- public int SetReferenceCount => (int)(SetReference);
+ public readonly int SetReferenceCount => (int)(SetReference);
public uint Reserved54;
public uint Reserved58;
public uint Reserved5C;
@@ -205,17 +205,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
public uint Reserved68;
public uint Reserved6C;
public uint Syncpointa;
- public int SyncpointaPayload => (int)(Syncpointa);
+ public readonly int SyncpointaPayload => (int)(Syncpointa);
public uint Syncpointb;
- public SyncpointbOperation SyncpointbOperation => (SyncpointbOperation)(Syncpointb & 0x1);
- public SyncpointbWaitSwitch SyncpointbWaitSwitch => (SyncpointbWaitSwitch)((Syncpointb >> 4) & 0x1);
- public int SyncpointbSyncptIndex => (int)((Syncpointb >> 8) & 0xFFF);
+ public readonly SyncpointbOperation SyncpointbOperation => (SyncpointbOperation)(Syncpointb & 0x1);
+ public readonly SyncpointbWaitSwitch SyncpointbWaitSwitch => (SyncpointbWaitSwitch)((Syncpointb >> 4) & 0x1);
+ public readonly int SyncpointbSyncptIndex => (int)((Syncpointb >> 8) & 0xFFF);
public uint Wfi;
- public WfiScope WfiScope => (WfiScope)(Wfi & 0x1);
+ public readonly WfiScope WfiScope => (WfiScope)(Wfi & 0x1);
public uint CrcCheck;
- public int CrcCheckValue => (int)(CrcCheck);
+ public readonly int CrcCheckValue => (int)(CrcCheck);
public uint Yield;
- public YieldOp YieldOp => (YieldOp)(Yield & 0x3);
+ public readonly YieldOp YieldOp => (YieldOp)(Yield & 0x3);
// TODO: Eventually move this to per-engine state.
public Array31<uint> Reserved84;
public uint NoOperation;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoDevice.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoDevice.cs
index 09bcdec1..bb5bc21c 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoDevice.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoDevice.cs
@@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
private enum CommandBufferType
{
Prefetch,
- NoPrefetch
+ NoPrefetch,
}
/// <summary>
@@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
/// <param name="memoryManager">The memory manager used to fetch the data</param>
/// <param name="flush">If true, flushes potential GPU written data before reading the command buffer</param>
/// <returns>The fetched data</returns>
- private ReadOnlySpan<int> GetWords(MemoryManager memoryManager, bool flush)
+ private readonly ReadOnlySpan<int> GetWords(MemoryManager memoryManager, bool flush)
{
return MemoryMarshal.Cast<byte, int>(memoryManager.GetSpan(EntryAddress, (int)EntryCount * 4, flush));
}
@@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
/// <param name="memoryManager">The memory manager used to fetch the data</param>
/// <param name="flush">If true, flushes potential GPU written data before reading the command buffer</param>
/// <returns>The command buffer words</returns>
- public ReadOnlySpan<int> Fetch(MemoryManager memoryManager, bool flush)
+ public readonly ReadOnlySpan<int> Fetch(MemoryManager memoryManager, bool flush)
{
return Words ?? GetWords(memoryManager, flush);
}
@@ -85,7 +85,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
private readonly ConcurrentQueue<CommandBuffer> _commandBufferQueue;
- private CommandBuffer _currentCommandBuffer;
private GPFifoProcessor _prevChannelProcessor;
private readonly bool _ibEnable;
@@ -129,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Type = CommandBufferType.Prefetch,
Words = commandBuffer,
EntryAddress = ulong.MaxValue,
- EntryCount = (uint)commandBuffer.Length
+ EntryCount = (uint)commandBuffer.Length,
});
}
@@ -156,7 +155,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
Type = type,
Words = null,
EntryAddress = startAddress,
- EntryCount = (uint)entry.Entry1Length
+ EntryCount = (uint)entry.Entry1Length,
};
}
@@ -217,7 +216,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
flushCommandBuffer = false;
}
- _currentCommandBuffer = entry;
ReadOnlySpan<int> words = entry.Fetch(entry.Processor.MemoryManager, flushCommandBuffer);
// If we are changing the current channel,
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
index 3fb3feee..6ba1bc22 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
@@ -243,7 +243,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
{
0 => _3dClass,
3 => _2dClass,
- _ => null
+ _ => null,
};
if (state != null)
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
index e1d7e940..e417b9a0 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
@@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
_state = new DeviceState<InlineToMemoryClassState>(new Dictionary<string, RwCallback>
{
{ nameof(InlineToMemoryClassState.LaunchDma), new RwCallback(LaunchDma, null) },
- { nameof(InlineToMemoryClassState.LoadInlineData), new RwCallback(LoadInlineData, null) }
+ { nameof(InlineToMemoryClassState.LoadInlineData), new RwCallback(LoadInlineData, null) },
});
}
}
@@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
if (!_finished)
{
int copySize = Math.Min(data.Length, _buffer.Length - _offset);
- data.Slice(0, copySize).CopyTo(new Span<int>(_buffer).Slice(_offset, copySize));
+ data[..copySize].CopyTo(new Span<int>(_buffer).Slice(_offset, copySize));
_offset += copySize;
@@ -169,11 +169,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
{
var memoryManager = _channel.MemoryManager;
- var data = MemoryMarshal.Cast<int, byte>(_buffer).Slice(0, _size);
+ var data = MemoryMarshal.Cast<int, byte>(_buffer)[.._size];
if (_isLinear && _lineCount == 1)
{
- memoryManager.WriteTrackedResource(_dstGpuVa, data.Slice(0, _lineLengthIn));
+ memoryManager.WriteTrackedResource(_dstGpuVa, data[.._lineLengthIn]);
_context.AdvanceSequence();
}
else
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs
index f6d9602a..ec5042fd 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs
@@ -1,5 +1,7 @@
// This file was auto-generated from NVIDIA official Maxwell definitions.
+using Ryujinx.Common.Memory;
+
namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
{
/// <summary>
@@ -111,24 +113,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
/// </summary>
unsafe struct InlineToMemoryClassState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetObject;
- public int SetObjectClassId => (int)(SetObject & 0xFFFF);
- public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
+ public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
+ public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
public fixed uint Reserved04[63];
public uint NoOperation;
public uint SetNotifyA;
- public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
+ public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
public uint SetNotifyB;
public uint Notify;
- public NotifyType NotifyType => (NotifyType)(Notify);
+ public readonly NotifyType NotifyType => (NotifyType)(Notify);
public uint WaitForIdle;
public fixed uint Reserved114[7];
public uint SetGlobalRenderEnableA;
- public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
+ public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
public uint SetGlobalRenderEnableB;
public uint SetGlobalRenderEnableC;
- public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
+ public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
public uint SendGoIdle;
public uint PmTrigger;
public uint PmTriggerWfi;
@@ -139,34 +141,34 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
public uint LineLengthIn;
public uint LineCount;
public uint OffsetOutUpper;
- public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
+ public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
public uint OffsetOut;
public uint PitchOut;
public uint SetDstBlockSize;
- public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
- public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
- public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
+ public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
+ public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
+ public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
public uint SetDstWidth;
public uint SetDstHeight;
public uint SetDstDepth;
public uint SetDstLayer;
public uint SetDstOriginBytesX;
- public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
+ public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
public uint SetDstOriginSamplesY;
- public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
+ public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
public uint LaunchDma;
- public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
- public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
- public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
- public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
- public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
- public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
- public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
- public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
+ public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
+ public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
+ public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
+ public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
+ public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
+ public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
+ public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
+ public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
public uint LoadInlineData;
public fixed uint Reserved1B8[9];
public uint SetI2mSemaphoreA;
- public int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
+ public readonly int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
public uint SetI2mSemaphoreB;
public uint SetI2mSemaphoreC;
public fixed uint Reserved1E8[2];
@@ -175,7 +177,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
public uint SetI2mSpareNoop02;
public uint SetI2mSpareNoop03;
public fixed uint Reserved200[3200];
- public MmeShadowScratch SetMmeShadowScratch;
+ public Array256<uint> SetMmeShadowScratch;
#pragma warning restore CS0649
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/AluOperation.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/AluOperation.cs
index eeef9c67..43faa788 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/AluOperation.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/AluOperation.cs
@@ -10,6 +10,6 @@
BitfieldReplace = 2,
BitfieldExtractLslImm = 3,
BitfieldExtractLslReg = 4,
- ReadImmediate = 5
+ ReadImmediate = 5,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/AluRegOperation.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/AluRegOperation.cs
index f3e05d38..c878bd41 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/AluRegOperation.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/AluRegOperation.cs
@@ -13,6 +13,6 @@
BitwiseOr = 9,
BitwiseAnd = 10,
BitwiseAndNot = 11,
- BitwiseNotAnd = 12
+ BitwiseNotAnd = 12,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/AssignmentOperation.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/AssignmentOperation.cs
index dc336026..592aa5a6 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/AssignmentOperation.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/AssignmentOperation.cs
@@ -12,6 +12,6 @@
MoveAndSend = 4,
FetchAndSetMaddr = 5,
MoveAndSetMaddrThenFetchAndSend = 6,
- MoveAndSetMaddrThenSendHigh = 7
+ MoveAndSetMaddrThenSendHigh = 7,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs
index 12a3ac02..65c6aab4 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs
@@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
if (_executionEngine == null)
{
- if (GraphicsConfig.EnableMacroHLE && MacroHLETable.TryGetMacroHLEFunction(code.Slice(Position), context.Capabilities, out _hleFunction))
+ if (GraphicsConfig.EnableMacroHLE && MacroHLETable.TryGetMacroHLEFunction(code[Position..], context.Capabilities, out _hleFunction))
{
_executionEngine = new MacroHLE(processor, _hleFunction);
}
@@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
if (_executionPending)
{
_executionPending = false;
- _executionEngine?.Execute(code.Slice(Position), state, _argument);
+ _executionEngine?.Execute(code[Position..], state, _argument);
}
}
@@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// </summary>
/// <param name="gpuVa">GPU virtual address where the command word is located</param>
/// <param name="argument">Argument to be pushed</param>
- public void PushArgument(ulong gpuVa, int argument)
+ public readonly void PushArgument(ulong gpuVa, int argument)
{
_executionEngine?.Fifo.Enqueue(new FifoWord(gpuVa, argument));
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
index 8630bbc4..a4c4dd10 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
@@ -16,7 +16,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
private const int ColorStructSize = 0x40;
private const int ZetaLayerCountOffset = 0x1230;
- private const int IndirectDataEntrySize = 0x10;
private const int IndirectIndexedDataEntrySize = 0x14;
private readonly GPFifoProcessor _processor;
@@ -262,10 +261,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
for (int i = 0; i < maxDrawCount; i++)
{
var count = FetchParam();
+#pragma warning disable IDE0059 // Remove unnecessary value assignment
var instanceCount = FetchParam();
var firstIndex = FetchParam();
var firstVertex = FetchParam();
var firstInstance = FetchParam();
+#pragma warning restore IDE0059
if (i == 0)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLEFunctionName.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLEFunctionName.cs
index 751867fc..9e71761b 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLEFunctionName.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLEFunctionName.cs
@@ -11,6 +11,6 @@
DrawArraysInstanced,
DrawElementsInstanced,
DrawElementsIndirect,
- MultiDrawElementsIndirectCount
+ MultiDrawElementsIndirectCount,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
index 719e170f..5630756c 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
@@ -46,12 +46,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
private static readonly TableEntry[] _table = new TableEntry[]
{
- new TableEntry(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
- new TableEntry(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
- new TableEntry(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
- new TableEntry(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
- new TableEntry(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
- new TableEntry(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C)
+ new(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
+ new(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
+ new(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
+ new(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
+ new(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
+ new(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C),
};
/// <summary>
@@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
{
ref var entry = ref _table[i];
- var hash = XXHash128.ComputeHash(mc.Slice(0, entry.Length));
+ var hash = XXHash128.ComputeHash(mc[..entry.Length]);
if (hash == entry.Hash)
{
if (IsMacroHLESupported(caps, entry.Name))
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
index df6ee040..dd60688d 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
@@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// </summary>
public Queue<FifoWord> Fifo { get; }
- private int[] _gprs;
+ private readonly int[] _gprs;
private int _methAddr;
private int _methIncr;
@@ -291,11 +291,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
return (int)result;
- case AluRegOperation.BitwiseExclusiveOr: return a ^ b;
- case AluRegOperation.BitwiseOr: return a | b;
- case AluRegOperation.BitwiseAnd: return a & b;
- case AluRegOperation.BitwiseAndNot: return a & ~b;
- case AluRegOperation.BitwiseNotAnd: return ~(a & b);
+ case AluRegOperation.BitwiseExclusiveOr:
+ return a ^ b;
+ case AluRegOperation.BitwiseOr:
+ return a | b;
+ case AluRegOperation.BitwiseAnd:
+ return a & b;
+ case AluRegOperation.BitwiseAndNot:
+ return a & ~b;
+ case AluRegOperation.BitwiseNotAnd:
+ return ~(a & b);
}
throw new InvalidOperationException($"Invalid operation \"{aluOp}\" on instruction 0x{_opCode:X8}.");
@@ -380,7 +385,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// <param name="state">Current GPU state</param>
/// <param name="reg">Register offset to read</param>
/// <returns>GPU register value</returns>
- private int Read(IDeviceState state, int reg)
+ private static int Read(IDeviceState state, int reg)
{
return state.Read(reg * 4);
}
@@ -397,4 +402,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
_methAddr += _methIncr;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs
index 4077f74e..a23bfef1 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs
@@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// </summary>
class MacroJit : IMacroEE
{
- private readonly MacroJitContext _context = new MacroJitContext();
+ private readonly MacroJitContext _context = new();
/// <summary>
/// Arguments FIFO.
@@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
{
if (_execute == null)
{
- MacroJitCompiler compiler = new MacroJitCompiler();
+ MacroJitCompiler compiler = new();
_execute = compiler.Compile(code);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs
index f8d839fa..d9c26c58 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs
@@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// <returns>Delegate of the host compiled code</returns>
public MacroExecute Compile(ReadOnlySpan<int> code)
{
- Dictionary<int, Label> labels = new Dictionary<int, Label>();
+ Dictionary<int, Label> labels = new();
int lastTarget = 0;
int i;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
index 52c2a11b..5a71e3f4 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
@@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// <summary>
/// Arguments FIFO.
/// </summary>
- public Queue<FifoWord> Fifo { get; } = new Queue<FifoWord>();
+ public Queue<FifoWord> Fifo { get; } = new();
/// <summary>
/// Fetches a arguments from the arguments FIFO.
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs
index 44cd8213..0aa6b82a 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs
@@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
[StructLayout(LayoutKind.Sequential, Size = 1024)]
struct MmeShadowScratch
{
-#pragma warning disable CS0169
+#pragma warning disable CS0169 // The private field is never used
private uint _e0;
#pragma warning restore CS0169
public ref uint this[int index] => ref AsSpan()[index];
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/SetMmeShadowRamControlMode.cs b/src/Ryujinx.Graphics.Gpu/Engine/SetMmeShadowRamControlMode.cs
index 060d35ca..ebb0ff33 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/SetMmeShadowRamControlMode.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/SetMmeShadowRamControlMode.cs
@@ -10,4 +10,4 @@ namespace Ryujinx.Graphics.Gpu.Engine
MethodPassthrough = 2,
MethodReplay = 3,
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/ShaderTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/ShaderTexture.cs
index e1e3085b..40d9a97d 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/ShaderTexture.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/ShaderTexture.cs
@@ -65,6 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
{
return format switch
{
+#pragma warning disable IDE0055 // Disable formatting
TextureFormat.R8Unorm => Format.R8Unorm,
TextureFormat.R8Snorm => Format.R8Snorm,
TextureFormat.R8Uint => Format.R8Uint,
@@ -104,7 +105,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
TextureFormat.R10G10B10A2Unorm => Format.R10G10B10A2Unorm,
TextureFormat.R10G10B10A2Uint => Format.R10G10B10A2Uint,
TextureFormat.R11G11B10Float => Format.R11G11B10Float,
- _ => 0
+ _ => 0,
+#pragma warning restore IDE0055
};
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
index a40b9cc4..0aca3907 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
@@ -209,14 +209,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
new AdvancedBlendUcode(AdvancedBlendOp.HslHue, AdvancedBlendOverlap.Conjoint, false, GenConjointHslHue),
new AdvancedBlendUcode(AdvancedBlendOp.HslSaturation, AdvancedBlendOverlap.Conjoint, false, GenConjointHslSaturation),
new AdvancedBlendUcode(AdvancedBlendOp.HslColor, AdvancedBlendOverlap.Conjoint, false, GenConjointHslColor),
- new AdvancedBlendUcode(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, GenConjointHslLuminosity)
+ new AdvancedBlendUcode(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, GenConjointHslLuminosity),
};
public static string GenTable()
{
// This can be used to generate the table on AdvancedBlendPreGenTable.
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new();
sb.AppendLine($"private static Dictionary<Hash128, AdvancedBlendEntry> _entries = new()");
sb.AppendLine("{");
@@ -4223,4 +4223,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
return new FixedFunctionAlpha(BlendOp.MaximumGl, BlendFactor.OneGl, BlendFactor.OneGl);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
index 8072c6af..b336382d 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
@@ -54,12 +54,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <returns>True if the function was found, false otherwise</returns>
public bool TryGetAdvancedBlend(out AdvancedBlendDescriptor descriptor)
{
- Span<uint> currentCode = new Span<uint>(_code);
+ Span<uint> currentCode = new(_code);
byte codeLength = (byte)_state.State.BlendUcodeSize;
if (currentCode.Length > codeLength)
{
- currentCode = currentCode.Slice(0, codeLength);
+ currentCode = currentCode[..codeLength];
}
Hash128 hash = XXHash128.ComputeHash(MemoryMarshal.Cast<uint, byte>(currentCode));
@@ -112,4 +112,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
return true;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendPreGenTable.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendPreGenTable.cs
index d35d8abf..b6cd9def 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendPreGenTable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendPreGenTable.cs
@@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <summary>
/// Advanced blend function entry.
/// </summary>
- struct AdvancedBlendEntry
+ readonly struct AdvancedBlendEntry
{
/// <summary>
/// Advanced blend operation.
@@ -270,4 +270,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
{ new Hash128(0x8652300E32D93050, 0x9460E7B449132371), new AdvancedBlendEntry(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, new[] { new RgbFloat(0.3f, 0.59f, 0.11f) }, new FixedFunctionAlpha(BlendUcodeEnable.EnableRGB, BlendOp.MaximumGl, BlendFactor.OneGl, BlendFactor.OneGl)) },
};
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendUcode.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendUcode.cs
index f06b4bf7..d3e3abbc 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendUcode.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendUcode.cs
@@ -5,12 +5,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <summary>
/// Fixed function alpha state used for a advanced blend function.
/// </summary>
- struct FixedFunctionAlpha
+ readonly struct FixedFunctionAlpha
{
/// <summary>
/// Fixed function alpha state with alpha blending disabled.
/// </summary>
- public static FixedFunctionAlpha Disabled => new FixedFunctionAlpha(BlendUcodeEnable.EnableRGBA, default, default, default);
+ public static FixedFunctionAlpha Disabled => new(BlendUcodeEnable.EnableRGBA, default, default, default);
/// <summary>
/// Individual enable bits for the RGB and alpha components.
@@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <summary>
/// Advanced blend microcode state.
/// </summary>
- struct AdvancedBlendUcode
+ readonly struct AdvancedBlendUcode
{
/// <summary>
/// Advanced blend operation.
@@ -117,10 +117,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
Overlap = overlap;
SrcPreMultiplied = srcPreMultiplied;
- UcodeAssembler asm = new UcodeAssembler();
+ UcodeAssembler asm = new();
Alpha = genFunc(ref asm);
Code = asm.GetCode();
Constants = asm.GetConstants();
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/UcodeAssembler.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/UcodeAssembler.cs
index f854787e..8e020906 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/UcodeAssembler.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/UcodeAssembler.cs
@@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
Max = 3,
Rcp = 4,
Add = 5,
- Sub = 6
+ Sub = 6,
}
/// <summary>
@@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
LT = 4,
LE = 5,
GT = 6,
- GE = 7
+ GE = 7,
}
/// <summary>
@@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
Temp1 = 0xa,
Temp2 = 0xb,
PBR = 0xc,
- ConstantRGB = 0xd
+ ConstantRGB = 0xd,
}
/// <summary>
@@ -64,7 +64,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
Temp0 = 4,
Temp1 = 5,
Temp2 = 6,
- PBR = 7
+ PBR = 7,
}
/// <summary>
@@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
Temp0 = 0,
Temp1 = 1,
Temp2 = 2,
- PBR = 3
+ PBR = 3,
}
/// <summary>
@@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
RRR = 2,
GGG = 3,
BBB = 4,
- RToA = 5
+ RToA = 5,
}
/// <summary>
@@ -99,13 +99,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
RGB = 0,
R = 1,
G = 2,
- B = 3
+ B = 3,
}
/// <summary>
/// Floating-point RGB color values.
/// </summary>
- struct RgbFloat
+ readonly struct RgbFloat
{
/// <summary>
/// Red component value.
@@ -139,24 +139,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <summary>
/// Blend microcode destination operand, including swizzle, write mask and condition code update flag.
/// </summary>
- struct Dest
+ readonly struct Dest
{
- public static Dest Temp0 => new Dest(OpDst.Temp0, Swizzle.RGB, WriteMask.RGB, false);
- public static Dest Temp1 => new Dest(OpDst.Temp1, Swizzle.RGB, WriteMask.RGB, false);
- public static Dest Temp2 => new Dest(OpDst.Temp2, Swizzle.RGB, WriteMask.RGB, false);
- public static Dest PBR => new Dest(OpDst.PBR, Swizzle.RGB, WriteMask.RGB, false);
+ public static Dest Temp0 => new(OpDst.Temp0, Swizzle.RGB, WriteMask.RGB, false);
+ public static Dest Temp1 => new(OpDst.Temp1, Swizzle.RGB, WriteMask.RGB, false);
+ public static Dest Temp2 => new(OpDst.Temp2, Swizzle.RGB, WriteMask.RGB, false);
+ public static Dest PBR => new(OpDst.PBR, Swizzle.RGB, WriteMask.RGB, false);
- public Dest GBR => new Dest(Dst, Swizzle.GBR, WriteMask, WriteCC);
- public Dest RRR => new Dest(Dst, Swizzle.RRR, WriteMask, WriteCC);
- public Dest GGG => new Dest(Dst, Swizzle.GGG, WriteMask, WriteCC);
- public Dest BBB => new Dest(Dst, Swizzle.BBB, WriteMask, WriteCC);
- public Dest RToA => new Dest(Dst, Swizzle.RToA, WriteMask, WriteCC);
+ public Dest GBR => new(Dst, Swizzle.GBR, WriteMask, WriteCC);
+ public Dest RRR => new(Dst, Swizzle.RRR, WriteMask, WriteCC);
+ public Dest GGG => new(Dst, Swizzle.GGG, WriteMask, WriteCC);
+ public Dest BBB => new(Dst, Swizzle.BBB, WriteMask, WriteCC);
+ public Dest RToA => new(Dst, Swizzle.RToA, WriteMask, WriteCC);
- public Dest R => new Dest(Dst, Swizzle, WriteMask.R, WriteCC);
- public Dest G => new Dest(Dst, Swizzle, WriteMask.G, WriteCC);
- public Dest B => new Dest(Dst, Swizzle, WriteMask.B, WriteCC);
+ public Dest R => new(Dst, Swizzle, WriteMask.R, WriteCC);
+ public Dest G => new(Dst, Swizzle, WriteMask.G, WriteCC);
+ public Dest B => new(Dst, Swizzle, WriteMask.B, WriteCC);
- public Dest CC => new Dest(Dst, Swizzle, WriteMask, true);
+ public Dest CC => new(Dst, Swizzle, WriteMask, true);
public OpDst Dst { get; }
public Swizzle Swizzle { get; }
@@ -182,7 +182,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
/// <summary>
/// Blend microcode operaiton.
/// </summary>
- struct UcodeOp
+ readonly struct UcodeOp
{
public readonly uint Word;
@@ -292,14 +292,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
_constantIndex = index;
}
- public uint[] GetCode()
+ public readonly uint[] GetCode()
{
return _code?.ToArray();
}
- public RgbFloat[] GetConstants()
+ public readonly RgbFloat[] GetConstants()
{
return _constants;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
index 5c936616..e30092ce 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
@@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private ulong _ubFollowUpAddress = 0;
private ulong _ubByteCount = 0;
private int _ubIndex = 0;
- private int[] _ubData = new int[UniformDataCacheSize];
+ private readonly int[] _ubData = new int[UniformDataCacheSize];
/// <summary>
/// Creates a new instance of the constant buffer updater.
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
index 9c4921c8..d7ee24b1 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
@@ -186,7 +186,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
int firstVertex = (int)_state.State.FirstVertex;
- BufferRange br = new BufferRange(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
+ BufferRange br = new(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
_channel.BufferManager.SetIndexBuffer(br, IndexType.UInt);
@@ -200,7 +200,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
else
{
+#pragma warning disable IDE0059 // Remove unnecessary value assignment
var drawState = _state.State.VertexBufferDrawState;
+#pragma warning restore IDE0059
_context.Renderer.Pipeline.Draw(drawVertexCount, 1, drawFirstVertex, firstInstance);
}
@@ -679,7 +681,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (indexedInline)
{
int inlineIndexCount = _drawState.IbStreamer.GetAndResetInlineIndexCount(_context.Renderer);
- BufferRange br = new BufferRange(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
+ BufferRange br = new(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
_channel.BufferManager.SetIndexBuffer(br, IndexType.UInt);
}
@@ -809,7 +811,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Span<Rectangle<int>> scissors = stackalloc Rectangle<int>[]
{
- new Rectangle<int>(scissorX, scissorY, scissorW, scissorH)
+ new Rectangle<int>(scissorX, scissorY, scissorW, scissorH),
};
_context.Renderer.Pipeline.SetScissors(scissors);
@@ -821,7 +823,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
var clearColor = _state.State.ClearColors;
- ColorF color = new ColorF(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
+ ColorF color = new(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
_context.Renderer.Pipeline.ClearRenderTargetColor(index, layer, layerCount, componentMask, color);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs
index 42ec2442..12099aef 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs
@@ -60,6 +60,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <summary>
/// Index buffer data streamer for inline index buffer updates, such as those used in legacy OpenGL.
/// </summary>
- public IbStreamer IbStreamer = new IbStreamer();
+ public IbStreamer IbStreamer = new();
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs
index 80d8c00b..022e12f5 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs
@@ -1,6 +1,5 @@
using Ryujinx.Common;
using Ryujinx.Graphics.GAL;
-using System;
using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Engine.Threed
@@ -17,33 +16,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private int _inlineIndexBufferSize;
private int _inlineIndexCount;
private uint[] _buffer;
- private int _bufferOffset;
+#pragma warning disable IDE0051 // Remove unused private member
+ private readonly int _bufferOffset;
+#pragma warning restore IDE0051
/// <summary>
/// Indicates if any index buffer data has been pushed.
/// </summary>
- public bool HasInlineIndexData => _inlineIndexCount != 0;
+ public readonly bool HasInlineIndexData => _inlineIndexCount != 0;
/// <summary>
/// Total numbers of indices that have been pushed.
/// </summary>
- public int InlineIndexCount => _inlineIndexCount;
+ public readonly int InlineIndexCount => _inlineIndexCount;
/// <summary>
/// Gets the handle for the host buffer currently holding the inline index buffer data.
/// </summary>
/// <returns>Host buffer handle</returns>
- public BufferHandle GetInlineIndexBuffer()
+ public readonly BufferHandle GetInlineIndexBuffer()
{
return _inlineIndexBuffer;
}
/// <summary>
/// Gets the number of elements on the current inline index buffer,
- /// while also reseting it to zero for the next draw.
+ /// while also resetting it to zero for the next draw.
/// </summary>
/// <param name="renderer">Host renderer</param>
- /// <returns>Inline index bufffer count</returns>
+ /// <returns>Inline index buffer count</returns>
public int GetAndResetInlineIndexCount(IRenderer renderer)
{
UpdateRemaining(renderer);
@@ -114,10 +115,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="value">Index value to be written</param>
private void PushData(IRenderer renderer, int offset, uint value)
{
- if (_buffer == null)
- {
- _buffer = new uint[BufferCapacity];
- }
+ _buffer ??= new uint[BufferCapacity];
// We upload data in chunks.
// If we are at the start of a chunk, then the buffer might be full,
@@ -155,7 +153,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int baseOffset = (offset - count) * sizeof(uint);
int length = count * sizeof(uint);
BufferHandle buffer = GetInlineIndexBuffer(renderer, baseOffset, length);
- renderer.SetBufferData(buffer, baseOffset, MemoryMarshal.Cast<uint, byte>(_buffer).Slice(0, length));
+ renderer.SetBufferData(buffer, baseOffset, MemoryMarshal.Cast<uint, byte>(_buffer)[..length]);
}
/// <summary>
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs
index d78aa498..331b1976 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs
@@ -1,8 +1,11 @@
+using System.Diagnostics.CodeAnalysis;
+
namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
/// <summary>
/// Indirect draw type, which can be indexed or non-indexed, with or without a draw count.
/// </summary>
+ [SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
enum IndirectDrawType
{
/// <summary>
@@ -33,6 +36,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <summary>
/// Draw count flag.
/// </summary>
- Count = 1 << 1
+ Count = 1 << 1,
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/RenderTargetUpdateFlags.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/RenderTargetUpdateFlags.cs
index cf2e818c..e575923d 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/RenderTargetUpdateFlags.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/RenderTargetUpdateFlags.cs
@@ -36,6 +36,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <summary>
/// Default update flags for draw.
/// </summary>
- UpdateAll = UseControl | UpdateDepthStencil
+ UpdateAll = UseControl | UpdateDepthStencil,
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SemaphoreUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SemaphoreUpdater.cs
index 63a2c841..0a813ee5 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SemaphoreUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SemaphoreUpdater.cs
@@ -1,5 +1,4 @@
using Ryujinx.Graphics.GAL;
-using System;
namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
@@ -15,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
Release = 0,
Acquire = 1,
- Counter = 2
+ Counter = 2,
}
/// <summary>
@@ -37,7 +36,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
ClipperInputPrimitives = 0x1c,
ClipperOutputPrimitives = 0x1d,
FragmentShaderInvocations = 0x1e,
- PrimitivesGenerated = 0x1f
+ PrimitivesGenerated = 0x1f,
}
/// <summary>
@@ -64,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
TransformFeedbackOffset = 0x1a,
TessControlShaderInvocations = 0x1b,
TessEvaluationShaderInvocations = 0x1d,
- TessEvaluationShaderPrimitives = 0x1f
+ TessEvaluationShaderPrimitives = 0x1f,
}
private readonly GpuContext _context;
@@ -117,8 +116,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
switch (op)
{
- case SemaphoreOperation.Release: ReleaseSemaphore(); break;
- case SemaphoreOperation.Counter: ReportCounter(type); break;
+ case SemaphoreOperation.Release:
+ ReleaseSemaphore();
+ break;
+ case SemaphoreOperation.Counter:
+ ReportCounter(type);
+ break;
}
}
@@ -156,10 +159,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
void resultHandler(object evt, ulong result)
{
- CounterData counterData = new CounterData
+ CounterData counterData = new()
{
Counter = result,
- Timestamp = ticks
+ Timestamp = ticks,
};
if (counter?.Invalid != true)
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
index a8af5497..cbf1573c 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
@@ -227,7 +227,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
VertexAttribType.Sint => AttributeType.Sint,
VertexAttribType.Uint => AttributeType.Uint,
- _ => AttributeType.Float
+ _ => AttributeType.Float,
};
if (attributeTypes[location] != value)
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index 92e980ce..34439657 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private readonly ShaderProgramInfo[] _currentProgramInfo;
private ShaderSpecializationState _shaderSpecState;
- private SpecializationStateUpdater _currentSpecState;
+ private readonly SpecializationStateUpdater _currentSpecState;
private ProgramPipelineState _pipeline;
@@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private uint _vbEnableMask;
private bool _prevDrawIndexed;
- private bool _prevDrawIndirect;
+ private readonly bool _prevDrawIndirect;
private IndexType _prevIndexType;
private uint _prevFirstVertex;
private bool _prevTfEnable;
@@ -448,7 +448,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int samplesInY = msaaMode.SamplesInY();
var scissor = _state.State.ScreenScissorState;
- Size sizeHint = new Size((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
+ Size sizeHint = new((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
int clipRegionWidth = int.MaxValue;
int clipRegionHeight = int.MaxValue;
@@ -669,7 +669,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateDepthTestState()
{
- DepthTestDescriptor descriptor = new DepthTestDescriptor(
+ DepthTestDescriptor descriptor = new(
_state.State.DepthTestEnable,
_state.State.DepthWriteEnable,
_state.State.DepthTestFunc);
@@ -739,7 +739,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
height *= scale;
}
- Rectangle<float> region = new Rectangle<float>(x, y, width, height);
+ Rectangle<float> region = new(x, y, width, height);
ViewportSwizzle swizzleX = transform.UnpackSwizzleX();
ViewportSwizzle swizzleY = transform.UnpackSwizzleY();
@@ -751,9 +751,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (transform.ScaleZ < 0)
{
- float temp = depthNear;
- depthNear = depthFar;
- depthFar = temp;
+ (depthFar, depthNear) = (depthNear, depthFar);
}
viewports[index] = new Viewport(region, swizzleX, swizzleY, swizzleZ, swizzleW, depthNear, depthFar);
@@ -845,7 +843,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
backMask = test.FrontMask;
}
- StencilTestDescriptor descriptor = new StencilTestDescriptor(
+ StencilTestDescriptor descriptor = new(
test.Enable,
test.FrontFunc,
test.FrontSFail,
@@ -939,7 +937,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
VertexAttribType.Sint => Format.R32G32B32A32Sint,
VertexAttribType.Uint => Format.R32G32B32A32Uint,
- _ => Format.R32G32B32A32Float
+ _ => Format.R32G32B32A32Float,
};
}
@@ -1017,8 +1015,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
switch (indexBuffer.Type)
{
- case IndexType.UShort: size *= 2; break;
- case IndexType.UInt: size *= 4; break;
+ case IndexType.UShort:
+ size *= 2;
+ break;
+ case IndexType.UInt:
+ size *= 4;
+ break;
}
_channel.BufferManager.SetIndexBuffer(gpuVa, size, indexBuffer.Type);
@@ -1338,7 +1340,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_vtgWritesRtLayer = false;
- ShaderAddresses addresses = new ShaderAddresses();
+ ShaderAddresses addresses = new();
Span<ulong> addressesSpan = addresses.AsSpan();
ulong baseAddress = _state.State.ShaderBaseAddress.Pack();
@@ -1453,7 +1455,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// ScaleZ = (Far - Near) / 2
// DepthNear/Far are sorted such as that Near is always less than Far.
depthMode = extents.DepthNear != transform.TranslateZ &&
- extents.DepthFar != transform.TranslateZ
+ extents.DepthFar != transform.TranslateZ
? DepthMode.MinusOneToOne
: DepthMode.ZeroToOne;
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
index 1386071c..1f662890 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
@@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{ nameof(ThreedClassState.UniformBufferBindTessControl), new RwCallback(ConstantBufferBindTessControl, null) },
{ nameof(ThreedClassState.UniformBufferBindTessEvaluation), new RwCallback(ConstantBufferBindTessEvaluation, null) },
{ nameof(ThreedClassState.UniformBufferBindGeometry), new RwCallback(ConstantBufferBindGeometry, null) },
- { nameof(ThreedClassState.UniformBufferBindFragment), new RwCallback(ConstantBufferBindFragment, null) }
+ { nameof(ThreedClassState.UniformBufferBindFragment), new RwCallback(ConstantBufferBindFragment, null) },
});
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
index beda2dbf..f2997678 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
@@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
TessellationControl,
TessellationEvaluation,
Geometry,
- Fragment
+ Fragment,
}
/// <summary>
@@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct TessMode
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Packed;
#pragma warning restore CS0649
@@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the tessellation abstract patch type.
/// </summary>
/// <returns>Abtract patch type</returns>
- public TessPatchType UnpackPatchType()
+ public readonly TessPatchType UnpackPatchType()
{
return (TessPatchType)(Packed & 3);
}
@@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the spacing between tessellated vertices of the patch.
/// </summary>
/// <returns>Spacing between tessellated vertices</returns>
- public TessSpacing UnpackSpacing()
+ public readonly TessSpacing UnpackSpacing()
{
return (TessSpacing)((Packed >> 4) & 3);
}
@@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the primitive winding order.
/// </summary>
/// <returns>True if clockwise, false if counter-clockwise</returns>
- public bool UnpackCw()
+ public readonly bool UnpackCw()
{
return (Packed & (1 << 8)) != 0;
}
@@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct TfBufferState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 Enable;
public GpuVa Address;
public int Size;
@@ -79,7 +79,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct TfState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public int BufferIndex;
public int VaryingsCount;
public int Stride;
@@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct RtColorState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public GpuVa Address;
public int WidthOrStride;
public int Height;
@@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ViewportTransform
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public float ScaleX;
public float ScaleY;
public float ScaleZ;
@@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks viewport swizzle of the position X component.
/// </summary>
/// <returns>Swizzle enum value</returns>
- public ViewportSwizzle UnpackSwizzleX()
+ public readonly ViewportSwizzle UnpackSwizzleX()
{
return (ViewportSwizzle)(Swizzle & 7);
}
@@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks viewport swizzle of the position Y component.
/// </summary>
/// <returns>Swizzle enum value</returns>
- public ViewportSwizzle UnpackSwizzleY()
+ public readonly ViewportSwizzle UnpackSwizzleY()
{
return (ViewportSwizzle)((Swizzle >> 4) & 7);
}
@@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks viewport swizzle of the position Z component.
/// </summary>
/// <returns>Swizzle enum value</returns>
- public ViewportSwizzle UnpackSwizzleZ()
+ public readonly ViewportSwizzle UnpackSwizzleZ()
{
return (ViewportSwizzle)((Swizzle >> 8) & 7);
}
@@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks viewport swizzle of the position W component.
/// </summary>
/// <returns>Swizzle enum value</returns>
- public ViewportSwizzle UnpackSwizzleW()
+ public readonly ViewportSwizzle UnpackSwizzleW()
{
return (ViewportSwizzle)((Swizzle >> 12) & 7);
}
@@ -169,7 +169,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ViewportExtents
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public ushort X;
public ushort Width;
public ushort Y;
@@ -184,7 +184,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct VertexBufferDrawState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public int First;
public int Count;
#pragma warning restore CS0649
@@ -195,7 +195,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ClearColors
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public float Red;
public float Green;
public float Blue;
@@ -208,7 +208,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct DepthBiasState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 PointEnable;
public Boolean32 LineEnable;
public Boolean32 FillEnable;
@@ -223,7 +223,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Disabled = 0,
EnableRGB = 1,
EnableAlpha = 2,
- EnableRGBA = 3
+ EnableRGBA = 3,
}
/// <summary>
@@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ScissorState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 Enable;
public ushort X1;
public ushort X2;
@@ -246,7 +246,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct StencilBackMasks
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public int FuncRef;
public int Mask;
public int FuncMask;
@@ -258,7 +258,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct RtDepthStencilState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public GpuVa Address;
public ZetaFormat Format;
public MemoryLayout MemoryLayout;
@@ -271,7 +271,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ScreenScissorState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public ushort X;
public ushort Width;
public ushort Y;
@@ -297,7 +297,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Size16 = 0x1b,
Size8 = 0x1d,
Rgb10A2 = 0x30,
- Rg11B10 = 0x31
+ Rg11B10 = 0x31,
}
/// <summary>
@@ -311,7 +311,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Uint = 4,
Uscaled = 5,
Sscaled = 6,
- Float = 7
+ Float = 7,
}
/// <summary>
@@ -319,7 +319,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct VertexAttribState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Attribute;
#pragma warning restore CS0649
@@ -327,7 +327,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the index of the vertex buffer this attribute belongs to.
/// </summary>
/// <returns>Vertex buffer index</returns>
- public int UnpackBufferIndex()
+ public readonly int UnpackBufferIndex()
{
return (int)(Attribute & 0x1f);
}
@@ -336,7 +336,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the attribute constant flag.
/// </summary>
/// <returns>True if the attribute is constant, false otherwise</returns>
- public bool UnpackIsConstant()
+ public readonly bool UnpackIsConstant()
{
return (Attribute & 0x40) != 0;
}
@@ -345,7 +345,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
/// </summary>
/// <returns>Attribute offset in bytes</returns>
- public int UnpackOffset()
+ public readonly int UnpackOffset()
{
return (int)((Attribute >> 7) & 0x3fff);
}
@@ -354,7 +354,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the Maxwell attribute format integer.
/// </summary>
/// <returns>Attribute format integer</returns>
- public uint UnpackFormat()
+ public readonly uint UnpackFormat()
{
return Attribute & 0x3fe00000;
}
@@ -363,7 +363,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the Maxwell attribute size.
/// </summary>
/// <returns>Attribute size</returns>
- public VertexAttribSize UnpackSize()
+ public readonly VertexAttribSize UnpackSize()
{
return (VertexAttribSize)((Attribute >> 21) & 0x3f);
}
@@ -372,7 +372,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the Maxwell attribute component type.
/// </summary>
/// <returns>Attribute component type</returns>
- public VertexAttribType UnpackType()
+ public readonly VertexAttribType UnpackType()
{
return (VertexAttribType)((Attribute >> 27) & 7);
}
@@ -383,7 +383,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct RtControl
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Packed;
#pragma warning restore CS0649
@@ -391,7 +391,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the number of active draw buffers.
/// </summary>
/// <returns>Number of active draw buffers</returns>
- public int UnpackCount()
+ public readonly int UnpackCount()
{
return (int)(Packed & 0xf);
}
@@ -401,7 +401,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
/// <param name="index">Index of the draw buffer</param>
/// <returns>Attachment index</returns>
- public int UnpackPermutationIndex(int index)
+ public readonly int UnpackPermutationIndex(int index)
{
return (int)((Packed >> (4 + index * 3)) & 7);
}
@@ -412,7 +412,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct Size3D
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public int Width;
public int Height;
public int Depth;
@@ -424,7 +424,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct StencilTestState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 Enable;
public StencilOp FrontSFail;
public StencilOp FrontDpFail;
@@ -443,7 +443,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
enum YControl
{
NegateY = 1 << 0,
- TriangleRastFlip = 1 << 4
+ TriangleRastFlip = 1 << 4,
}
/// <summary>
@@ -451,7 +451,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct RgbHalf
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint R;
public uint G;
public uint B;
@@ -462,7 +462,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the red color component as a 16-bit float value.
/// </summary>
/// <returns>The component value</returns>
- public Half UnpackR()
+ public readonly Half UnpackR()
{
ushort value = (ushort)R;
return Unsafe.As<ushort, Half>(ref value);
@@ -472,7 +472,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the green color component as a 16-bit float value.
/// </summary>
/// <returns>The component value</returns>
- public Half UnpackG()
+ public readonly Half UnpackG()
{
ushort value = (ushort)G;
return Unsafe.As<ushort, Half>(ref value);
@@ -482,7 +482,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks the blue color component as a 16-bit float value.
/// </summary>
/// <returns>The component value</returns>
- public Half UnpackB()
+ public readonly Half UnpackB()
{
ushort value = (ushort)B;
return Unsafe.As<ushort, Half>(ref value);
@@ -498,7 +498,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Always,
ResultNonZero,
Equal,
- NotEqual
+ NotEqual,
}
/// <summary>
@@ -506,7 +506,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct PoolState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public GpuVa Address;
public int MaximumId;
#pragma warning restore CS0649
@@ -517,7 +517,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct StencilBackTestState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 TwoSided;
public StencilOp BackSFail;
public StencilOp BackDpFail;
@@ -531,7 +531,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct PrimitiveRestartState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 Enable;
public int Index;
#pragma warning restore CS0649
@@ -543,7 +543,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct IndexBufferState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public GpuVa Address;
public GpuVa EndAddress;
public IndexType Type;
@@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct FaceState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 CullEnable;
public FrontFace FrontFace;
public Face CullFace;
@@ -570,7 +570,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
enum ViewVolumeClipControl
{
ForceDepthRangeZeroToOne = 1 << 0,
- DepthClampDisabled = 1 << 11
+ DepthClampDisabled = 1 << 11,
}
/// <summary>
@@ -578,7 +578,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct LogicalOpState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 Enable;
public LogicalOp LogicalOp;
#pragma warning restore CS0649
@@ -590,7 +590,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct RtColorMask
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Packed;
#pragma warning restore CS0649
@@ -598,7 +598,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks red channel enable.
/// </summary>
/// <returns>True to write the new red channel color, false to keep the old value</returns>
- public bool UnpackRed()
+ public readonly bool UnpackRed()
{
return (Packed & 0x1) != 0;
}
@@ -607,7 +607,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks green channel enable.
/// </summary>
/// <returns>True to write the new green channel color, false to keep the old value</returns>
- public bool UnpackGreen()
+ public readonly bool UnpackGreen()
{
return (Packed & 0x10) != 0;
}
@@ -616,7 +616,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks blue channel enable.
/// </summary>
/// <returns>True to write the new blue channel color, false to keep the old value</returns>
- public bool UnpackBlue()
+ public readonly bool UnpackBlue()
{
return (Packed & 0x100) != 0;
}
@@ -625,7 +625,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Unpacks alpha channel enable.
/// </summary>
/// <returns>True to write the new alpha channel color, false to keep the old value</returns>
- public bool UnpackAlpha()
+ public readonly bool UnpackAlpha()
{
return (Packed & 0x1000) != 0;
}
@@ -636,7 +636,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct VertexBufferState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Control;
public GpuVa Address;
public int Divisor;
@@ -646,7 +646,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory.
/// </summary>
/// <returns>Vertex buffer stride</returns>
- public int UnpackStride()
+ public readonly int UnpackStride()
{
return (int)(Control & 0xfff);
}
@@ -655,7 +655,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Vertex buffer enable.
/// </summary>
/// <returns>True if the vertex buffer is enabled, false otherwise</returns>
- public bool UnpackEnable()
+ public readonly bool UnpackEnable()
{
return (Control & (1 << 12)) != 0;
}
@@ -666,7 +666,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct BlendStateCommon
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 SeparateAlpha;
public BlendOp ColorOp;
public BlendFactor ColorSrcFactor;
@@ -683,7 +683,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct BlendState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public Boolean32 SeparateAlpha;
public BlendOp ColorOp;
public BlendFactor ColorSrcFactor;
@@ -700,7 +700,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct ShaderState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Control;
public uint Offset;
public uint Unknown0x8;
@@ -724,7 +724,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Must be ignored for vertex shaders, those are always enabled.
/// </summary>
/// <returns>True if the stage is enabled, false otherwise</returns>
- public bool UnpackEnable()
+ public readonly bool UnpackEnable()
{
return (Control & 1) != 0;
}
@@ -735,7 +735,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
struct UniformBufferState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public int Size;
public GpuVa Address;
public int Offset;
@@ -744,30 +744,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
unsafe struct ThreedClassState : IShadowState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetObject;
- public int SetObjectClassId => (int)(SetObject & 0xFFFF);
- public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
+ public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
+ public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
public fixed uint Reserved04[63];
public uint NoOperation;
public uint SetNotifyA;
- public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
+ public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
public uint SetNotifyB;
public uint Notify;
- public NotifyType NotifyType => (NotifyType)(Notify);
+ public readonly NotifyType NotifyType => (NotifyType)(Notify);
public uint WaitForIdle;
public uint LoadMmeInstructionRamPointer;
public uint LoadMmeInstructionRam;
public uint LoadMmeStartAddressRamPointer;
public uint LoadMmeStartAddressRam;
public uint SetMmeShadowRamControl;
- public SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
+ public readonly SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
public fixed uint Reserved128[2];
public uint SetGlobalRenderEnableA;
- public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
+ public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
public uint SetGlobalRenderEnableB;
public uint SetGlobalRenderEnableC;
- public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
+ public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
public uint SendGoIdle;
public uint PmTrigger;
public uint PmTriggerWfi;
@@ -778,30 +778,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
public uint LineLengthIn;
public uint LineCount;
public uint OffsetOutUpper;
- public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
+ public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
public uint OffsetOut;
public uint PitchOut;
public uint SetDstBlockSize;
- public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
- public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
- public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
+ public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
+ public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
+ public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
public uint SetDstWidth;
public uint SetDstHeight;
public uint SetDstDepth;
public uint SetDstLayer;
public uint SetDstOriginBytesX;
- public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
+ public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
public uint SetDstOriginSamplesY;
- public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
+ public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
public uint LaunchDma;
- public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
- public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
- public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
- public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
- public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
- public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
- public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
- public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
+ public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
+ public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
+ public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
+ public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
+ public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
+ public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
+ public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
+ public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
public uint LoadInlineData;
public fixed uint Reserved1B8[22];
public Boolean32 EarlyZForce;
@@ -1042,7 +1042,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
public fixed uint Reserved260C[125];
public Array4<Array32<uint>> TfVaryingLocations;
public fixed uint Reserved2A00[640];
- public MmeShadowScratch SetMmeShadowScratch;
+ public Array256<uint> SetMmeShadowScratch;
#pragma warning restore CS0649
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
index 2ac84ab5..b33fb7f7 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
@@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
_channel = channel;
_state = new DeviceState<TwodClassState>(new Dictionary<string, RwCallback>
{
- { nameof(TwodClassState.PixelsFromMemorySrcY0Int), new RwCallback(PixelsFromMemorySrcY0Int, null) }
+ { nameof(TwodClassState.PixelsFromMemorySrcY0Int), new RwCallback(PixelsFromMemorySrcY0Int, null) },
});
}
@@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// <param name="lhsFormat">Format of the first texture</param>
/// <param name="rhsFormat">Format of the second texture</param>
/// <returns>True if the data is compatible, false otherwise</returns>
- private bool IsDataCompatible(TwodTexture lhs, TwodTexture rhs, FormatInfo lhsFormat, FormatInfo rhsFormat)
+ private static bool IsDataCompatible(TwodTexture lhs, TwodTexture rhs, FormatInfo lhsFormat, FormatInfo rhsFormat)
{
if (lhsFormat.BytesPerPixel != rhsFormat.BytesPerPixel ||
lhs.Height != rhs.Height ||
@@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// <param name="x2">Region end x</param>
/// <param name="y2">Region end y</param>
/// <returns>True if the region covers the full texture, false otherwise</returns>
- private bool IsCopyRegionComplete(TwodTexture texture, FormatInfo formatInfo, int x1, int y1, int x2, int y2)
+ private static bool IsCopyRegionComplete(TwodTexture texture, FormatInfo formatInfo, int x1, int y1, int x2, int y2)
{
if (x1 != 0 || y1 != 0 || y2 != texture.Height)
{
@@ -172,7 +172,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
for (int y = 0; y < height; y++)
{
- srcSpan.Slice(offset, lineSize).CopyTo(dstSpan.Slice(offset));
+ srcSpan.Slice(offset, lineSize).CopyTo(dstSpan[offset..]);
offset += stride;
}
@@ -364,13 +364,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
float scale = srcTexture.ScaleFactor;
float dstScale = dstTexture.ScaleFactor;
- Extents2D srcRegion = new Extents2D(
+ Extents2D srcRegion = new(
(int)Math.Ceiling(scale * (srcX1 / srcTexture.Info.SamplesInX)),
(int)Math.Ceiling(scale * (srcY1 / srcTexture.Info.SamplesInY)),
(int)Math.Ceiling(scale * (srcX2 / srcTexture.Info.SamplesInX)),
(int)Math.Ceiling(scale * (srcY2 / srcTexture.Info.SamplesInY)));
- Extents2D dstRegion = new Extents2D(
+ Extents2D dstRegion = new(
(int)Math.Ceiling(dstScale * (dstX1 / dstTexture.Info.SamplesInX)),
(int)Math.Ceiling(dstScale * (dstY1 / dstTexture.Info.SamplesInY)),
(int)Math.Ceiling(dstScale * (dstX2 / dstTexture.Info.SamplesInX)),
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs
index 55e5019f..edea7327 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs
@@ -486,7 +486,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// </summary>
struct RenderSolidPrimPoint
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetX;
public uint Y;
#pragma warning restore CS0649
@@ -497,30 +497,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// </summary>
unsafe struct TwodClassState : IShadowState
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint SetObject;
- public int SetObjectClassId => (int)(SetObject & 0xFFFF);
- public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
+ public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
+ public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
public fixed uint Reserved04[63];
public uint NoOperation;
public uint SetNotifyA;
- public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0x1FFFFFF);
+ public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0x1FFFFFF);
public uint SetNotifyB;
public uint Notify;
- public NotifyType NotifyType => (NotifyType)(Notify);
+ public readonly NotifyType NotifyType => (NotifyType)(Notify);
public uint WaitForIdle;
public uint LoadMmeInstructionRamPointer;
public uint LoadMmeInstructionRam;
public uint LoadMmeStartAddressRamPointer;
public uint LoadMmeStartAddressRam;
public uint SetMmeShadowRamControl;
- public SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
+ public readonly SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
public fixed uint Reserved128[2];
public uint SetGlobalRenderEnableA;
- public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
+ public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
public uint SetGlobalRenderEnableB;
public uint SetGlobalRenderEnableC;
- public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
+ public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
public uint SendGoIdle;
public uint PmTrigger;
public fixed uint Reserved144[3];
@@ -528,54 +528,54 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint SetInstrumentationMethodData;
public fixed uint Reserved158[37];
public uint SetMmeSwitchState;
- public bool SetMmeSwitchStateValid => (SetMmeSwitchState & 0x1) != 0;
- public int SetMmeSwitchStateSaveMacro => (int)((SetMmeSwitchState >> 4) & 0xFF);
- public int SetMmeSwitchStateRestoreMacro => (int)((SetMmeSwitchState >> 12) & 0xFF);
+ public readonly bool SetMmeSwitchStateValid => (SetMmeSwitchState & 0x1) != 0;
+ public readonly int SetMmeSwitchStateSaveMacro => (int)((SetMmeSwitchState >> 4) & 0xFF);
+ public readonly int SetMmeSwitchStateRestoreMacro => (int)((SetMmeSwitchState >> 12) & 0xFF);
public fixed uint Reserved1F0[4];
public uint SetDstFormat;
- public SetDstFormatV SetDstFormatV => (SetDstFormatV)(SetDstFormat & 0xFF);
+ public readonly SetDstFormatV SetDstFormatV => (SetDstFormatV)(SetDstFormat & 0xFF);
public uint SetDstMemoryLayout;
- public SetDstMemoryLayoutV SetDstMemoryLayoutV => (SetDstMemoryLayoutV)(SetDstMemoryLayout & 0x1);
+ public readonly SetDstMemoryLayoutV SetDstMemoryLayoutV => (SetDstMemoryLayoutV)(SetDstMemoryLayout & 0x1);
public uint SetDstBlockSize;
- public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0x7);
- public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0x7);
+ public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0x7);
+ public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0x7);
public uint SetDstDepth;
public uint SetDstLayer;
public uint SetDstPitch;
public uint SetDstWidth;
public uint SetDstHeight;
public uint SetDstOffsetUpper;
- public int SetDstOffsetUpperV => (int)(SetDstOffsetUpper & 0xFF);
+ public readonly int SetDstOffsetUpperV => (int)(SetDstOffsetUpper & 0xFF);
public uint SetDstOffsetLower;
public uint FlushAndInvalidateRopMiniCache;
- public bool FlushAndInvalidateRopMiniCacheV => (FlushAndInvalidateRopMiniCache & 0x1) != 0;
+ public readonly bool FlushAndInvalidateRopMiniCacheV => (FlushAndInvalidateRopMiniCache & 0x1) != 0;
public uint SetSpareNoop06;
public uint SetSrcFormat;
- public SetSrcFormatV SetSrcFormatV => (SetSrcFormatV)(SetSrcFormat & 0xFF);
+ public readonly SetSrcFormatV SetSrcFormatV => (SetSrcFormatV)(SetSrcFormat & 0xFF);
public uint SetSrcMemoryLayout;
- public SetSrcMemoryLayoutV SetSrcMemoryLayoutV => (SetSrcMemoryLayoutV)(SetSrcMemoryLayout & 0x1);
+ public readonly SetSrcMemoryLayoutV SetSrcMemoryLayoutV => (SetSrcMemoryLayoutV)(SetSrcMemoryLayout & 0x1);
public uint SetSrcBlockSize;
- public SetSrcBlockSizeHeight SetSrcBlockSizeHeight => (SetSrcBlockSizeHeight)((SetSrcBlockSize >> 4) & 0x7);
- public SetSrcBlockSizeDepth SetSrcBlockSizeDepth => (SetSrcBlockSizeDepth)((SetSrcBlockSize >> 8) & 0x7);
+ public readonly SetSrcBlockSizeHeight SetSrcBlockSizeHeight => (SetSrcBlockSizeHeight)((SetSrcBlockSize >> 4) & 0x7);
+ public readonly SetSrcBlockSizeDepth SetSrcBlockSizeDepth => (SetSrcBlockSizeDepth)((SetSrcBlockSize >> 8) & 0x7);
public uint SetSrcDepth;
public uint TwodInvalidateTextureDataCache;
- public TwodInvalidateTextureDataCacheV TwodInvalidateTextureDataCacheV => (TwodInvalidateTextureDataCacheV)(TwodInvalidateTextureDataCache & 0x3);
+ public readonly TwodInvalidateTextureDataCacheV TwodInvalidateTextureDataCacheV => (TwodInvalidateTextureDataCacheV)(TwodInvalidateTextureDataCache & 0x3);
public uint SetSrcPitch;
public uint SetSrcWidth;
public uint SetSrcHeight;
public uint SetSrcOffsetUpper;
- public int SetSrcOffsetUpperV => (int)(SetSrcOffsetUpper & 0xFF);
+ public readonly int SetSrcOffsetUpperV => (int)(SetSrcOffsetUpper & 0xFF);
public uint SetSrcOffsetLower;
public uint SetPixelsFromMemorySectorPromotion;
- public SetPixelsFromMemorySectorPromotionV SetPixelsFromMemorySectorPromotionV => (SetPixelsFromMemorySectorPromotionV)(SetPixelsFromMemorySectorPromotion & 0x3);
+ public readonly SetPixelsFromMemorySectorPromotionV SetPixelsFromMemorySectorPromotionV => (SetPixelsFromMemorySectorPromotionV)(SetPixelsFromMemorySectorPromotion & 0x3);
public uint SetSpareNoop12;
public uint SetNumProcessingClusters;
- public SetNumProcessingClustersV SetNumProcessingClustersV => (SetNumProcessingClustersV)(SetNumProcessingClusters & 0x1);
+ public readonly SetNumProcessingClustersV SetNumProcessingClustersV => (SetNumProcessingClustersV)(SetNumProcessingClusters & 0x1);
public uint SetRenderEnableA;
- public int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
+ public readonly int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
public uint SetRenderEnableB;
public uint SetRenderEnableC;
- public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
+ public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
public uint SetSpareNoop08;
public uint SetSpareNoop01;
public uint SetSpareNoop11;
@@ -585,29 +585,29 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint SetClipWidth;
public uint SetClipHeight;
public uint SetClipEnable;
- public bool SetClipEnableV => (SetClipEnable & 0x1) != 0;
+ public readonly bool SetClipEnableV => (SetClipEnable & 0x1) != 0;
public uint SetColorKeyFormat;
- public SetColorKeyFormatV SetColorKeyFormatV => (SetColorKeyFormatV)(SetColorKeyFormat & 0x7);
+ public readonly SetColorKeyFormatV SetColorKeyFormatV => (SetColorKeyFormatV)(SetColorKeyFormat & 0x7);
public uint SetColorKey;
public uint SetColorKeyEnable;
- public bool SetColorKeyEnableV => (SetColorKeyEnable & 0x1) != 0;
+ public readonly bool SetColorKeyEnableV => (SetColorKeyEnable & 0x1) != 0;
public uint SetRop;
- public int SetRopV => (int)(SetRop & 0xFF);
+ public readonly int SetRopV => (int)(SetRop & 0xFF);
public uint SetBeta1;
public uint SetBeta4;
- public int SetBeta4B => (int)(SetBeta4 & 0xFF);
- public int SetBeta4G => (int)((SetBeta4 >> 8) & 0xFF);
- public int SetBeta4R => (int)((SetBeta4 >> 16) & 0xFF);
- public int SetBeta4A => (int)((SetBeta4 >> 24) & 0xFF);
+ public readonly int SetBeta4B => (int)(SetBeta4 & 0xFF);
+ public readonly int SetBeta4G => (int)((SetBeta4 >> 8) & 0xFF);
+ public readonly int SetBeta4R => (int)((SetBeta4 >> 16) & 0xFF);
+ public readonly int SetBeta4A => (int)((SetBeta4 >> 24) & 0xFF);
public uint SetOperation;
- public SetOperationV SetOperationV => (SetOperationV)(SetOperation & 0x7);
+ public readonly SetOperationV SetOperationV => (SetOperationV)(SetOperation & 0x7);
public uint SetPatternOffset;
- public int SetPatternOffsetX => (int)(SetPatternOffset & 0x3F);
- public int SetPatternOffsetY => (int)((SetPatternOffset >> 8) & 0x3F);
+ public readonly int SetPatternOffsetX => (int)(SetPatternOffset & 0x3F);
+ public readonly int SetPatternOffsetY => (int)((SetPatternOffset >> 8) & 0x3F);
public uint SetPatternSelect;
- public SetPatternSelectV SetPatternSelectV => (SetPatternSelectV)(SetPatternSelect & 0x3);
+ public readonly SetPatternSelectV SetPatternSelectV => (SetPatternSelectV)(SetPatternSelect & 0x3);
public uint SetDstColorRenderToZetaSurface;
- public bool SetDstColorRenderToZetaSurfaceV => (SetDstColorRenderToZetaSurface & 0x1) != 0;
+ public readonly bool SetDstColorRenderToZetaSurfaceV => (SetDstColorRenderToZetaSurface & 0x1) != 0;
public uint SetSpareNoop04;
public uint SetSpareNoop15;
public uint SetSpareNoop13;
@@ -615,18 +615,18 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint SetSpareNoop14;
public uint SetSpareNoop02;
public uint SetCompression;
- public bool SetCompressionEnable => (SetCompression & 0x1) != 0;
+ public readonly bool SetCompressionEnable => (SetCompression & 0x1) != 0;
public uint SetSpareNoop09;
public uint SetRenderEnableOverride;
- public SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
+ public readonly SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
public uint SetPixelsFromMemoryDirection;
- public SetPixelsFromMemoryDirectionHorizontal SetPixelsFromMemoryDirectionHorizontal => (SetPixelsFromMemoryDirectionHorizontal)(SetPixelsFromMemoryDirection & 0x3);
- public SetPixelsFromMemoryDirectionVertical SetPixelsFromMemoryDirectionVertical => (SetPixelsFromMemoryDirectionVertical)((SetPixelsFromMemoryDirection >> 4) & 0x3);
+ public readonly SetPixelsFromMemoryDirectionHorizontal SetPixelsFromMemoryDirectionHorizontal => (SetPixelsFromMemoryDirectionHorizontal)(SetPixelsFromMemoryDirection & 0x3);
+ public readonly SetPixelsFromMemoryDirectionVertical SetPixelsFromMemoryDirectionVertical => (SetPixelsFromMemoryDirectionVertical)((SetPixelsFromMemoryDirection >> 4) & 0x3);
public uint SetSpareNoop10;
public uint SetMonochromePatternColorFormat;
- public SetMonochromePatternColorFormatV SetMonochromePatternColorFormatV => (SetMonochromePatternColorFormatV)(SetMonochromePatternColorFormat & 0x7);
+ public readonly SetMonochromePatternColorFormatV SetMonochromePatternColorFormatV => (SetMonochromePatternColorFormatV)(SetMonochromePatternColorFormat & 0x7);
public uint SetMonochromePatternFormat;
- public SetMonochromePatternFormatV SetMonochromePatternFormatV => (SetMonochromePatternFormatV)(SetMonochromePatternFormat & 0x1);
+ public readonly SetMonochromePatternFormatV SetMonochromePatternFormatV => (SetMonochromePatternFormatV)(SetMonochromePatternFormat & 0x1);
public uint SetMonochromePatternColor0;
public uint SetMonochromePatternColor1;
public uint SetMonochromePattern0;
@@ -662,52 +662,52 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint SetRenderSolidPrimColor2;
public uint SetRenderSolidPrimColor3;
public uint SetMmeMemAddressA;
- public int SetMmeMemAddressAUpper => (int)(SetMmeMemAddressA & 0x1FFFFFF);
+ public readonly int SetMmeMemAddressAUpper => (int)(SetMmeMemAddressA & 0x1FFFFFF);
public uint SetMmeMemAddressB;
public uint SetMmeDataRamAddress;
public uint MmeDmaRead;
public uint MmeDmaReadFifoed;
public uint MmeDmaWrite;
public uint MmeDmaReduction;
- public MmeDmaReductionReductionOp MmeDmaReductionReductionOp => (MmeDmaReductionReductionOp)(MmeDmaReduction & 0x7);
- public MmeDmaReductionReductionFormat MmeDmaReductionReductionFormat => (MmeDmaReductionReductionFormat)((MmeDmaReduction >> 4) & 0x3);
- public MmeDmaReductionReductionSize MmeDmaReductionReductionSize => (MmeDmaReductionReductionSize)((MmeDmaReduction >> 8) & 0x1);
+ public readonly MmeDmaReductionReductionOp MmeDmaReductionReductionOp => (MmeDmaReductionReductionOp)(MmeDmaReduction & 0x7);
+ public readonly MmeDmaReductionReductionFormat MmeDmaReductionReductionFormat => (MmeDmaReductionReductionFormat)((MmeDmaReduction >> 4) & 0x3);
+ public readonly MmeDmaReductionReductionSize MmeDmaReductionReductionSize => (MmeDmaReductionReductionSize)((MmeDmaReduction >> 8) & 0x1);
public uint MmeDmaSysmembar;
- public bool MmeDmaSysmembarV => (MmeDmaSysmembar & 0x1) != 0;
+ public readonly bool MmeDmaSysmembarV => (MmeDmaSysmembar & 0x1) != 0;
public uint MmeDmaSync;
public uint SetMmeDataFifoConfig;
- public SetMmeDataFifoConfigFifoSize SetMmeDataFifoConfigFifoSize => (SetMmeDataFifoConfigFifoSize)(SetMmeDataFifoConfig & 0x7);
+ public readonly SetMmeDataFifoConfigFifoSize SetMmeDataFifoConfigFifoSize => (SetMmeDataFifoConfigFifoSize)(SetMmeDataFifoConfig & 0x7);
public fixed uint Reserved578[2];
public uint RenderSolidPrimMode;
- public RenderSolidPrimModeV RenderSolidPrimModeV => (RenderSolidPrimModeV)(RenderSolidPrimMode & 0x7);
+ public readonly RenderSolidPrimModeV RenderSolidPrimModeV => (RenderSolidPrimModeV)(RenderSolidPrimMode & 0x7);
public uint SetRenderSolidPrimColorFormat;
- public SetRenderSolidPrimColorFormatV SetRenderSolidPrimColorFormatV => (SetRenderSolidPrimColorFormatV)(SetRenderSolidPrimColorFormat & 0xFF);
+ public readonly SetRenderSolidPrimColorFormatV SetRenderSolidPrimColorFormatV => (SetRenderSolidPrimColorFormatV)(SetRenderSolidPrimColorFormat & 0xFF);
public uint SetRenderSolidPrimColor;
public uint SetRenderSolidLineTieBreakBits;
- public bool SetRenderSolidLineTieBreakBitsXmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x1) != 0;
- public bool SetRenderSolidLineTieBreakBitsXmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x10) != 0;
- public bool SetRenderSolidLineTieBreakBitsYmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x100) != 0;
- public bool SetRenderSolidLineTieBreakBitsYmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x1000) != 0;
+ public readonly bool SetRenderSolidLineTieBreakBitsXmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x1) != 0;
+ public readonly bool SetRenderSolidLineTieBreakBitsXmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x10) != 0;
+ public readonly bool SetRenderSolidLineTieBreakBitsYmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x100) != 0;
+ public readonly bool SetRenderSolidLineTieBreakBitsYmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x1000) != 0;
public fixed uint Reserved590[20];
public uint RenderSolidPrimPointXY;
- public int RenderSolidPrimPointXYX => (int)(RenderSolidPrimPointXY & 0xFFFF);
- public int RenderSolidPrimPointXYY => (int)((RenderSolidPrimPointXY >> 16) & 0xFFFF);
+ public readonly int RenderSolidPrimPointXYX => (int)(RenderSolidPrimPointXY & 0xFFFF);
+ public readonly int RenderSolidPrimPointXYY => (int)((RenderSolidPrimPointXY >> 16) & 0xFFFF);
public fixed uint Reserved5E4[7];
public Array64<RenderSolidPrimPoint> RenderSolidPrimPoint;
public uint SetPixelsFromCpuDataType;
- public SetPixelsFromCpuDataTypeV SetPixelsFromCpuDataTypeV => (SetPixelsFromCpuDataTypeV)(SetPixelsFromCpuDataType & 0x1);
+ public readonly SetPixelsFromCpuDataTypeV SetPixelsFromCpuDataTypeV => (SetPixelsFromCpuDataTypeV)(SetPixelsFromCpuDataType & 0x1);
public uint SetPixelsFromCpuColorFormat;
- public SetPixelsFromCpuColorFormatV SetPixelsFromCpuColorFormatV => (SetPixelsFromCpuColorFormatV)(SetPixelsFromCpuColorFormat & 0xFF);
+ public readonly SetPixelsFromCpuColorFormatV SetPixelsFromCpuColorFormatV => (SetPixelsFromCpuColorFormatV)(SetPixelsFromCpuColorFormat & 0xFF);
public uint SetPixelsFromCpuIndexFormat;
- public SetPixelsFromCpuIndexFormatV SetPixelsFromCpuIndexFormatV => (SetPixelsFromCpuIndexFormatV)(SetPixelsFromCpuIndexFormat & 0x3);
+ public readonly SetPixelsFromCpuIndexFormatV SetPixelsFromCpuIndexFormatV => (SetPixelsFromCpuIndexFormatV)(SetPixelsFromCpuIndexFormat & 0x3);
public uint SetPixelsFromCpuMonoFormat;
- public SetPixelsFromCpuMonoFormatV SetPixelsFromCpuMonoFormatV => (SetPixelsFromCpuMonoFormatV)(SetPixelsFromCpuMonoFormat & 0x1);
+ public readonly SetPixelsFromCpuMonoFormatV SetPixelsFromCpuMonoFormatV => (SetPixelsFromCpuMonoFormatV)(SetPixelsFromCpuMonoFormat & 0x1);
public uint SetPixelsFromCpuWrap;
- public SetPixelsFromCpuWrapV SetPixelsFromCpuWrapV => (SetPixelsFromCpuWrapV)(SetPixelsFromCpuWrap & 0x3);
+ public readonly SetPixelsFromCpuWrapV SetPixelsFromCpuWrapV => (SetPixelsFromCpuWrapV)(SetPixelsFromCpuWrap & 0x3);
public uint SetPixelsFromCpuColor0;
public uint SetPixelsFromCpuColor1;
public uint SetPixelsFromCpuMonoOpacity;
- public SetPixelsFromCpuMonoOpacityV SetPixelsFromCpuMonoOpacityV => (SetPixelsFromCpuMonoOpacityV)(SetPixelsFromCpuMonoOpacity & 0x1);
+ public readonly SetPixelsFromCpuMonoOpacityV SetPixelsFromCpuMonoOpacityV => (SetPixelsFromCpuMonoOpacityV)(SetPixelsFromCpuMonoOpacity & 0x1);
public fixed uint Reserved820[6];
public uint SetPixelsFromCpuSrcWidth;
public uint SetPixelsFromCpuSrcHeight;
@@ -722,45 +722,45 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint PixelsFromCpuData;
public fixed uint Reserved864[3];
public uint SetBigEndianControl;
- public bool SetBigEndianControlX32Swap1 => (SetBigEndianControl & 0x1) != 0;
- public bool SetBigEndianControlX32Swap4 => (SetBigEndianControl & 0x2) != 0;
- public bool SetBigEndianControlX32Swap8 => (SetBigEndianControl & 0x4) != 0;
- public bool SetBigEndianControlX32Swap16 => (SetBigEndianControl & 0x8) != 0;
- public bool SetBigEndianControlX16Swap1 => (SetBigEndianControl & 0x10) != 0;
- public bool SetBigEndianControlX16Swap4 => (SetBigEndianControl & 0x20) != 0;
- public bool SetBigEndianControlX16Swap8 => (SetBigEndianControl & 0x40) != 0;
- public bool SetBigEndianControlX16Swap16 => (SetBigEndianControl & 0x80) != 0;
- public bool SetBigEndianControlX8Swap1 => (SetBigEndianControl & 0x100) != 0;
- public bool SetBigEndianControlX8Swap4 => (SetBigEndianControl & 0x200) != 0;
- public bool SetBigEndianControlX8Swap8 => (SetBigEndianControl & 0x400) != 0;
- public bool SetBigEndianControlX8Swap16 => (SetBigEndianControl & 0x800) != 0;
- public bool SetBigEndianControlI1X8Cga6Swap1 => (SetBigEndianControl & 0x1000) != 0;
- public bool SetBigEndianControlI1X8Cga6Swap4 => (SetBigEndianControl & 0x2000) != 0;
- public bool SetBigEndianControlI1X8Cga6Swap8 => (SetBigEndianControl & 0x4000) != 0;
- public bool SetBigEndianControlI1X8Cga6Swap16 => (SetBigEndianControl & 0x8000) != 0;
- public bool SetBigEndianControlI1X8LeSwap1 => (SetBigEndianControl & 0x10000) != 0;
- public bool SetBigEndianControlI1X8LeSwap4 => (SetBigEndianControl & 0x20000) != 0;
- public bool SetBigEndianControlI1X8LeSwap8 => (SetBigEndianControl & 0x40000) != 0;
- public bool SetBigEndianControlI1X8LeSwap16 => (SetBigEndianControl & 0x80000) != 0;
- public bool SetBigEndianControlI4Swap1 => (SetBigEndianControl & 0x100000) != 0;
- public bool SetBigEndianControlI4Swap4 => (SetBigEndianControl & 0x200000) != 0;
- public bool SetBigEndianControlI4Swap8 => (SetBigEndianControl & 0x400000) != 0;
- public bool SetBigEndianControlI4Swap16 => (SetBigEndianControl & 0x800000) != 0;
- public bool SetBigEndianControlI8Swap1 => (SetBigEndianControl & 0x1000000) != 0;
- public bool SetBigEndianControlI8Swap4 => (SetBigEndianControl & 0x2000000) != 0;
- public bool SetBigEndianControlI8Swap8 => (SetBigEndianControl & 0x4000000) != 0;
- public bool SetBigEndianControlI8Swap16 => (SetBigEndianControl & 0x8000000) != 0;
- public bool SetBigEndianControlOverride => (SetBigEndianControl & 0x10000000) != 0;
+ public readonly bool SetBigEndianControlX32Swap1 => (SetBigEndianControl & 0x1) != 0;
+ public readonly bool SetBigEndianControlX32Swap4 => (SetBigEndianControl & 0x2) != 0;
+ public readonly bool SetBigEndianControlX32Swap8 => (SetBigEndianControl & 0x4) != 0;
+ public readonly bool SetBigEndianControlX32Swap16 => (SetBigEndianControl & 0x8) != 0;
+ public readonly bool SetBigEndianControlX16Swap1 => (SetBigEndianControl & 0x10) != 0;
+ public readonly bool SetBigEndianControlX16Swap4 => (SetBigEndianControl & 0x20) != 0;
+ public readonly bool SetBigEndianControlX16Swap8 => (SetBigEndianControl & 0x40) != 0;
+ public readonly bool SetBigEndianControlX16Swap16 => (SetBigEndianControl & 0x80) != 0;
+ public readonly bool SetBigEndianControlX8Swap1 => (SetBigEndianControl & 0x100) != 0;
+ public readonly bool SetBigEndianControlX8Swap4 => (SetBigEndianControl & 0x200) != 0;
+ public readonly bool SetBigEndianControlX8Swap8 => (SetBigEndianControl & 0x400) != 0;
+ public readonly bool SetBigEndianControlX8Swap16 => (SetBigEndianControl & 0x800) != 0;
+ public readonly bool SetBigEndianControlI1X8Cga6Swap1 => (SetBigEndianControl & 0x1000) != 0;
+ public readonly bool SetBigEndianControlI1X8Cga6Swap4 => (SetBigEndianControl & 0x2000) != 0;
+ public readonly bool SetBigEndianControlI1X8Cga6Swap8 => (SetBigEndianControl & 0x4000) != 0;
+ public readonly bool SetBigEndianControlI1X8Cga6Swap16 => (SetBigEndianControl & 0x8000) != 0;
+ public readonly bool SetBigEndianControlI1X8LeSwap1 => (SetBigEndianControl & 0x10000) != 0;
+ public readonly bool SetBigEndianControlI1X8LeSwap4 => (SetBigEndianControl & 0x20000) != 0;
+ public readonly bool SetBigEndianControlI1X8LeSwap8 => (SetBigEndianControl & 0x40000) != 0;
+ public readonly bool SetBigEndianControlI1X8LeSwap16 => (SetBigEndianControl & 0x80000) != 0;
+ public readonly bool SetBigEndianControlI4Swap1 => (SetBigEndianControl & 0x100000) != 0;
+ public readonly bool SetBigEndianControlI4Swap4 => (SetBigEndianControl & 0x200000) != 0;
+ public readonly bool SetBigEndianControlI4Swap8 => (SetBigEndianControl & 0x400000) != 0;
+ public readonly bool SetBigEndianControlI4Swap16 => (SetBigEndianControl & 0x800000) != 0;
+ public readonly bool SetBigEndianControlI8Swap1 => (SetBigEndianControl & 0x1000000) != 0;
+ public readonly bool SetBigEndianControlI8Swap4 => (SetBigEndianControl & 0x2000000) != 0;
+ public readonly bool SetBigEndianControlI8Swap8 => (SetBigEndianControl & 0x4000000) != 0;
+ public readonly bool SetBigEndianControlI8Swap16 => (SetBigEndianControl & 0x8000000) != 0;
+ public readonly bool SetBigEndianControlOverride => (SetBigEndianControl & 0x10000000) != 0;
public fixed uint Reserved874[3];
public uint SetPixelsFromMemoryBlockShape;
- public SetPixelsFromMemoryBlockShapeV SetPixelsFromMemoryBlockShapeV => (SetPixelsFromMemoryBlockShapeV)(SetPixelsFromMemoryBlockShape & 0x7);
+ public readonly SetPixelsFromMemoryBlockShapeV SetPixelsFromMemoryBlockShapeV => (SetPixelsFromMemoryBlockShapeV)(SetPixelsFromMemoryBlockShape & 0x7);
public uint SetPixelsFromMemoryCorralSize;
- public int SetPixelsFromMemoryCorralSizeV => (int)(SetPixelsFromMemoryCorralSize & 0x3FF);
+ public readonly int SetPixelsFromMemoryCorralSizeV => (int)(SetPixelsFromMemoryCorralSize & 0x3FF);
public uint SetPixelsFromMemorySafeOverlap;
- public bool SetPixelsFromMemorySafeOverlapV => (SetPixelsFromMemorySafeOverlap & 0x1) != 0;
+ public readonly bool SetPixelsFromMemorySafeOverlapV => (SetPixelsFromMemorySafeOverlap & 0x1) != 0;
public uint SetPixelsFromMemorySampleMode;
- public SetPixelsFromMemorySampleModeOrigin SetPixelsFromMemorySampleModeOrigin => (SetPixelsFromMemorySampleModeOrigin)(SetPixelsFromMemorySampleMode & 0x1);
- public SetPixelsFromMemorySampleModeFilter SetPixelsFromMemorySampleModeFilter => (SetPixelsFromMemorySampleModeFilter)((SetPixelsFromMemorySampleMode >> 4) & 0x1);
+ public readonly SetPixelsFromMemorySampleModeOrigin SetPixelsFromMemorySampleModeOrigin => (SetPixelsFromMemorySampleModeOrigin)(SetPixelsFromMemorySampleMode & 0x1);
+ public readonly SetPixelsFromMemorySampleModeFilter SetPixelsFromMemorySampleModeFilter => (SetPixelsFromMemorySampleModeFilter)((SetPixelsFromMemorySampleMode >> 4) & 0x1);
public fixed uint Reserved890[8];
public uint SetPixelsFromMemoryDstX0;
public uint SetPixelsFromMemoryDstY0;
@@ -808,9 +808,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
public uint SetFalcon31;
public fixed uint Reserved960[291];
public uint MmeDmaWriteMethodBarrier;
- public bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0;
+ public readonly bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0;
public fixed uint ReservedDF0[2436];
- public MmeShadowScratch SetMmeShadowScratch;
+ public Array256<uint> SetMmeShadowScratch;
#pragma warning restore CS0649
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs
index c28da094..dd6b6900 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs
@@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// </summary>
struct TwodTexture
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public ColorFormat Format;
public Boolean32 LinearLayout;
public MemoryLayout MemoryLayout;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs
index c982347a..911ad53b 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/Boolean32.cs
@@ -3,10 +3,10 @@
/// <summary>
/// Boolean value, stored as a 32-bits integer in memory.
/// </summary>
- struct Boolean32
+ readonly struct Boolean32
{
-#pragma warning disable CS0649
- private uint _value;
+#pragma warning disable CS0649 // Field is never assigned to
+ private readonly uint _value;
#pragma warning restore CS0649
public static implicit operator bool(Boolean32 value)
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs
index 889b5c8b..c798384f 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs
@@ -9,58 +9,58 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
enum ColorFormat
{
R32G32B32A32Float = 0xc0,
- R32G32B32A32Sint = 0xc1,
- R32G32B32A32Uint = 0xc2,
+ R32G32B32A32Sint = 0xc1,
+ R32G32B32A32Uint = 0xc2,
R32G32B32X32Float = 0xc3,
- R32G32B32X32Sint = 0xc4,
- R32G32B32X32Uint = 0xc5,
+ R32G32B32X32Sint = 0xc4,
+ R32G32B32X32Uint = 0xc5,
R16G16B16X16Unorm = 0xc6,
R16G16B16X16Snorm = 0xc7,
- R16G16B16X16Sint = 0xc8,
- R16G16B16X16Uint = 0xc9,
+ R16G16B16X16Sint = 0xc8,
+ R16G16B16X16Uint = 0xc9,
R16G16B16A16Float = 0xca,
- R32G32Float = 0xcb,
- R32G32Sint = 0xcc,
- R32G32Uint = 0xcd,
+ R32G32Float = 0xcb,
+ R32G32Sint = 0xcc,
+ R32G32Uint = 0xcd,
R16G16B16X16Float = 0xce,
- B8G8R8A8Unorm = 0xcf,
- B8G8R8A8Srgb = 0xd0,
- R10G10B10A2Unorm = 0xd1,
- R10G10B10A2Uint = 0xd2,
- R8G8B8A8Unorm = 0xd5,
- R8G8B8A8Srgb = 0xd6,
- R8G8B8X8Snorm = 0xd7,
- R8G8B8X8Sint = 0xd8,
- R8G8B8X8Uint = 0xd9,
- R16G16Unorm = 0xda,
- R16G16Snorm = 0xdb,
- R16G16Sint = 0xdc,
- R16G16Uint = 0xdd,
- R16G16Float = 0xde,
- R11G11B10Float = 0xe0,
- R32Sint = 0xe3,
- R32Uint = 0xe4,
- R32Float = 0xe5,
- B8G8R8X8Unorm = 0xe6,
- B8G8R8X8Srgb = 0xe7,
- B5G6R5Unorm = 0xe8,
- B5G5R5A1Unorm = 0xe9,
- R8G8Unorm = 0xea,
- R8G8Snorm = 0xeb,
- R8G8Sint = 0xec,
- R8G8Uint = 0xed,
- R16Unorm = 0xee,
- R16Snorm = 0xef,
- R16Sint = 0xf0,
- R16Uint = 0xf1,
- R16Float = 0xf2,
- R8Unorm = 0xf3,
- R8Snorm = 0xf4,
- R8Sint = 0xf5,
- R8Uint = 0xf6,
- B5G5R5X1Unorm = 0xf8,
- R8G8B8X8Unorm = 0xf9,
- R8G8B8X8Srgb = 0xfa
+ B8G8R8A8Unorm = 0xcf,
+ B8G8R8A8Srgb = 0xd0,
+ R10G10B10A2Unorm = 0xd1,
+ R10G10B10A2Uint = 0xd2,
+ R8G8B8A8Unorm = 0xd5,
+ R8G8B8A8Srgb = 0xd6,
+ R8G8B8X8Snorm = 0xd7,
+ R8G8B8X8Sint = 0xd8,
+ R8G8B8X8Uint = 0xd9,
+ R16G16Unorm = 0xda,
+ R16G16Snorm = 0xdb,
+ R16G16Sint = 0xdc,
+ R16G16Uint = 0xdd,
+ R16G16Float = 0xde,
+ R11G11B10Float = 0xe0,
+ R32Sint = 0xe3,
+ R32Uint = 0xe4,
+ R32Float = 0xe5,
+ B8G8R8X8Unorm = 0xe6,
+ B8G8R8X8Srgb = 0xe7,
+ B5G6R5Unorm = 0xe8,
+ B5G5R5A1Unorm = 0xe9,
+ R8G8Unorm = 0xea,
+ R8G8Snorm = 0xeb,
+ R8G8Sint = 0xec,
+ R8G8Uint = 0xed,
+ R16Unorm = 0xee,
+ R16Snorm = 0xef,
+ R16Sint = 0xf0,
+ R16Uint = 0xf1,
+ R16Float = 0xf2,
+ R8Unorm = 0xf3,
+ R8Snorm = 0xf4,
+ R8Sint = 0xf5,
+ R8Uint = 0xf6,
+ B5G5R5X1Unorm = 0xf8,
+ R8G8B8X8Unorm = 0xf9,
+ R8G8B8X8Srgb = 0xfa,
}
static class ColorFormatConverter
@@ -74,6 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
{
return format switch
{
+#pragma warning disable IDE0055 // Disable formatting
ColorFormat.R32G32B32A32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16, 4),
ColorFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4),
ColorFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4),
@@ -127,7 +128,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
ColorFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2, 4),
ColorFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4),
ColorFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4),
- _ => FormatInfo.Default
+ _ => FormatInfo.Default,
+#pragma warning restore IDE0055
};
}
@@ -157,9 +159,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
case ColorFormat.R8G8B8X8Unorm:
case ColorFormat.R8G8B8X8Srgb:
return true;
+ default:
+ return false;
}
-
- return false;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs
index 839faac9..b3b0c41a 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs
@@ -5,7 +5,7 @@
/// </summary>
struct GpuVa
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint High;
public uint Low;
#pragma warning restore CS0649
@@ -14,7 +14,7 @@
/// Packs the split address into a 64-bits address value.
/// </summary>
/// <returns>The 64-bits address value</returns>
- public ulong Pack()
+ public readonly ulong Pack()
{
return Low | ((ulong)High << 32);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs
index 6da96bd4..5a425373 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs
@@ -5,31 +5,31 @@
/// </summary>
struct MemoryLayout
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint Packed;
#pragma warning restore CS0649
- public int UnpackGobBlocksInX()
+ public readonly int UnpackGobBlocksInX()
{
return 1 << (int)(Packed & 0xf);
}
- public int UnpackGobBlocksInY()
+ public readonly int UnpackGobBlocksInY()
{
return 1 << (int)((Packed >> 4) & 0xf);
}
- public int UnpackGobBlocksInZ()
+ public readonly int UnpackGobBlocksInZ()
{
return 1 << (int)((Packed >> 8) & 0xf);
}
- public bool UnpackIsLinear()
+ public readonly bool UnpackIsLinear()
{
return (Packed & 0x1000) != 0;
}
- public bool UnpackIsTarget3D()
+ public readonly bool UnpackIsTarget3D()
{
return (Packed & 0x10000) != 0;
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs
index dae63124..5abbc923 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/PrimitiveType.cs
@@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
LineStripAdjacency,
TrianglesAdjacency,
TriangleStripAdjacency,
- Patches
+ Patches,
}
/// <summary>
@@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
LineStripAdjacency = 11,
TrianglesAdjacency = 12,
TriangleStripAdjacency = 13,
- Patches = 14
+ Patches = 14,
}
static class PrimitiveTypeConverter
@@ -53,6 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
{
return type switch
{
+#pragma warning disable IDE0055 // Disable formatting
PrimitiveType.Points => PrimitiveTopology.Points,
PrimitiveType.Lines => PrimitiveTopology.Lines,
PrimitiveType.LineLoop => PrimitiveTopology.LineLoop,
@@ -68,7 +69,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
PrimitiveType.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency,
PrimitiveType.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency,
PrimitiveType.Patches => PrimitiveTopology.Patches,
- _ => PrimitiveTopology.Triangles
+ _ => PrimitiveTopology.Triangles,
+#pragma warning restore IDE0055
};
}
@@ -81,6 +83,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
{
return type switch
{
+#pragma warning disable IDE0055 // Disable formatting
PrimitiveTypeOverride.Points => PrimitiveTopology.Points,
PrimitiveTypeOverride.Lines => PrimitiveTopology.Lines,
PrimitiveTypeOverride.LineStrip => PrimitiveTopology.LineStrip,
@@ -92,8 +95,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
PrimitiveTypeOverride.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency,
PrimitiveTypeOverride.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency,
PrimitiveTypeOverride.Patches => PrimitiveTopology.Patches,
- _ => PrimitiveTopology.Triangles
+ _ => PrimitiveTopology.Triangles,
+#pragma warning restore IDE0055
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs
index 839a4d0a..22fe4a92 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SamplerIndex.cs
@@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
/// </summary>
enum SamplerIndex
{
- Independently = 0,
- ViaHeaderIndex = 1
+ Independently = 0,
+ ViaHeaderIndex = 1,
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs
index c457dbf9..e92263df 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs
@@ -5,14 +5,14 @@
/// </summary>
struct SbDescriptor
{
-#pragma warning disable CS0649
+#pragma warning disable CS0649 // Field is never assigned to
public uint AddressLow;
public uint AddressHigh;
public int Size;
public int Padding;
#pragma warning restore CS0649
- public ulong PackAddress()
+ public readonly ulong PackAddress()
{
return AddressLow | ((ulong)AddressHigh << 32);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs
index 1de1621f..0fa073d7 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/ZetaFormat.cs
@@ -8,13 +8,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
/// </summary>
enum ZetaFormat
{
- D32Float = 0xa,
- D16Unorm = 0x13,
+ D32Float = 0xa,
+ D16Unorm = 0x13,
D24UnormS8Uint = 0x14,
- D24Unorm = 0x15,
+ D24Unorm = 0x15,
S8UintD24Unorm = 0x16,
- S8Uint = 0x17,
- D32FloatS8Uint = 0x19
+ S8Uint = 0x17,
+ D32FloatS8Uint = 0x19,
}
static class ZetaFormatConverter
@@ -28,6 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
{
return format switch
{
+#pragma warning disable IDE0055 // Disable formatting
ZetaFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4, 1),
ZetaFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2, 1),
ZetaFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2),
@@ -35,7 +36,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
ZetaFormat.S8UintD24Unorm => new FormatInfo(Format.S8UintD24Unorm, 1, 1, 4, 2),
ZetaFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1, 1),
ZetaFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8, 2),
- _ => FormatInfo.Default
+ _ => FormatInfo.Default,
+#pragma warning restore IDE0055
};
}
}