pub struct WriteDescriptorSet { /* private fields */ }
Expand description

Represents a single write operation to the binding of a descriptor set.

WriteDescriptorSet specifies the binding number and target array index, and includes one or more resources of a given type that need to be written to that location. Two constructors are provided for each resource type:

  • The basic constructor variant writes a single element to array index 0. It is intended for non-arrayed bindings, where descriptor_count in the descriptor set layout is 1.
  • The _array variant writes several elements and allows specifying the target array index. At least one element must be provided; a panic results if the provided iterator is empty.

Implementations§

source§

impl WriteDescriptorSet

source

pub fn none(binding: u32) -> Self

Write an empty element to array element 0.

This is used for push descriptors in combination with Sampler descriptors that have immutable samplers in the layout. The Vulkan spec requires these elements to be explicitly written, but since there is no data to write, a dummy write is provided instead.

For regular descriptor sets, the data for such descriptors is automatically valid, and dummy writes are not allowed.

source

pub fn none_array( binding: u32, first_array_element: u32, num_elements: u32 ) -> Self

Write a number of consecutive empty elements.

See none for more information.

source

pub fn buffer(binding: u32, buffer: Subbuffer<impl ?Sized>) -> Self

Write a single buffer to array element 0, with the bound range covering the whole buffer.

For dynamic buffer bindings, this will bind the whole buffer, and only a dynamic offset of zero will be valid, which is probably not what you want. Use buffer_with_range instead.

source

pub fn buffer_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = Subbuffer<impl ?Sized>> ) -> Self

Write a number of consecutive buffer elements.

See buffer for more information.

source

pub fn buffer_with_range( binding: u32, buffer_info: DescriptorBufferInfo ) -> Self

Write a single buffer to array element 0, specifying the range of the buffer to be bound.

source

pub fn buffer_with_range_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = DescriptorBufferInfo> ) -> Self

Write a number of consecutive buffer elements, specifying the ranges of the buffers to be bound.

See buffer_with_range for more information.

source

pub fn buffer_view(binding: u32, buffer_view: Arc<BufferView>) -> Self

Write a single buffer view to array element 0.

source

pub fn buffer_view_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = Arc<BufferView>> ) -> Self

Write a number of consecutive buffer view elements.

source

pub fn image_view(binding: u32, image_view: Arc<ImageView>) -> Self

Write a single image view to array element 0, using the Undefined image layout, which will be automatically replaced with an appropriate default layout.

source

pub fn image_view_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = Arc<ImageView>> ) -> Self

Write a number of consecutive image view elements, using the Undefined image layout, which will be automatically replaced with an appropriate default layout.

source

pub fn image_view_with_layout( binding: u32, image_view_info: DescriptorImageViewInfo ) -> Self

Write a single image view to array element 0, specifying the layout of the image to be bound.

source

pub fn image_view_with_layout_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = DescriptorImageViewInfo> ) -> Self

Write a number of consecutive image view elements, specifying the layouts of the images to be bound.

source

pub fn image_view_sampler( binding: u32, image_view: Arc<ImageView>, sampler: Arc<Sampler> ) -> Self

Write a single image view and sampler to array element 0, using the Undefined image layout, which will be automatically replaced with an appropriate default layout.

source

pub fn image_view_sampler_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = (Arc<ImageView>, Arc<Sampler>)> ) -> Self

Write a number of consecutive image view and sampler elements, using the Undefined image layout, which will be automatically replaced with an appropriate default layout.

source

pub fn image_view_with_layout_sampler( binding: u32, image_view_info: DescriptorImageViewInfo, sampler: Arc<Sampler> ) -> Self

Write a single image view and sampler to array element 0, specifying the layout of the image to be bound.

source

pub fn image_view_with_layout_sampler_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = (DescriptorImageViewInfo, Arc<Sampler>)> ) -> Self

Write a number of consecutive image view and sampler elements, specifying the layout of the image to be bound.

source

pub fn sampler(binding: u32, sampler: Arc<Sampler>) -> Self

Write a single sampler to array element 0.

source

pub fn sampler_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = Arc<Sampler>> ) -> Self

Write a number of consecutive sampler elements.

source

pub fn inline_uniform_block(binding: u32, offset: u32, data: Vec<u8>) -> Self

Write data to an inline uniform block.

offset and the length of data must be a multiple of 4.

source

pub fn acceleration_structure( binding: u32, acceleration_structure: Arc<AccelerationStructure> ) -> Self

Write a single acceleration structure to array element 0.

source

pub fn acceleration_structure_array( binding: u32, first_array_element: u32, elements: impl IntoIterator<Item = Arc<AccelerationStructure>> ) -> Self

Write a number of consecutive acceleration structure elements.

source

pub fn binding(&self) -> u32

Returns the binding number that is updated by this descriptor write.

source

pub fn first_array_element(&self) -> u32

Returns the first array element in the binding that is updated by this descriptor write.

source

pub fn elements(&self) -> &WriteDescriptorSetElements

Returns a reference to the elements held by this descriptor write.

Trait Implementations§

source§

impl Clone for WriteDescriptorSet

source§

fn clone(&self) -> WriteDescriptorSet

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WriteDescriptorSet

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.