internal DescriptorUpdateTemplateKhr(Device parent,
                                             ref DescriptorUpdateTemplateCreateInfoKhr createInfo, ref AllocationCallbacks?allocator)
        {
            Parent    = parent;
            Allocator = allocator;

            fixed(DescriptorUpdateTemplateEntryKhr *nativeDescriptorUpdateEntries = createInfo.DescriptorUpdateEntries)
            {
                createInfo.ToNative(out var nativeCreateInfo, nativeDescriptorUpdateEntries);
                long   handle;
                Result result = vkCreateDescriptorUpdateTemplateKHR(parent, &nativeCreateInfo, NativeAllocator, &handle);

                VulkanException.ThrowForInvalidResult(result);
                Handle = handle;
            }
        }
 /// <summary>
 /// Create a new descriptor update template.
 /// </summary>
 /// <param name="device">The logical device that creates the descriptor update template.</param>
 /// <param name="createInfo">
 /// Specifies the set of descriptors to update with a single call to <see cref="DescriptorSetExtensions.UpdateWithTemplateKhr"/>.
 /// </param>
 /// <param name="allocator">Controls host memory allocation.</param>
 /// <returns>The resulting descriptor update template object.</returns>
 /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
 public static DescriptorUpdateTemplateKhr CreateDescriptorUpdateTemplateKhr(this Device device,
                                                                             DescriptorUpdateTemplateCreateInfoKhr createInfo, AllocationCallbacks?allocator = null)
 {
     return(new DescriptorUpdateTemplateKhr(device, ref createInfo, ref allocator));
 }