예제 #1
0
 /// <summary>
 /// Create multiple swapchains that share presentable images.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// A bitmask indicating parameters of swapchain creation. Bits which
 /// can be set include: + --
 /// </param>
 /// <param name="queueFamilyIndices">
 /// </param>
 /// <param name="swapchainCounterCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="deviceGroupSwapchainCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="imageFormatListCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain CreateSharedSwapchain(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface, uint minImageCount, SharpVk.Format imageFormat, SharpVk.Khronos.ColorSpace imageColorSpace, SharpVk.Extent2D imageExtent, uint imageArrayLayers, SharpVk.ImageUsageFlags imageUsage, SharpVk.SharingMode imageSharingMode, ArrayProxy <uint>?queueFamilyIndices, SharpVk.Khronos.SurfaceTransformFlags preTransform, SharpVk.Khronos.CompositeAlphaFlags compositeAlpha, SharpVk.Khronos.PresentMode presentMode, bool clipped, SharpVk.Khronos.Swapchain oldSwapchain, SharpVk.Khronos.SwapchainCreateFlags?flags = default(SharpVk.Khronos.SwapchainCreateFlags?), SharpVk.Multivendor.SwapchainCounterCreateInfo?swapchainCounterCreateInfoExt = null, SharpVk.Khronos.DeviceGroupSwapchainCreateInfo?deviceGroupSwapchainCreateInfoKhr = null, SharpVk.Khronos.ImageFormatListCreateInfo?imageFormatListCreateInfoKhr = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain result = default(SharpVk.Khronos.Swapchain);
         CommandCache commandCache        = default(CommandCache);
         uint         swapchainCount      = default(uint);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain *  marshalledSwapchains = default(SharpVk.Interop.Khronos.Swapchain *);
         if (swapchainCounterCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo>());
             swapchainCounterCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (deviceGroupSwapchainCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo>());
             deviceGroupSwapchainCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (imageFormatListCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.ImageFormatListCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.ImageFormatListCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.ImageFormatListCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.ImageFormatListCreateInfo>());
             imageFormatListCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         commandCache                 = extendedHandle.commandCache;
         swapchainCount               = 1;
         marshalledCreateInfos        = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
         marshalledCreateInfos->SType = StructureType.SwapchainCreateInfo;
         marshalledCreateInfos->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfos->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfos->Flags = default(SharpVk.Khronos.SwapchainCreateFlags);
         }
         marshalledCreateInfos->Surface               = surface?.handle ?? default(SharpVk.Interop.Khronos.Surface);
         marshalledCreateInfos->MinImageCount         = minImageCount;
         marshalledCreateInfos->ImageFormat           = imageFormat;
         marshalledCreateInfos->ImageColorSpace       = imageColorSpace;
         marshalledCreateInfos->ImageExtent           = imageExtent;
         marshalledCreateInfos->ImageArrayLayers      = imageArrayLayers;
         marshalledCreateInfos->ImageUsage            = imageUsage;
         marshalledCreateInfos->ImageSharingMode      = imageSharingMode;
         marshalledCreateInfos->QueueFamilyIndexCount = (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices));
         if (queueFamilyIndices.IsNull())
         {
             marshalledCreateInfos->QueueFamilyIndices = null;
         }
         else
         {
             if (queueFamilyIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos->QueueFamilyIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfos->QueueFamilyIndices) = queueFamilyIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)); index++)
                 {
                     fieldPointer[index] = queueFamilyIndices.Value[index];
                 }
                 marshalledCreateInfos->QueueFamilyIndices = fieldPointer;
             }
         }
         marshalledCreateInfos->PreTransform   = preTransform;
         marshalledCreateInfos->CompositeAlpha = compositeAlpha;
         marshalledCreateInfos->PresentMode    = presentMode;
         marshalledCreateInfos->Clipped        = clipped;
         marshalledCreateInfos->OldSwapchain   = oldSwapchain?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledSwapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>(1));
         SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate commandDelegate = commandCache.Cache.vkCreateSharedSwapchainsKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, swapchainCount, marshalledCreateInfos, marshalledAllocator, marshalledSwapchains);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Swapchain(extendedHandle, *marshalledSwapchains);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #2
0
 /// <summary>
 /// Create multiple swapchains that share presentable images.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="createInfos">
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain[] CreateSharedSwapchains(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Khronos.SwapchainCreateInfo>?createInfos, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain[] result = default(SharpVk.Khronos.Swapchain[]);
         CommandCache commandCache          = default(CommandCache);
         uint         swapchainCount        = default(uint);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator   = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain *          marshalledSwapchains  = default(SharpVk.Interop.Khronos.Swapchain *);
         commandCache   = extendedHandle.commandCache;
         swapchainCount = (uint)(Interop.HeapUtil.GetLength(createInfos));
         if (createInfos.IsNull())
         {
             marshalledCreateInfos = null;
         }
         else
         {
             if (createInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
                 createInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Khronos.SwapchainCreateInfo *)(marshalledCreateInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.SwapchainCreateInfo>(Interop.HeapUtil.GetLength(createInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(createInfos.Value)); index++)
                 {
                     createInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledSwapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>(swapchainCount));
         SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate commandDelegate = commandCache.Cache.vkCreateSharedSwapchainsKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, swapchainCount, marshalledCreateInfos, marshalledAllocator, marshalledSwapchains);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         if (marshalledSwapchains != null)
         {
             var fieldPointer = new SharpVk.Khronos.Swapchain[(uint)(swapchainCount)];
             for (int index = 0; index < (uint)(swapchainCount); index++)
             {
                 fieldPointer[index] = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchains[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="initialData">
 /// </param>
 public static unsafe SharpVk.Multivendor.ValidationCache CreateValidationCache(this SharpVk.Device extendedHandle, ArrayProxy <byte>?initialData, SharpVk.Multivendor.ValidationCacheCreateFlags?flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Multivendor.ValidationCache result = default(SharpVk.Multivendor.ValidationCache);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *       marshalledAllocator       = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Multivendor.ValidationCache marshalledValidationCache = default(SharpVk.Interop.Multivendor.ValidationCache);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationCacheCreateInfo>());
         marshalledCreateInfo->SType = StructureType.ValidationCacheCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags);
         }
         marshalledCreateInfo->InitialDataSize = (HostSize)(Interop.HeapUtil.GetLength(initialData));
         if (initialData.IsNull())
         {
             marshalledCreateInfo->InitialData = null;
         }
         else
         {
             if (initialData.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->InitialData            = (byte *)(Interop.HeapUtil.Allocate <byte>());
                 *(byte *)(marshalledCreateInfo->InitialData) = initialData.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(initialData.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(initialData.Value)); index++)
                 {
                     fieldPointer[index] = initialData.Value[index];
                 }
                 marshalledCreateInfo->InitialData = fieldPointer;
             }
         }
         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.VkDeviceCreateValidationCacheDelegate commandDelegate = commandCache.Cache.vkCreateValidationCacheEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledValidationCache);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Multivendor.ValidationCache(extendedHandle, marshalledValidationCache);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="timestampInfos">
 /// </param>
 /// <param name="timestamps">
 /// </param>
 public static unsafe ulong GetCalibratedTimestamps(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Multivendor.CalibratedTimestampInfo>?timestampInfos, ArrayProxy <ulong>?timestamps)
 {
     try
     {
         ulong        result       = default(ulong);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.CalibratedTimestampInfo *marshalledTimestampInfos = default(SharpVk.Interop.Multivendor.CalibratedTimestampInfo *);
         ulong *marshalledTimestamps   = default(ulong *);
         ulong  marshalledMaxDeviation = default(ulong);
         commandCache = extendedHandle.commandCache;
         if (timestampInfos.IsNull())
         {
             marshalledTimestampInfos = null;
         }
         else
         {
             if (timestampInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledTimestampInfos = (SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.CalibratedTimestampInfo>());
                 timestampInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(marshalledTimestampInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Multivendor.CalibratedTimestampInfo>(Interop.HeapUtil.GetLength(timestampInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(timestampInfos.Value)); index++)
                 {
                     timestampInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledTimestampInfos = fieldPointer;
             }
         }
         if (timestamps.IsNull())
         {
             marshalledTimestamps = null;
         }
         else
         {
             if (timestamps.Value.Contents == ProxyContents.Single)
             {
                 marshalledTimestamps             = (ulong *)(Interop.HeapUtil.Allocate <ulong>());
                 *(ulong *)(marshalledTimestamps) = timestamps.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (ulong *)(Interop.HeapUtil.AllocateAndClear <ulong>(Interop.HeapUtil.GetLength(timestamps.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(timestamps.Value)); index++)
                 {
                     fieldPointer[index] = timestamps.Value[index];
                 }
                 marshalledTimestamps = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkDeviceGetCalibratedTimestampsDelegate commandDelegate = commandCache.Cache.vkGetCalibratedTimestampsEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(timestampInfos)), marshalledTimestampInfos, marshalledTimestamps, &marshalledMaxDeviation);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledMaxDeviation;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #5
0
 /// <summary>
 /// Queue an image for presentation.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Queue handle to extend.
 /// </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.Experimental.DeviceGroupPresentInfo?deviceGroupPresentInfoKhx = null, SharpVk.Google.PresentTimesInfo?presentTimesInfoGoogle = 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 (deviceGroupPresentInfoKhx != null)
         {
             SharpVk.Interop.Khronos.Experimental.DeviceGroupPresentInfo *extensionPointer = default(SharpVk.Interop.Khronos.Experimental.DeviceGroupPresentInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.Experimental.DeviceGroupPresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.DeviceGroupPresentInfo>());
             deviceGroupPresentInfoKhx.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;
         }
         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.GetCommandDelegate <SharpVk.Interop.Khronos.VkQueuePresentDelegate>("vkQueuePresentKHR", "device");
         result = commandDelegate(extendedHandle.handle, marshalledPresentInfo);
         if (SharpVkException.IsError(result))
         {
             throw SharpVkException.Create(result);
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }