Macro pass_base

Source
macro_rules! pass_base {
    ($pass:expr, $scope:expr $(,)?) => { ... };
}
Expand description

Checks the state of a compute::ComputePass or render::RenderPass and evaluates to a mutable reference to the [BasePass], if the pass is open and valid.

If the pass is ended or not valid, returns from the invoking function, like the ? operator.

If the pass is ended (i.e. the application is attempting to record a command on a finished pass), returns Err(EncoderStateError::Ended) from the invoking function, for immediate propagation as a validation error.

If the pass is open but invalid (i.e. a previous command encountered an error), returns Ok(()) from the invoking function. The pass should already have stored the previous error, which will be transferred to the parent encoder when the pass is ended, and then raised as a validation error when finish() is called for the parent).

Although in many cases the functionality of pass_base! could be achieved by combining a helper method on the passes with the pass_try! macro, taking the mutable reference to the base pass in a macro avoids borrowing conflicts when a reference to some other member of the pass struct is needed simultaneously with the base pass reference.