enum Indirection {
Ordinary,
Reference,
}
Expand description
The WGSL form that write_expr_with_indirection
should use to render a Naga
expression.
Sometimes a Naga Expression
alone doesn’t provide enough information to
choose the right rendering for it in WGSL. For example, one natural WGSL
rendering of a Naga LocalVariable(x)
expression might be &x
, since
LocalVariable
produces a pointer to the local variable’s storage. But when
rendering a Store
statement, the pointer
operand must be the left hand
side of a WGSL assignment, so the proper rendering is x
.
The caller of write_expr_with_indirection
must provide an Expected
value
to indicate how ambiguous expressions should be rendered.
Variants§
Ordinary
Render pointer-construction expressions as WGSL ptr
-typed expressions.
This is the right choice for most cases. Whenever a Naga pointer
expression is not the pointer
operand of a Load
or Store
, it
must be a WGSL pointer expression.
Reference
Render pointer-construction expressions as WGSL reference-typed expressions.
For example, this is the right choice for the pointer
operand when
rendering a Store
statement as a WGSL assignment.
Trait Implementations§
Source§impl Clone for Indirection
impl Clone for Indirection
Source§fn clone(&self) -> Indirection
fn clone(&self) -> Indirection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more