Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WriteDescriptorSet"/> structure.
 /// </summary>
 /// <param name="dstSet">The destination descriptor set to update.</param>
 /// <param name="dstBinding">The descriptor binding within that set.</param>
 /// <param name="dstArrayElement">The starting element in that array.</param>
 /// <param name="descriptorCount">
 /// The number of descriptors to update (the number of elements in <see cref="ImageInfo"/>,
 /// <see cref="BufferInfo"/>, or <see cref="TexelBufferView"/>).
 /// </param>
 /// <param name="descriptorType">
 /// Specifies the type of each descriptor in <see cref="ImageInfo"/>, <see
 /// cref="BufferInfo"/>, or <see cref="TexelBufferView"/>, as described below. It must be the
 /// same type as that specified in <see cref="DescriptorSetLayoutBinding"/> for <see
 /// cref="DstSet"/> at <see cref="DstBinding"/>. The type of the descriptor also controls
 /// which array the descriptors are taken from.
 /// </param>
 /// <param name="imageInfo">
 /// An array of <see cref="DescriptorImageInfo"/> structures or is ignored.
 /// </param>
 /// <param name="bufferInfo">
 /// An array of <see cref="DescriptorBufferInfo"/> structures or is ignored.
 /// </param>
 /// <param name="texelBufferView">An array of <see cref="BufferView"/> handles or is ignored.</param>
 public WriteDescriptorSet(DescriptorSet dstSet, int dstBinding, int dstArrayElement, int descriptorCount,
                           DescriptorType descriptorType, DescriptorImageInfo[] imageInfo = null, DescriptorBufferInfo[] bufferInfo = null,
                           BufferView[] texelBufferView = null)
 {
     DstSet          = dstSet;
     DstBinding      = dstBinding;
     DstArrayElement = dstArrayElement;
     DescriptorCount = descriptorCount;
     DescriptorType  = descriptorType;
     ImageInfo       = imageInfo;
     BufferInfo      = bufferInfo;
     TexelBufferView = texelBufferView?.ToHandleArray();
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyDescriptorSet"/> structure.
 /// </summary>
 /// <param name="srcSet">Source descriptor set.</param>
 /// <param name="srcBinding">Source binding.</param>
 /// <param name="srcArrayElement">Array element within the source binding to copy from.</param>
 /// <param name="dstSet">Destination descriptor set.</param>
 /// <param name="dstBinding">Destination binding.</param>
 /// <param name="dstArrayElement">
 /// Array element within the destination binding to copy to.
 /// </param>
 /// <param name="descriptorCount">
 /// The number of descriptors to copy from the source to destination.
 /// </param>
 public CopyDescriptorSet(
     DescriptorSet srcSet, int srcBinding, int srcArrayElement,
     DescriptorSet dstSet, int dstBinding, int dstArrayElement,
     int descriptorCount)
 {
     Type            = StructureType.CopyDescriptorSet;
     Next            = IntPtr.Zero;
     SrcSet          = srcSet;
     SrcBinding      = srcBinding;
     SrcArrayElement = srcArrayElement;
     DstSet          = dstSet;
     DstBinding      = dstBinding;
     DstArrayElement = dstArrayElement;
     DescriptorCount = descriptorCount;
 }
Exemple #3
0
        internal static DescriptorSet[] Allocate(DescriptorPool parent, ref DescriptorSetAllocateInfo createInfo)
        {
            fixed(long *setLayoutsPtr = createInfo.SetLayouts)
            {
                createInfo.ToNative(out DescriptorSetAllocateInfo.Native nativeCreateInfo, parent, setLayoutsPtr);

                int count = createInfo.SetLayouts?.Length ?? 0;

                var    descriptorSetsPtr = stackalloc long[count];
                Result result            = vkAllocateDescriptorSets(parent.Parent, &nativeCreateInfo, descriptorSetsPtr);

                VulkanException.ThrowForInvalidResult(result);

                var descriptorSets = new DescriptorSet[count];

                for (int i = 0; i < count; i++)
                {
                    descriptorSets[i] = new DescriptorSet(parent, descriptorSetsPtr[i]);
                }
                return(descriptorSets);
            }
        }
Exemple #4
0
 /// <summary>
 /// Update the contents of a descriptor set object.
 /// <para>
 /// The operations described by <paramref name="descriptorWrites"/> are performed first,
 /// followed by the operations described by <paramref name="descriptorCopies"/>. Within each
 /// array, the operations are performed in the order they appear in the array.
 /// </para>
 /// <para>
 /// Each element in the <paramref name="descriptorWrites"/> array describes an operation
 /// updating the descriptor set using descriptors for resources specified in the structure.
 /// </para>
 /// <para>
 /// Each element in the <paramref name="descriptorCopies"/> array is a structure describing an
 /// operation copying descriptors between sets.
 /// </para>
 /// </summary>
 /// <param name="descriptorWrites">The structures describing the descriptor sets to write to.</param>
 /// <param name="descriptorCopies">The structures describing the descriptor sets to copy between.</param>
 public void UpdateSets(WriteDescriptorSet[] descriptorWrites = null, CopyDescriptorSet[] descriptorCopies = null)
 {
     DescriptorSet.Update(this, descriptorWrites, descriptorCopies);
 }
Exemple #5
0
 /// <summary>
 /// Allocate one or more descriptor sets.
 /// <para>
 /// The pool must have enough free descriptor capacity remaining to allocate the descriptor
 /// sets of the specified layouts.
 /// </para>
 /// <para>
 /// When a descriptor set is allocated, the initial state is largely uninitialized and all
 /// descriptors are undefined. However, the descriptor set can be bound in a command buffer
 /// without causing errors or exceptions. All entries that are statically used by a pipeline
 /// in a drawing or dispatching command must have been populated before the descriptor set is
 /// bound for use by that command. Entries that are not statically used by a pipeline can
 /// have uninitialized descriptors or descriptors of resources that have been destroyed, and
 /// executing a draw or dispatch with such a descriptor set bound does not cause undefined
 /// behavior. This means applications need not populate unused entries with dummy descriptors.
 /// </para>
 /// <para>
 /// If an allocation fails due to fragmentation, an indeterminate error is returned with an
 /// unspecified error code. Any returned error other than <see
 /// cref="Result.ErrorFragmentedPool"/> does not imply its usual meaning: applications should
 /// assume that the allocation failed due to fragmentation, and create a new descriptor pool.
 /// </para>
 /// </summary>
 /// <param name="allocateInfo">The structure describing parameters of the allocation.</param>
 public DescriptorSet[] AllocateSets(DescriptorSetAllocateInfo allocateInfo)
 {
     return(DescriptorSet.Allocate(this, ref allocateInfo));
 }
Exemple #6
0
 /// <summary>
 /// Free one or more descriptor sets.
 /// </summary>
 /// <param name="descriptorSets">An array of handles to <see cref="DescriptorSet"/> objects.</param>
 /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
 public void FreeSets(params DescriptorSet[] descriptorSets)
 {
     DescriptorSet.Free(this, descriptorSets);
 }