diff options
| author | Andrey Sukharev <SukharevAndrey@users.noreply.github.com> | 2022-12-05 16:47:39 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-05 14:47:39 +0100 |
| commit | 4da44e09cb2a32f69b4a6b47221117b78e4618dc (patch) | |
| tree | c3648a09202374dabff6fac472fe341bf9e1f0ee /Ryujinx.Graphics.Shader/Decoders | |
| parent | ae13f0ab4da5b371bba746c1bd6598baaa44585d (diff) | |
Make structs readonly when applicable (#4002)
* Make all structs readonly when applicable. It should reduce amount of needless defensive copies
* Make structs with trivial boilerplate equality code record structs
* Remove unnecessary readonly modifiers from TextureCreateInfo
* Make BitMap structs readonly too
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Block.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Decoder.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/InstTable.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Register.cs | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/Block.cs b/Ryujinx.Graphics.Shader/Decoders/Block.cs index ddd81cc5..7d94e3f9 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Block.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Block.cs @@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Shader.Decoders } } - struct SyncTarget + readonly struct SyncTarget { public PushOpInfo PushOpInfo { get; } public int PushOpId { get; } diff --git a/Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs b/Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs index 80de41d7..2dd60155 100644 --- a/Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs +++ b/Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Ryujinx.Graphics.Shader.Decoders { - struct DecodedProgram : IEnumerable<DecodedFunction> + readonly struct DecodedProgram : IEnumerable<DecodedFunction> { public DecodedFunction MainFunction { get; } private readonly IReadOnlyDictionary<ulong, DecodedFunction> _functions; diff --git a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs index 9dafb089..380c425e 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs @@ -473,7 +473,7 @@ namespace Ryujinx.Graphics.Shader.Decoders op = Unsafe.As<ulong, T>(ref rawOp); } - private struct BlockLocation + private readonly struct BlockLocation { public Block Block { get; } public int Index { get; } diff --git a/Ryujinx.Graphics.Shader/Decoders/InstTable.cs b/Ryujinx.Graphics.Shader/Decoders/InstTable.cs index 0a64632e..911f1581 100644 --- a/Ryujinx.Graphics.Shader/Decoders/InstTable.cs +++ b/Ryujinx.Graphics.Shader/Decoders/InstTable.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Shader.Decoders { private const int EncodingBits = 14; - private struct TableEntry + private readonly struct TableEntry { public InstName Name { get; } public InstEmitter Emitter { get; } diff --git a/Ryujinx.Graphics.Shader/Decoders/Register.cs b/Ryujinx.Graphics.Shader/Decoders/Register.cs index 30840d8c..e375096d 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Register.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Register.cs @@ -2,7 +2,7 @@ using System; namespace Ryujinx.Graphics.Shader.Decoders { - struct Register : IEquatable<Register> + readonly struct Register : IEquatable<Register> { public int Index { get; } |
