aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Engine/Threed
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/Threed
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/Threed')
-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
16 files changed, 177 insertions, 169 deletions
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
}
}