diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-12-04 04:35:41 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-12-04 04:35:41 +0100 |
| commit | d0bc93bb44e56ad29ae5e3c5b4e79ef624f82ba8 (patch) | |
| tree | 5d85c2cf93e7d28f2064a2022c4ab43d548657e0 /vulkan/ExtensionMethods.cs | |
| parent | ba592ca9099fe4e378692bd2e8c953de90a4beb5 (diff) | |
object.PinPointer
Diffstat (limited to 'vulkan/ExtensionMethods.cs')
| -rw-r--r-- | vulkan/ExtensionMethods.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vulkan/ExtensionMethods.cs b/vulkan/ExtensionMethods.cs index 4102f07..6f31329 100644 --- a/vulkan/ExtensionMethods.cs +++ b/vulkan/ExtensionMethods.cs @@ -74,6 +74,12 @@ namespace Vulkan { handles.Add (hnd.AddrOfPinnedObject (), hnd); return hnd.AddrOfPinnedObject (); } + public static IntPtr PinPointer (this object obj) { + GCHandle hnd = GCHandle.Alloc (obj, GCHandleType.Pinned); + handles.Add (hnd.AddrOfPinnedObject (), hnd); + return hnd.AddrOfPinnedObject (); + } + //pin with pinning context public static IntPtr Pin (this object obj, PinnedObjects ctx) { |