pub trait GraphicsJob: Component + Clone {
type In: JobInput<Self>;
// Required method
fn run(
&self,
world: &World,
render_device: &RenderDevice,
command_encoder: &mut CommandEncoder,
input: JobInputItem<'_, Self, Self::In>,
) -> Result<(), JobError>;
// Provided method
fn label() -> ShortName<'static> { ... }
}Expand description
A trait for components describing a unit of rendering work.
When a Component implementing this trait is added to the World,
it is extracted to the render world, where it waits for its inputs to be
prepared. When they are ready, it will execute and the commands it encodes
will be submitted before the render graph is executed.
You can also specify a priority for a running job by adding the [JobPriority]
component when it is spawned.
Note: you must call init_graphics_job
on App for the job to execute.
Required Associated Types§
Required Methods§
fn run( &self, world: &World, render_device: &RenderDevice, command_encoder: &mut CommandEncoder, input: JobInputItem<'_, Self, Self::In>, ) -> Result<(), JobError>
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.