pub struct CommandStream<A = ()> {
pub args: A,
/* private fields */
}Expand description
A reusable command stream.
Prepared streams reduce repeated CPU-side graph construction and preparation work by caching an optimized schedule and static recording resources. Unprepared streams keep finalization cheaper up front, but each insertion still has to reconcile arguments, dependencies, scheduling, and recording with the parent graph.
Inserting or concatenating many tiny streams is not free. Profile release builds before designing around heavy stream composition.
let stream = CommandStream::prepare(&mut pool, |stream| {
stream.begin_cmd().debug_name("cached commands").record_cmd(|_| {});
})?;
let mut graph = Graph::new();
graph.insert_cmd_stream(&stream).finish();Fields§
§args: ATyped handles returned by the preparation callback.
Implementations§
Source§impl CommandStream<()>
impl CommandStream<()>
Sourcepub fn finalize<A>(
build: impl FnOnce(&mut CommandStreamMut) -> A,
) -> CommandStreamDraft<A>
pub fn finalize<A>( build: impl FnOnce(&mut CommandStreamMut) -> A, ) -> CommandStreamDraft<A>
Finalizes a reusable command stream without preparing optimizations.
The returned draft can be inserted as an unprepared stream with CommandStreamDraft::into_stream
or prepared later with CommandStreamDraft::prepare.
Sourcepub fn prepare<P, A>(
pool: &mut P,
build: impl FnOnce(&mut CommandStreamMut) -> A,
) -> Result<CommandStream<A>, DriverError>where
P: SubmissionPool,
pub fn prepare<P, A>(
pool: &mut P,
build: impl FnOnce(&mut CommandStreamMut) -> A,
) -> Result<CommandStream<A>, DriverError>where
P: SubmissionPool,
Finalizes and prepares a reusable command stream.
Prepared streams do more work up front so repeated insertions can reuse prepared scheduling and static recording resources.
Trait Implementations§
Source§impl<A: Clone> Clone for CommandStream<A>
impl<A: Clone> Clone for CommandStream<A>
Source§fn clone(&self) -> CommandStream<A>
fn clone(&self) -> CommandStream<A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more