From ff4eddb31a156fa9103058a715ef6af0c6ab1743 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Sat, 28 Oct 2023 16:47:23 +0200 Subject: v0.5.1 save commit --- vulkan/PNext.cs | 18 ++++++++++++++++++ vulkan/vulkan.csproj | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) 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); } + /// + /// Allocate on HGlobal a new structure of type T and set current value + /// ensure instance is Disposed. + /// + public PNext (T instance) { + handle = Marshal.AllocHGlobal(Marshal.SizeOf()); + Marshal.StructureToPtr(instance, handle, false); + } + /// + /// Allocate on HGlobal a new structure of type T set current value and + /// the PNext field. + /// ensure instance is Disposed. + /// + public PNext (T instance, IntPtr pNext) { + handle = Marshal.AllocHGlobal(Marshal.SizeOf()); + Marshal.StructureToPtr(instance, handle, false); + Marshal.WriteIntPtr(handle + 4, pNext); + } void init() { handle = Marshal.AllocHGlobal(Marshal.SizeOf()); Type t = typeof(T); diff --git a/vulkan/vulkan.csproj b/vulkan/vulkan.csproj index 209502d..84ec7bd 100644 --- a/vulkan/vulkan.csproj +++ b/vulkan/vulkan.csproj @@ -3,7 +3,7 @@ netstandard2.1 - 0.5.0 + 0.5.1 Vulkan $(AssemblyVersion) -- cgit v1.3.1-4-g156e