/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe SharpVk.NVidia.CheckpointData[] GetCheckpointData(this SharpVk.Queue extendedHandle) { try { SharpVk.NVidia.CheckpointData[] result = default(SharpVk.NVidia.CheckpointData[]); uint marshalledCheckpointDataCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.CheckpointData *marshalledCheckpointData = default(SharpVk.Interop.NVidia.CheckpointData *); commandCache = extendedHandle.commandCache; SharpVk.Interop.NVidia.VkQueueGetCheckpointDataDelegate commandDelegate = commandCache.Cache.vkGetQueueCheckpointDataNV; commandDelegate(extendedHandle.handle, &marshalledCheckpointDataCount, marshalledCheckpointData); marshalledCheckpointData = (SharpVk.Interop.NVidia.CheckpointData *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.CheckpointData>((uint)(marshalledCheckpointDataCount))); commandDelegate(extendedHandle.handle, &marshalledCheckpointDataCount, marshalledCheckpointData); if (marshalledCheckpointData != null) { var fieldPointer = new SharpVk.NVidia.CheckpointData[(uint)(marshalledCheckpointDataCount)]; for (int index = 0; index < (uint)(marshalledCheckpointDataCount); index++) { fieldPointer[index] = SharpVk.NVidia.CheckpointData.MarshalFrom(&marshalledCheckpointData[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void EndDebugUtilsLabel(this SharpVk.Queue extendedHandle) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkQueueEndDebugUtilsLabelDelegate commandDelegate = commandCache.Cache.vkQueueEndDebugUtilsLabelEXT; commandDelegate(extendedHandle.handle); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void InsertDebugUtilsLabel(this SharpVk.Queue extendedHandle, SharpVk.Multivendor.DebugUtilsLabel labelInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugUtilsLabel *marshalledLabelInfo = default(SharpVk.Interop.Multivendor.DebugUtilsLabel *); commandCache = extendedHandle.commandCache; marshalledLabelInfo = (SharpVk.Interop.Multivendor.DebugUtilsLabel *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsLabel>()); labelInfo.MarshalTo(marshalledLabelInfo); SharpVk.Interop.Multivendor.VkQueueInsertDebugUtilsLabelDelegate commandDelegate = commandCache.Cache.vkQueueInsertDebugUtilsLabelEXT; commandDelegate(extendedHandle.handle, marshalledLabelInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void SetPerformanceConfiguration(this SharpVk.Queue extendedHandle, SharpVk.Intel.PerformanceConfiguration configuration) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Intel.VkQueueSetPerformanceConfigurationDelegate commandDelegate = commandCache.Cache.vkQueueSetPerformanceConfigurationINTEL; Result methodResult = commandDelegate(extendedHandle.handle, configuration?.handle ?? default(SharpVk.Interop.Intel.PerformanceConfiguration)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Queue an image for presentation. /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> /// <param name="waitSemaphores"> /// </param> /// <param name="swapchains"> /// </param> /// <param name="imageIndices"> /// </param> /// <param name="results"> /// </param> /// <param name="displayPresentInfoKhr"> /// Extension struct /// </param> /// <param name="presentRegionsKhr"> /// Extension struct /// </param> /// <param name="deviceGroupPresentInfoKhr"> /// Extension struct /// </param> /// <param name="presentTimesInfoGoogle"> /// Extension struct /// </param> /// <param name="presentFrameTokenGgp"> /// Extension struct /// </param> public static unsafe Result Present(this SharpVk.Queue extendedHandle, ArrayProxy <SharpVk.Semaphore>?waitSemaphores, ArrayProxy <SharpVk.Khronos.Swapchain>?swapchains, ArrayProxy <uint>?imageIndices, ArrayProxy <SharpVk.Result>?results = null, SharpVk.Khronos.DisplayPresentInfo?displayPresentInfoKhr = null, SharpVk.Khronos.PresentRegions?presentRegionsKhr = null, SharpVk.Khronos.DeviceGroupPresentInfo?deviceGroupPresentInfoKhr = null, SharpVk.Google.PresentTimesInfo?presentTimesInfoGoogle = null, SharpVk.Ggp.PresentFrameToken?presentFrameTokenGgp = null) { try { Result result = default(Result); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PresentInfo *marshalledPresentInfo = default(SharpVk.Interop.Khronos.PresentInfo *); void *nextPointer = default(void *); if (displayPresentInfoKhr != null) { SharpVk.Interop.Khronos.DisplayPresentInfo *extensionPointer = default(SharpVk.Interop.Khronos.DisplayPresentInfo *); extensionPointer = (SharpVk.Interop.Khronos.DisplayPresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayPresentInfo>()); displayPresentInfoKhr.Value.MarshalTo(extensionPointer); extensionPointer->Next = nextPointer; nextPointer = extensionPointer; } if (presentRegionsKhr != null) { SharpVk.Interop.Khronos.PresentRegions *extensionPointer = default(SharpVk.Interop.Khronos.PresentRegions *); extensionPointer = (SharpVk.Interop.Khronos.PresentRegions *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentRegions>()); presentRegionsKhr.Value.MarshalTo(extensionPointer); extensionPointer->Next = nextPointer; nextPointer = extensionPointer; } if (deviceGroupPresentInfoKhr != null) { SharpVk.Interop.Khronos.DeviceGroupPresentInfo *extensionPointer = default(SharpVk.Interop.Khronos.DeviceGroupPresentInfo *); extensionPointer = (SharpVk.Interop.Khronos.DeviceGroupPresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DeviceGroupPresentInfo>()); deviceGroupPresentInfoKhr.Value.MarshalTo(extensionPointer); extensionPointer->Next = nextPointer; nextPointer = extensionPointer; } if (presentTimesInfoGoogle != null) { SharpVk.Interop.Google.PresentTimesInfo *extensionPointer = default(SharpVk.Interop.Google.PresentTimesInfo *); extensionPointer = (SharpVk.Interop.Google.PresentTimesInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Google.PresentTimesInfo>()); presentTimesInfoGoogle.Value.MarshalTo(extensionPointer); extensionPointer->Next = nextPointer; nextPointer = extensionPointer; } if (presentFrameTokenGgp != null) { SharpVk.Interop.Ggp.PresentFrameToken *extensionPointer = default(SharpVk.Interop.Ggp.PresentFrameToken *); extensionPointer = (SharpVk.Interop.Ggp.PresentFrameToken *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Ggp.PresentFrameToken>()); presentFrameTokenGgp.Value.MarshalTo(extensionPointer); extensionPointer->Next = nextPointer; nextPointer = extensionPointer; } commandCache = extendedHandle.commandCache; marshalledPresentInfo = (SharpVk.Interop.Khronos.PresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentInfo>()); marshalledPresentInfo->SType = StructureType.PresentInfo; marshalledPresentInfo->Next = nextPointer; marshalledPresentInfo->WaitSemaphoreCount = (uint)(Interop.HeapUtil.GetLength(waitSemaphores)); if (waitSemaphores.IsNull()) { marshalledPresentInfo->WaitSemaphores = null; } else { if (waitSemaphores.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->WaitSemaphores = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Semaphore>()); *(SharpVk.Interop.Semaphore *)(marshalledPresentInfo->WaitSemaphores) = waitSemaphores.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Semaphore); } else { var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(Interop.HeapUtil.GetLength(waitSemaphores.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(waitSemaphores.Value)); index++) { fieldPointer[index] = waitSemaphores.Value[index]?.handle ?? default(SharpVk.Interop.Semaphore); } marshalledPresentInfo->WaitSemaphores = fieldPointer; } } marshalledPresentInfo->SwapchainCount = (uint)(Interop.HeapUtil.GetLength(swapchains)); if (swapchains.IsNull()) { marshalledPresentInfo->Swapchains = null; } else { if (swapchains.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->Swapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>()); *(SharpVk.Interop.Khronos.Swapchain *)(marshalledPresentInfo->Swapchains) = swapchains.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } else { var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(Interop.HeapUtil.GetLength(swapchains.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(swapchains.Value)); index++) { fieldPointer[index] = swapchains.Value[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } marshalledPresentInfo->Swapchains = fieldPointer; } } if (imageIndices.IsNull()) { marshalledPresentInfo->ImageIndices = null; } else { if (imageIndices.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->ImageIndices = (uint *)(Interop.HeapUtil.Allocate <uint>()); *(uint *)(marshalledPresentInfo->ImageIndices) = imageIndices.Value.GetSingleValue(); } else { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(imageIndices.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(imageIndices.Value)); index++) { fieldPointer[index] = imageIndices.Value[index]; } marshalledPresentInfo->ImageIndices = fieldPointer; } } if (results.IsNull()) { marshalledPresentInfo->Results = null; } else { if (results.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->Results = (SharpVk.Result *)(Interop.HeapUtil.Allocate <SharpVk.Result>()); *(SharpVk.Result *)(marshalledPresentInfo->Results) = results.Value.GetSingleValue(); } else { var fieldPointer = (SharpVk.Result *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Result>(Interop.HeapUtil.GetLength(results.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(results.Value)); index++) { fieldPointer[index] = results.Value[index]; } marshalledPresentInfo->Results = fieldPointer; } } SharpVk.Interop.Khronos.VkQueuePresentDelegate commandDelegate = commandCache.Cache.vkQueuePresentKHR; result = commandDelegate(extendedHandle.handle, marshalledPresentInfo); if (SharpVkException.IsError(result)) { throw SharpVkException.Create(result); } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void Present(this SharpVk.Queue extendedHandle, SharpVk.Semaphore[] waitSemaphores, SharpVk.Khronos.Swapchain[] swapchains, uint[] imageIndices, SharpVk.Result[] results) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PresentInfo *marshalledPresentInfo = default(SharpVk.Interop.Khronos.PresentInfo *); commandCache = extendedHandle.commandCache; marshalledPresentInfo = (SharpVk.Interop.Khronos.PresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentInfo>()); marshalledPresentInfo->SType = StructureType.PresentInfoKhr; marshalledPresentInfo->Next = null; marshalledPresentInfo->WaitSemaphoreCount = (uint)(waitSemaphores?.Length ?? 0); if (waitSemaphores != null) { var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(waitSemaphores.Length).ToPointer()); for (int index = 0; index < (uint)(waitSemaphores.Length); index++) { fieldPointer[index] = waitSemaphores[index]?.handle ?? default(SharpVk.Interop.Semaphore); } marshalledPresentInfo->WaitSemaphores = fieldPointer; } else { marshalledPresentInfo->WaitSemaphores = null; } marshalledPresentInfo->SwapchainCount = (uint)(swapchains?.Length ?? 0); if (swapchains != null) { var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(swapchains.Length).ToPointer()); for (int index = 0; index < (uint)(swapchains.Length); index++) { fieldPointer[index] = swapchains[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } marshalledPresentInfo->Swapchains = fieldPointer; } else { marshalledPresentInfo->Swapchains = null; } if (imageIndices != null) { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(imageIndices.Length).ToPointer()); for (int index = 0; index < (uint)(imageIndices.Length); index++) { fieldPointer[index] = imageIndices[index]; } marshalledPresentInfo->ImageIndices = fieldPointer; } else { marshalledPresentInfo->ImageIndices = null; } if (results != null) { var fieldPointer = (SharpVk.Result *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Result>(results.Length).ToPointer()); for (int index = 0; index < (uint)(results.Length); index++) { fieldPointer[index] = results[index]; } marshalledPresentInfo->Results = fieldPointer; } else { marshalledPresentInfo->Results = null; } SharpVk.Interop.Khronos.VkQueuePresentDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkQueuePresentDelegate>("vkQueuePresentKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledPresentInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Queue an image for presentation. /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void Present(this SharpVk.Queue extendedHandle, ArrayProxy <SharpVk.Semaphore>?waitSemaphores, ArrayProxy <SharpVk.Khronos.Swapchain>?swapchains, ArrayProxy <uint>?imageIndices, ArrayProxy <SharpVk.Result>?results = null) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PresentInfo *marshalledPresentInfo = default(SharpVk.Interop.Khronos.PresentInfo *); commandCache = extendedHandle.commandCache; marshalledPresentInfo = (SharpVk.Interop.Khronos.PresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentInfo>()); marshalledPresentInfo->SType = StructureType.PresentInfoKhr; marshalledPresentInfo->Next = null; marshalledPresentInfo->WaitSemaphoreCount = (uint)(Interop.HeapUtil.GetLength(waitSemaphores)); if (waitSemaphores.IsNull()) { marshalledPresentInfo->WaitSemaphores = null; } else { if (waitSemaphores.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->WaitSemaphores = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Semaphore>()); *(SharpVk.Interop.Semaphore *)(marshalledPresentInfo->WaitSemaphores) = waitSemaphores.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Semaphore); } else { var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(Interop.HeapUtil.GetLength(waitSemaphores.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(waitSemaphores.Value)); index++) { fieldPointer[index] = waitSemaphores.Value[index]?.handle ?? default(SharpVk.Interop.Semaphore); } marshalledPresentInfo->WaitSemaphores = fieldPointer; } } marshalledPresentInfo->SwapchainCount = (uint)(Interop.HeapUtil.GetLength(swapchains)); if (swapchains.IsNull()) { marshalledPresentInfo->Swapchains = null; } else { if (swapchains.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->Swapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>()); *(SharpVk.Interop.Khronos.Swapchain *)(marshalledPresentInfo->Swapchains) = swapchains.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } else { var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(Interop.HeapUtil.GetLength(swapchains.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(swapchains.Value)); index++) { fieldPointer[index] = swapchains.Value[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } marshalledPresentInfo->Swapchains = fieldPointer; } } if (imageIndices.IsNull()) { marshalledPresentInfo->ImageIndices = null; } else { if (imageIndices.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->ImageIndices = (uint *)(Interop.HeapUtil.Allocate <uint>()); *(uint *)(marshalledPresentInfo->ImageIndices) = imageIndices.Value.GetSingleValue(); } else { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(imageIndices.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(imageIndices.Value)); index++) { fieldPointer[index] = imageIndices.Value[index]; } marshalledPresentInfo->ImageIndices = fieldPointer; } } if (results.IsNull()) { marshalledPresentInfo->Results = null; } else { if (results.Value.Contents == ProxyContents.Single) { marshalledPresentInfo->Results = (SharpVk.Result *)(Interop.HeapUtil.Allocate <SharpVk.Result>()); *(SharpVk.Result *)(marshalledPresentInfo->Results) = results.Value.GetSingleValue(); } else { var fieldPointer = (SharpVk.Result *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Result>(Interop.HeapUtil.GetLength(results.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(results.Value)); index++) { fieldPointer[index] = results.Value[index]; } marshalledPresentInfo->Results = fieldPointer; } } SharpVk.Interop.Khronos.VkQueuePresentDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkQueuePresentDelegate>("vkQueuePresentKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledPresentInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }