From 5011640b3086b86b0f0b39b60fdb2aa946d4f5c8 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 23 May 2020 06:46:09 -0300 Subject: Spanify Graphics Abstraction Layer (#1226) * Spanify Graphics Abstraction Layer * Be explicit about BufferHandle size --- Ryujinx.Graphics.OpenGL/Handle.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Ryujinx.Graphics.OpenGL/Handle.cs (limited to 'Ryujinx.Graphics.OpenGL/Handle.cs') diff --git a/Ryujinx.Graphics.OpenGL/Handle.cs b/Ryujinx.Graphics.OpenGL/Handle.cs new file mode 100644 index 00000000..4b2f05e6 --- /dev/null +++ b/Ryujinx.Graphics.OpenGL/Handle.cs @@ -0,0 +1,23 @@ +using Ryujinx.Graphics.GAL; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace Ryujinx.Graphics.OpenGL +{ + static class Handle + { + public static T FromInt32(int handle) where T : unmanaged + { + Debug.Assert(Unsafe.SizeOf() == sizeof(ulong)); + + ulong handle64 = (uint)handle; + + return Unsafe.As(ref handle64); + } + + public static int ToInt32(this BufferHandle handle) + { + return (int)Unsafe.As(ref handle); + } + } +} -- cgit v1.2.3