pub struct RayTrace<'a> { /* private fields */ }
Expand description

Recording interface for ray tracing commands.

This structure provides a strongly-typed set of methods which allow ray trace shader code to be executed. An instance of RayTrace is provided to the closure parameter of PipelinePassRef::record_ray_trace which may be accessed by binding a RayTracePipeline to a render pass.

Examples

Basic usage:

    [Shader::new_miss(my_miss_code.as_slice())],
    [RayTraceShaderGroup::new_general(0)],
)?);
my_graph.begin_pass("my ray trace pass")
        .bind_pipeline(&my_ray_trace_pipeline)
        .record_ray_trace(move |ray_trace, bindings| {
            // During this closure we have access to the ray trace methods!
        });

Implementations

Updates push constants.

Push constants represent a high speed path to modify constant data in pipelines that is expected to outperform memory-backed resource updates.

Push constant values can be updated incrementally, causing shader stages to read the new data for push constants modified by this command, while still reading the previous data for push constants not modified by this command.

Device limitations

See device.physical_device.props.limits.max_push_constants_size for the limits of the current device. You may also check gpuinfo.org for a listing of reported limits on other devices.

Examples

Basic usage:

#version 460

layout(push_constant) uniform PushConstants {
    layout(offset = 0) uint some_val;
} push_constants;

void main()
{
    // TODO: Add bindings to write things!
}
my_graph.begin_pass("draw a cornell box")
        .bind_pipeline(&my_ray_trace_pipeline)
        .record_ray_trace(move |ray_trace, bindings| {
            ray_trace.push_constants(&[0xcb])
                     .trace_rays(&rgen_sbt, &hit_sbt, &miss_sbt, &call_sbt, 320, 200, 1);
        });

Updates push constants starting at the given offset.

Behaves similary to RayTrace::push_constants except that offset describes the position at which data updates the push constants of the currently bound pipeline. This may be used to update a subset or single field of previously set push constant data.

Device limitations

See device.physical_device.props.limits.max_push_constants_size for the limits of the current device. You may also check gpuinfo.org for a listing of reported limits on other devices.

Examples

Basic usage:

#version 460

layout(push_constant) uniform PushConstants {
    layout(offset = 0) uint some_val1;
    layout(offset = 4) uint some_val2;
} push_constants;

void main()
{
    // TODO: Add bindings to write things!
}
my_graph.begin_pass("draw a cornell box")
        .bind_pipeline(&my_ray_trace_pipeline)
        .record_ray_trace(move |ray_trace, bindings| {
            ray_trace.push_constants(&[0xcb, 0xff])
                     .trace_rays(&rgen_sbt, &hit_sbt, &miss_sbt, &call_sbt, 320, 200, 1)
                     .push_constants_offset(4, &[0xae])
                     .trace_rays(&rgen_sbt, &hit_sbt, &miss_sbt, &call_sbt, 320, 200, 1);
        });

Ray traces using the currently-bound RayTracePipeline and the given shader binding tables.

Shader binding tables must be constructed according to this example.

Examples

Basic usage:

my_graph.begin_pass("draw a cornell box")
        .bind_pipeline(&my_ray_trace_pipeline)
        .record_ray_trace(move |ray_trace, bindings| {
            ray_trace.trace_rays(&rgen_sbt, &hit_sbt, &miss_sbt, &call_sbt, 320, 200, 1);
        });

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

Returns the argument unchanged.

Calls U::from(self).

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

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.