/// <summary> /// /// </summary> public unsafe void BindSparse(SharpVk.BindSparseInfo[] bindInfo, SharpVk.Fence fence) { try { SharpVk.Interop.BindSparseInfo *marshalledBindInfo = default(SharpVk.Interop.BindSparseInfo *); if (bindInfo != null) { var fieldPointer = (SharpVk.Interop.BindSparseInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.BindSparseInfo>(bindInfo.Length).ToPointer()); for (int index = 0; index < (uint)(bindInfo.Length); index++) { bindInfo[index].MarshalTo(&fieldPointer[index]); } marshalledBindInfo = fieldPointer; } else { marshalledBindInfo = null; } Result methodResult = Interop.Commands.vkQueueBindSparse(this.handle, (uint)(bindInfo?.Length ?? 0), marshalledBindInfo, fence?.handle ?? default(SharpVk.Interop.Fence)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void Submit(SharpVk.SubmitInfo[] submits, SharpVk.Fence fence) { try { SharpVk.Interop.SubmitInfo *marshalledSubmits = default(SharpVk.Interop.SubmitInfo *); if (submits != null) { var fieldPointer = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.SubmitInfo>(submits.Length).ToPointer()); for (int index = 0; index < (uint)(submits.Length); index++) { submits[index].MarshalTo(&fieldPointer[index]); } marshalledSubmits = fieldPointer; } else { marshalledSubmits = null; } Result methodResult = Interop.Commands.vkQueueSubmit(this.handle, (uint)(submits?.Length ?? 0), marshalledSubmits, fence?.handle ?? default(SharpVk.Interop.Fence)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe SharpVk.Fence RegisterDisplayEvent(this SharpVk.Device extendedHandle, SharpVk.Khronos.Display display, SharpVk.Multivendor.DisplayEventInfo displayEventInfo, SharpVk.AllocationCallbacks allocator) { try { SharpVk.Fence result = default(SharpVk.Fence); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DisplayEventInfo *marshalledDisplayEventInfo = default(SharpVk.Interop.Multivendor.DisplayEventInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence); commandCache = extendedHandle.commandCache; marshalledDisplayEventInfo = (SharpVk.Interop.Multivendor.DisplayEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DisplayEventInfo>()); displayEventInfo.MarshalTo(marshalledDisplayEventInfo); marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.MarshalTo(marshalledAllocator); SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate>("vkRegisterDisplayEventEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledDisplayEventInfo, marshalledAllocator, &marshalledFence); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Fence(extendedHandle, marshalledFence); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Signal a fence when a device event occurs. /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="deviceEventInfo"> /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Fence RegisterEvent(this SharpVk.Device extendedHandle, SharpVk.Multivendor.DeviceEventInfo deviceEventInfo, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Fence result = default(SharpVk.Fence); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DeviceEventInfo *marshalledDeviceEventInfo = default(SharpVk.Interop.Multivendor.DeviceEventInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence); commandCache = extendedHandle.commandCache; marshalledDeviceEventInfo = (SharpVk.Interop.Multivendor.DeviceEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DeviceEventInfo>()); deviceEventInfo.MarshalTo(marshalledDeviceEventInfo); if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.Multivendor.VkDeviceRegisterEventDelegate commandDelegate = commandCache.Cache.vkRegisterDeviceEventEXT; Result methodResult = commandDelegate(extendedHandle.handle, marshalledDeviceEventInfo, marshalledAllocator, &marshalledFence); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Fence(extendedHandle, marshalledFence); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Submits a sequence of semaphores or command buffers to a queue. /// </summary> /// <param name="submits"> /// </param> public unsafe void Submit(ArrayProxy <SharpVk.SubmitInfo>?submits, SharpVk.Fence fence) { try { SharpVk.Interop.SubmitInfo *marshalledSubmits = default(SharpVk.Interop.SubmitInfo *); if (submits.IsNull()) { marshalledSubmits = null; } else { if (submits.Value.Contents == ProxyContents.Single) { marshalledSubmits = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.SubmitInfo>()); submits.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.SubmitInfo *)(marshalledSubmits)); } else { var fieldPointer = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.SubmitInfo>(Interop.HeapUtil.GetLength(submits.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(submits.Value)); index++) { submits.Value[index].MarshalTo(&fieldPointer[index]); } marshalledSubmits = fieldPointer; } } SharpVk.Interop.VkQueueSubmitDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueueSubmitDelegate>("vkQueueSubmit", ""); Result methodResult = commandDelegate(this.handle, (uint)(Interop.HeapUtil.GetLength(submits)), marshalledSubmits, fence?.handle ?? default(SharpVk.Interop.Fence)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Bind device memory to a sparse resource object. /// </summary> /// <param name="bindInfo"> /// </param> public unsafe void BindSparse(ArrayProxy<SharpVk.BindSparseInfo>? bindInfo, SharpVk.Fence fence) { try { SharpVk.Interop.BindSparseInfo* marshalledBindInfo = default(SharpVk.Interop.BindSparseInfo*); if (bindInfo.IsNull()) { marshalledBindInfo = null; } else { if (bindInfo.Value.Contents == ProxyContents.Single) { marshalledBindInfo = (SharpVk.Interop.BindSparseInfo*)(Interop.HeapUtil.Allocate<SharpVk.Interop.BindSparseInfo>()); bindInfo.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.BindSparseInfo*)(marshalledBindInfo)); } else { var fieldPointer = (SharpVk.Interop.BindSparseInfo*)(Interop.HeapUtil.AllocateAndClear<SharpVk.Interop.BindSparseInfo>(Interop.HeapUtil.GetLength(bindInfo.Value)).ToPointer()); for(int index = 0; index < (uint)(Interop.HeapUtil.GetLength(bindInfo.Value)); index++) { bindInfo.Value[index].MarshalTo(&fieldPointer[index]); } marshalledBindInfo = fieldPointer; } } SharpVk.Interop.VkQueueBindSparseDelegate commandDelegate = commandCache.Cache.vkQueueBindSparse; Result methodResult = commandDelegate(this.handle, (uint)(Interop.HeapUtil.GetLength(bindInfo)), marshalledBindInfo, fence?.handle ?? default(SharpVk.Interop.Fence)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Retrieve the index of the next available presentable image. /// </summary> /// <param name="timeout"> /// Indicates how long the function waits, in nanoseconds, if no image /// is available. /// </param> /// <param name="semaphore"> /// Null or a semaphore to signal. /// </param> /// <param name="fence"> /// Null or a fence to signal. /// </param> public unsafe uint AcquireNextImage(ulong timeout, SharpVk.Semaphore semaphore, SharpVk.Fence fence) { try { uint result = default(uint); uint marshalledImageIndex = default(uint); SharpVk.Interop.Khronos.VkSwapchainKHRAcquireNextImageDelegate commandDelegate = commandCache.Cache.vkAcquireNextImageKHR; Result methodResult = commandDelegate(this.parent.handle, this.handle, timeout, semaphore?.handle ?? default(SharpVk.Interop.Semaphore), fence?.handle ?? default(SharpVk.Interop.Fence), &marshalledImageIndex); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledImageIndex; return(result); } finally { Interop.HeapUtil.FreeAll(); } }