Struct vulkano::descriptor_set::layout::DescriptorDesc[][src]

pub struct DescriptorDesc {
    pub ty: DescriptorDescTy,
    pub descriptor_count: u32,
    pub stages: ShaderStages,
    pub variable_count: bool,
    pub mutable: bool,
}
Expand description

Contains the exact description of a single descriptor.

Note: You are free to fill a DescriptorDesc struct the way you want, but its validity will be checked when you create a pipeline layout, a descriptor set, or when you try to bind a descriptor set.

Fields

ty: DescriptorDescTy

Describes the content and layout of each array element of a descriptor.

descriptor_count: u32

How many array elements this descriptor is made of. The value 0 is invalid and may trigger a panic depending on the situation.

stages: ShaderStages

Which shader stages are going to access this descriptor.

variable_count: bool

True if the descriptor has a variable descriptor count.

mutable: bool

True if the attachment can be written by the shader.

Implementations

Returns whether self is compatible with other.

“Compatible” in this sense is defined by the Vulkan specification under the section “Pipeline layout compatibility”: the two must be identically defined to the Vulkan API, meaning they have identical VkDescriptorSetLayoutBinding values.

Checks whether the descriptor of a pipeline layout self is compatible with the descriptor of a shader other.

Checks whether the descriptor of a pipeline layout self is compatible with the descriptor of a descriptor set being bound other.

Builds a DescriptorDesc that is the union of self and other, if possible.

The returned value will be a superset of both self and other, or None if both were None.

Err is returned if the descriptors are not compatible.

Example

use vulkano::descriptor_set::layout::DescriptorDesc;
use vulkano::descriptor_set::layout::DescriptorDescTy::*;
use vulkano::pipeline::shader::ShaderStages;

let desc_part1 = DescriptorDesc{ ty: Sampler { immutable_samplers: vec![] }, descriptor_count: 2, stages: ShaderStages{
  vertex: true,
  tessellation_control: true,
  tessellation_evaluation: false,
  geometry: true,
  fragment: false,
  compute: true
}, mutable: true, variable_count: false };

let desc_part2 = DescriptorDesc{ ty: Sampler { immutable_samplers: vec![] }, descriptor_count: 1, stages: ShaderStages{
  vertex: true,
  tessellation_control: false,
  tessellation_evaluation: true,
  geometry: false,
  fragment: true,
  compute: true
}, mutable: false, variable_count: false };

let desc_union = DescriptorDesc{ ty: Sampler { immutable_samplers: vec![] }, descriptor_count: 2, stages: ShaderStages{
  vertex: true,
  tessellation_control: true,
  tessellation_evaluation: true,
  geometry: true,
  fragment: true,
  compute: true
}, mutable: true, variable_count: false };

assert_eq!(DescriptorDesc::union(Some(&desc_part1), Some(&desc_part2)), Ok(Some(desc_union)));

Returns the pipeline stages and access flags corresponding to the usage of this descriptor.

Panic

Panics if the type is Sampler.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Builds a pointer to this type from a raw pointer.

Returns true if the size is suitable to store a type like this.

Returns the size of an individual element.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.