/// <summary>
 /// Pushes descriptor updates into a command buffer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="descriptorWrites">
 /// </param>
 public static unsafe void PushDescriptorSet(this SharpVk.CommandBuffer extendedHandle, SharpVk.PipelineBindPoint pipelineBindPoint, SharpVk.PipelineLayout layout, uint set, ArrayProxy <SharpVk.WriteDescriptorSet>?descriptorWrites)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.WriteDescriptorSet *marshalledDescriptorWrites = default(SharpVk.Interop.WriteDescriptorSet *);
         commandCache = extendedHandle.commandCache;
         if (descriptorWrites.IsNull())
         {
             marshalledDescriptorWrites = null;
         }
         else
         {
             if (descriptorWrites.Value.Contents == ProxyContents.Single)
             {
                 marshalledDescriptorWrites = (SharpVk.Interop.WriteDescriptorSet *)(Interop.HeapUtil.Allocate <SharpVk.Interop.WriteDescriptorSet>());
                 descriptorWrites.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.WriteDescriptorSet *)(marshalledDescriptorWrites));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.WriteDescriptorSet *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.WriteDescriptorSet>(Interop.HeapUtil.GetLength(descriptorWrites.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(descriptorWrites.Value)); index++)
                 {
                     descriptorWrites.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledDescriptorWrites = fieldPointer;
             }
         }
         SharpVk.Interop.Khronos.VkCommandBufferPushDescriptorSetDelegate commandDelegate = commandCache.Cache.vkCmdPushDescriptorSetKHR;
         commandDelegate(extendedHandle.handle, pipelineBindPoint, layout?.handle ?? default(SharpVk.Interop.PipelineLayout), set, (uint)(Interop.HeapUtil.GetLength(descriptorWrites)), marshalledDescriptorWrites);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }