/// <summary>
 ///
 /// </summary>
 internal unsafe void MarshalTo(SharpVk.Interop.Khronos.DisplayModeCreateInfo *pointer)
 {
     pointer->SType = StructureType.DisplayModeCreateInfo;
     pointer->Next  = null;
     if (this.Flags != null)
     {
         pointer->Flags = this.Flags.Value;
     }
     else
     {
         pointer->Flags = default(SharpVk.Khronos.DisplayModeCreateFlags);
     }
     pointer->Parameters = this.Parameters;
 }
 /// <summary>
 /// Create a display mode.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use, and must be zero.
 /// </param>
 /// <param name="parameters">
 /// A DisplayModeParametersKHR structure describing the display
 /// parameters to use in creating the new mode. If the parameters are
 /// not compatible with the specified display, the implementation must
 /// return Result.ErrorINITIALIZATION_FAILED.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.DisplayMode CreateDisplayMode(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display, SharpVk.Khronos.DisplayModeParameters parameters, SharpVk.Khronos.DisplayModeCreateFlags?flags = default(SharpVk.Khronos.DisplayModeCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.DisplayMode result = default(SharpVk.Khronos.DisplayMode);
         CommandCache commandCache          = default(CommandCache);
         SharpVk.Interop.Khronos.DisplayModeCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplayModeCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.DisplayMode  marshalledMode      = default(SharpVk.Interop.Khronos.DisplayMode);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DisplayModeCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DisplayModeCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplayModeCreateFlags);
         }
         marshalledCreateInfo->Parameters = parameters;
         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.Khronos.VkPhysicalDeviceCreateDisplayModeDelegate commandDelegate = commandCache.Cache.vkCreateDisplayModeKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledCreateInfo, marshalledAllocator, &marshalledMode);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.DisplayMode(extendedHandle, marshalledMode);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }