Function naga::back::pipeline_constants::filter_emits_in_block

source ยท
fn filter_emits_in_block(block: &mut Block, expressions: &Arena<Expression>)
Expand description

Adjust Emit statements in block to skip needs_pre_emit expressions we have introduced.

According to validation, Emit statements must not cover any expressions for which Expression::needs_pre_emit returns true. All expressions built by successful constant evaluation fall into that category, meaning that process_function will usually rewrite Override expressions and those that use their values into pre-emitted expressions, leaving any Emit statements that cover them invalid.

This function rewrites all Emit statements into zero or more new Emit statements covering only those expressions in the original range that are not pre-emitted.