pub struct ComputePipelineInfo {
pub bindless_descriptor_count: u32,
pub entry_name: String,
pub name: Option<String>,
pub specialization_info: Option<SpecializationInfo>,
pub spirv: Vec<u8>,
}Expand description
Information used to create a ComputePipeline instance.
Fields
bindless_descriptor_count: u32The number of descriptors to allocate for a given binding when using bindless (unbounded) syntax.
The default is 8192.
Examples
Basic usage (GLSL):
#version 460 core
#extension GL_EXT_nonuniform_qualifier : require
layout(set = 0, binding = 0, rgba8) writeonly uniform image2D my_binding[];
void main()
{
// my_binding will have space for 8,192 images by default
}entry_name: StringThe GLSL or HLSL shader entry point name, or main by default.
name: Option<String>A descriptive name used in debugging messages.
specialization_info: Option<SpecializationInfo>Data about Vulkan specialization constants.
Examples
Basic usage (GLSL):
#version 460 core
// Defaults to 6 if not set using ComputePipelineInfo.specialization_info!
layout(constant_id = 0) const uint MY_COUNT = 6;
layout(set = 0, binding = 0) uniform sampler2D my_samplers[MY_COUNT];
void main()
{
// Code uses MY_COUNT number of my_samplers here
}// We instead specify 42 for MY_COUNT:
let info = ComputePipelineInfo::new(my_shader_code.as_slice())
.specialization_info(SpecializationInfo::new(
[vk::SpecializationMapEntry {
constant_id: 0,
offset: 0,
size: 4,
}],
42u32.to_ne_bytes()
));
let pipeline = ComputePipeline::create(&device, info)?;spirv: Vec<u8>Shader code.
Although SPIR-V code is specified as u32 values, this field uses u8 in order to make
loading from file simpler. You should always have a SPIR-V code length which is a multiple
of four bytes, or a panic will happen during ComputePipeline::create.
Implementations
sourceimpl ComputePipelineInfo
impl ComputePipelineInfo
sourcepub fn new(spirv: impl ShaderCode) -> ComputePipelineInfoBuilder
pub fn new(spirv: impl ShaderCode) -> ComputePipelineInfoBuilder
Specifies a compute pipeline with the given shader code.
Panics
If shader code is not a multiple of four bytes.
Trait Implementations
sourceimpl Clone for ComputePipelineInfo
impl Clone for ComputePipelineInfo
sourcefn clone(&self) -> ComputePipelineInfo
fn clone(&self) -> ComputePipelineInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for ComputePipelineInfo
impl Debug for ComputePipelineInfo
sourceimpl From<ComputePipelineInfoBuilder> for ComputePipelineInfo
impl From<ComputePipelineInfoBuilder> for ComputePipelineInfo
sourcefn from(info: ComputePipelineInfoBuilder) -> Self
fn from(info: ComputePipelineInfoBuilder) -> Self
Converts to this type from the input type.
sourceimpl<S> From<S> for ComputePipelineInfowhere
S: ShaderCode,
impl<S> From<S> for ComputePipelineInfowhere
S: ShaderCode,
Auto Trait Implementations
impl RefUnwindSafe for ComputePipelineInfo
impl Send for ComputePipelineInfo
impl Sync for ComputePipelineInfo
impl Unpin for ComputePipelineInfo
impl UnwindSafe for ComputePipelineInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more