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.
pub fn ensure_compatible_with_shader(
&self,
other: &DescriptorDesc
) -> Result<(), DescriptorCompatibilityError>
pub fn ensure_compatible_with_shader(
&self,
other: &DescriptorDesc
) -> Result<(), DescriptorCompatibilityError>
Checks whether the descriptor of a pipeline layout self
is compatible with the descriptor
of a shader other
.
pub fn ensure_compatible_with_bind(
&self,
other: &DescriptorDesc
) -> Result<(), DescriptorCompatibilityError>
pub fn ensure_compatible_with_bind(
&self,
other: &DescriptorDesc
) -> Result<(), DescriptorCompatibilityError>
Checks whether the descriptor of a pipeline layout self
is compatible with the descriptor
of a descriptor set being bound other
.
pub fn union(
first: Option<&DescriptorDesc>,
second: Option<&DescriptorDesc>
) -> Result<Option<DescriptorDesc>, ()>
pub fn union(
first: Option<&DescriptorDesc>,
second: Option<&DescriptorDesc>
) -> Result<Option<DescriptorDesc>, ()>
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for DescriptorDesc
impl Send for DescriptorDesc
impl Sync for DescriptorDesc
impl Unpin for DescriptorDesc
impl UnwindSafe for DescriptorDesc
Blanket Implementations
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.