pub struct RayTracingPipeline { /* private fields */ }Expand description
Smart pointer handle of a ray tracing pipeline object.
Also contains information about the object.
See VkPipeline.
Implementations§
Source§impl RayTracingPipeline
impl RayTracingPipeline
Sourcepub fn create<S>(
device: &Device,
info: impl Into<RayTracingPipelineInfo>,
shaders: impl IntoIterator<Item = S>,
shader_groups: impl IntoIterator<Item = RayTracingShaderGroup>,
) -> Result<Self, DriverError>
pub fn create<S>( device: &Device, info: impl Into<RayTracingPipelineInfo>, shaders: impl IntoIterator<Item = S>, shader_groups: impl IntoIterator<Item = RayTracingShaderGroup>, ) -> Result<Self, DriverError>
Creates a new ray tracing pipeline on the given device.
The correct pipeline stages will be enabled based on the provided shaders. See Shader
for details on all available stages.
See VkRayTracingPipelineCreateInfoKHR.
The number and composition of the shader_groups parameter must match the actual shaders
provided.
shaders may contain pre-built Shader values or any inputs that can be converted into
them. Invalid shader data is returned as DriverError::InvalidData through the Result
instead of panicking.
§Examples
Basic usage:
// shader code is raw SPIR-V code as bytes
let info = RayTracingPipelineInfo::default().into_builder().max_ray_recursion_depth(1);
let pipeline = RayTracingPipeline::create(
&device,
info,
[
Shader::new_ray_gen(my_rgen_code.as_slice()),
Shader::new_closest_hit(my_chit_code.as_slice()),
Shader::new_miss(my_miss_code.as_slice()),
Shader::new_miss(my_shadow_code.as_slice()),
],
[
RayTracingShaderGroup::new_general(0),
RayTracingShaderGroup::new_triangles(1, None),
RayTracingShaderGroup::new_general(2),
RayTracingShaderGroup::new_general(3),
],
)?;
assert_ne!(pipeline.handle(), vk::Pipeline::null());
assert_eq!(pipeline.info().max_ray_recursion_depth, 1);Sourcepub fn group_handle(&self, idx: usize) -> &[u8] ⓘ
pub fn group_handle(&self, idx: usize) -> &[u8] ⓘ
Returns a handle to a shader group of this pipeline.
This can be used to construct a shader binding table.
§Examples
See
ray_tracing.rs
for a detailed example that constructs a shader binding table buffer using this function.
Sourcepub fn group_stack_size(
&self,
group: u32,
group_shader: ShaderGroupShaderKHR,
) -> DeviceSize
pub fn group_stack_size( &self, group: u32, group_shader: ShaderGroupShaderKHR, ) -> DeviceSize
Queries ray tracing pipeline shader group shader stack size.
The return value is the ray tracing pipeline stack size in bytes for the specified shader as called from the specified shader group.
Sourcepub fn handle(&self) -> Pipeline
pub fn handle(&self) -> Pipeline
The native Vulkan pipeline handle of this ray tracing pipeline.
Sourcepub fn info(&self) -> RayTracingPipelineInfo
pub fn info(&self) -> RayTracingPipelineInfo
Gets the information used to create this object.
Sourcepub fn set_debug_name(&self, name: impl AsRef<str>)
pub fn set_debug_name(&self, name: impl AsRef<str>)
Sets the debugging name assigned to this pipeline.
Sourcepub fn with_debug_name(self, name: impl AsRef<str>) -> Self
pub fn with_debug_name(self, name: impl AsRef<str>) -> Self
Sets the debugging name assigned to this pipeline.
Trait Implementations§
Source§impl Clone for RayTracingPipeline
impl Clone for RayTracingPipeline
Source§fn clone(&self) -> RayTracingPipeline
fn clone(&self) -> RayTracingPipeline
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more