/// <summary> /// /// </summary> public static unsafe void BindImageMemory2(this SharpVk.Device extendedHandle, SharpVk.Khronos.Experimental.BindImageMemoryInfo[] bindInfos) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *marshalledBindInfos = default(SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *); commandCache = extendedHandle.commandCache; if (bindInfos != null) { var fieldPointer = (SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo>(bindInfos.Length).ToPointer()); for (int index = 0; index < (uint)(bindInfos.Length); index++) { bindInfos[index].MarshalTo(&fieldPointer[index]); } marshalledBindInfos = fieldPointer; } else { marshalledBindInfos = null; } SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate>("vkBindImageMemory2KHX", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, (uint)(bindInfos?.Length ?? 0), marshalledBindInfos); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Bind device memory to image objects. /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> public static unsafe void BindImageMemory2(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Khronos.Experimental.BindImageMemoryInfo>?bindInfos) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *marshalledBindInfos = default(SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *); commandCache = extendedHandle.commandCache; if (bindInfos.IsNull()) { marshalledBindInfos = null; } else { if (bindInfos.Value.Contents == ProxyContents.Single) { marshalledBindInfos = (SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo>()); bindInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *)(marshalledBindInfos)); } else { var fieldPointer = (SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo>(Interop.HeapUtil.GetLength(bindInfos.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(bindInfos.Value)); index++) { bindInfos.Value[index].MarshalTo(&fieldPointer[index]); } marshalledBindInfos = fieldPointer; } } SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate>("vkBindImageMemory2KHX", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(bindInfos)), marshalledBindInfos); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> internal unsafe void MarshalTo(SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *pointer) { pointer->SType = StructureType.BindImageMemoryInfoKhx; pointer->Next = null; pointer->Image = this.Image?.handle ?? default(SharpVk.Interop.Image); pointer->Memory = this.Memory?.handle ?? default(SharpVk.Interop.DeviceMemory); pointer->MemoryOffset = this.MemoryOffset; pointer->DeviceIndexCount = (uint)(Interop.HeapUtil.GetLength(this.DeviceIndices)); if (this.DeviceIndices != null) { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(this.DeviceIndices.Length).ToPointer()); for (int index = 0; index < (uint)(this.DeviceIndices.Length); index++) { fieldPointer[index] = this.DeviceIndices[index]; } pointer->DeviceIndices = fieldPointer; } else { pointer->DeviceIndices = null; } pointer->SFRRectCount = (uint)(Interop.HeapUtil.GetLength(this.SFRRects)); if (this.SFRRects != null) { var fieldPointer = (SharpVk.Rect2D *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Rect2D>(this.SFRRects.Length).ToPointer()); for (int index = 0; index < (uint)(this.SFRRects.Length); index++) { fieldPointer[index] = this.SFRRects[index]; } pointer->SFRRects = fieldPointer; } else { pointer->SFRRects = null; } }