diff options
Diffstat (limited to 'vulkan/BindingsHelpers.cs')
| -rw-r--r-- | vulkan/BindingsHelpers.cs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/vulkan/BindingsHelpers.cs b/vulkan/BindingsHelpers.cs deleted file mode 100644 index 60a4ae2..0000000 --- a/vulkan/BindingsHelpers.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2017 Eric Mellino -// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Text; - -namespace Vulkan { - public static class BindingsHelpers - { - public static unsafe StringHandle StringToHGlobalUtf8(string s) - { - Debug.Assert(s != null); - int byteCount = Encoding.UTF8.GetByteCount(s); - IntPtr retPtr = Marshal.AllocHGlobal(byteCount); - fixed (char* stringPtr = s) - { - Encoding.UTF8.GetBytes(stringPtr, s.Length, (byte*)retPtr.ToPointer(), byteCount); - } - - return new StringHandle() { Handle = retPtr }; - } - - public static void FreeHGlobal(StringHandle ptr) - { - Marshal.FreeHGlobal(ptr.Handle); - } - } - - public struct StringHandle - { - public IntPtr Handle; - } -} |