Spanify Graphics Abstraction Layer (#1226)

* Spanify Graphics Abstraction Layer

* Be explicit about BufferHandle size
This commit is contained in:
gdkchan 2020-05-23 06:46:09 -03:00 committed by GitHub
parent cc8dbdd3fb
commit 5011640b30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 208 additions and 134 deletions

View file

@ -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<T>(int handle) where T : unmanaged
{
Debug.Assert(Unsafe.SizeOf<T>() == sizeof(ulong));
ulong handle64 = (uint)handle;
return Unsafe.As<ulong, T>(ref handle64);
}
public static int ToInt32(this BufferHandle handle)
{
return (int)Unsafe.As<BufferHandle, ulong>(ref handle);
}
}
}