aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/BufferHandle.cs
diff options
context:
space:
mode:
authorAndrey Sukharev <SukharevAndrey@users.noreply.github.com>2022-12-05 16:47:39 +0300
committerGitHub <noreply@github.com>2022-12-05 14:47:39 +0100
commit4da44e09cb2a32f69b4a6b47221117b78e4618dc (patch)
treec3648a09202374dabff6fac472fe341bf9e1f0ee /Ryujinx.Graphics.GAL/BufferHandle.cs
parentae13f0ab4da5b371bba746c1bd6598baaa44585d (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.GAL/BufferHandle.cs')
-rw-r--r--Ryujinx.Graphics.GAL/BufferHandle.cs12
1 files changed, 2 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.GAL/BufferHandle.cs b/Ryujinx.Graphics.GAL/BufferHandle.cs
index 49f83442..5ba50d19 100644
--- a/Ryujinx.Graphics.GAL/BufferHandle.cs
+++ b/Ryujinx.Graphics.GAL/BufferHandle.cs
@@ -1,22 +1,14 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.GAL
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
- public struct BufferHandle : IEquatable<BufferHandle>
+ public readonly record struct BufferHandle
{
private readonly ulong _value;
public static BufferHandle Null => new BufferHandle(0);
private BufferHandle(ulong value) => _value = value;
-
- public override bool Equals(object obj) => obj is BufferHandle handle && Equals(handle);
- public bool Equals([AllowNull] BufferHandle other) => other._value == _value;
- public override int GetHashCode() => _value.GetHashCode();
- public static bool operator ==(BufferHandle left, BufferHandle right) => left.Equals(right);
- public static bool operator !=(BufferHandle left, BufferHandle right) => !(left == right);
}
}