diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2023-10-28 16:47:23 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2023-10-28 16:47:23 +0200 |
| commit | ff4eddb31a156fa9103058a715ef6af0c6ab1743 (patch) | |
| tree | 978d7beac6211ff8bb4ffaa8ac9181193c25cd4f /vulkan/PNext.cs | |
| parent | b65719d05fc71b2b631334fbc06da58963769063 (diff) | |
v0.5.1 save commitv0.5.1
Diffstat (limited to 'vulkan/PNext.cs')
| -rw-r--r-- | vulkan/PNext.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vulkan/PNext.cs b/vulkan/PNext.cs index 783e757..9ca9709 100644 --- a/vulkan/PNext.cs +++ b/vulkan/PNext.cs @@ -27,6 +27,24 @@ namespace Vulkan init(); Marshal.WriteIntPtr(handle + 4, pNext); } + /// <summary> + /// Allocate on HGlobal a new structure of type T and set current value + /// ensure instance is Disposed. + /// </summary> + public PNext (T instance) { + handle = Marshal.AllocHGlobal(Marshal.SizeOf<T>()); + Marshal.StructureToPtr(instance, handle, false); + } + /// <summary> + /// Allocate on HGlobal a new structure of type T set current value and + /// the PNext field. + /// ensure instance is Disposed. + /// </summary> + public PNext (T instance, IntPtr pNext) { + handle = Marshal.AllocHGlobal(Marshal.SizeOf<T>()); + Marshal.StructureToPtr(instance, handle, false); + Marshal.WriteIntPtr(handle + 4, pNext); + } void init() { handle = Marshal.AllocHGlobal(Marshal.SizeOf<T>()); Type t = typeof(T); |