aboutsummaryrefslogtreecommitdiffstatsci
path: root/vulkan/PNext.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2023-10-28 16:47:23 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2023-10-28 16:47:23 +0200
commitff4eddb31a156fa9103058a715ef6af0c6ab1743 (patch)
tree978d7beac6211ff8bb4ffaa8ac9181193c25cd4f /vulkan/PNext.cs
parentb65719d05fc71b2b631334fbc06da58963769063 (diff)
v0.5.1 save commitv0.5.1
Diffstat (limited to 'vulkan/PNext.cs')
-rw-r--r--vulkan/PNext.cs18
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);