aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/BufferHandle.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.GAL/BufferHandle.cs')
-rw-r--r--Ryujinx.Graphics.GAL/BufferHandle.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.GAL/BufferHandle.cs b/Ryujinx.Graphics.GAL/BufferHandle.cs
new file mode 100644
index 00000000..49f83442
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/BufferHandle.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Graphics.GAL
+{
+ [StructLayout(LayoutKind.Sequential, Size = 8)]
+ public struct BufferHandle : IEquatable<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);
+ }
+}