Enum naga::Statement [−][src]
pub enum Statement {
Show 14 variants
Emit(Range<Expression>),
Block(Block),
If {
condition: Handle<Expression>,
accept: Block,
reject: Block,
},
Switch {
selector: Handle<Expression>,
cases: Vec<SwitchCase>,
default: Block,
},
Loop {
body: Block,
continuing: Block,
},
Break,
Continue,
Return {
value: Option<Handle<Expression>>,
},
Kill,
Barrier(Barrier),
Store {
pointer: Handle<Expression>,
value: Handle<Expression>,
},
ImageStore {
image: Handle<Expression>,
coordinate: Handle<Expression>,
array_index: Option<Handle<Expression>>,
value: Handle<Expression>,
},
Atomic {
pointer: Handle<Expression>,
fun: AtomicFunction,
value: Handle<Expression>,
result: Handle<Expression>,
},
Call {
function: Handle<Function>,
arguments: Vec<Handle<Expression>>,
result: Option<Handle<Expression>>,
},
}
Expand description
Instructions which make up an executable block.
Variants
Emit(Range<Expression>)
Emit a range of expressions, visible to all statements that follow in this block.
See the module-level documentation for details.
Tuple Fields of Emit
0: Range<Expression>
Block(Block)
A block containing more statements, to be executed sequentially.
Tuple Fields of Block
0: Block
Conditionally executes one of two blocks, based on the value of the condition.
Fields of If
Conditionally executes one of multiple blocks, based on the value of the selector.
Fields of Switch
Executes a block repeatedly.
Each iteration of the loop executes the body
block, followed by the
continuing
block.
Executing a Break
, Return
or Kill
statement exits the loop.
A Continue
statement in body
jumps to the continuing
block. The
continuing
block is meant to be used to represent structures like the
third expression of a C-style for
loop head, to which continue
statements in the loop’s body jump.
The continuing
block and its substatements must not contain Return
or Kill
statements, or any Break
or Continue
statements targeting
this loop. (It may have Break
and Continue
statements targeting
loops or switches nested within the continuing
block.)
Exits the innermost enclosing Loop
or Switch
.
A Break
statement may only appear within a Loop
or Switch
statement. It may not break out of a Loop
from within the loop’s
continuing
block.
Skips to the continuing
block of the innermost enclosing Loop
.
A Continue
statement may only appear within the body
block of the
innermost enclosing Loop
statement. It must not appear within that
loop’s continuing
block.
Returns from the function (possibly with a value).
Return
statements are forbidden within the continuing
block of a
Loop
statement.
Fields of Return
value: Option<Handle<Expression>>
Aborts the current shader execution.
Kill
statements are forbidden within the continuing
block of a
Loop
statement.
Barrier(Barrier)
Synchronize invocations within the work group.
The Barrier
flags control which memory accesses should be synchronized.
If empty, this becomes purely an execution barrier.
Tuple Fields of Barrier
0: Barrier
Stores a value at an address.
For TypeInner::Atomic
type behind the pointer, the value
has to be a corresponding scalar.
For other types behind the pointer
This statement is a barrier for any operations on the
Expression::LocalVariable
or Expression::GlobalVariable
that is the destination of an access chain, started
from the pointer
.
Fields of Store
pointer: Handle<Expression>
value: Handle<Expression>
Stores a texel value to an image.
The image
, coordinate
, and array_index
fields have the same
meanings as the corresponding operands of an ImageLoad
expression;
see that documentation for details. Storing into multisampled images or
images with mipmaps is not supported, so there is no index
operand.
This statement is a barrier for any operations on the corresponding
Expression::GlobalVariable
for this image.
Fields of ImageStore
image: Handle<Expression>
coordinate: Handle<Expression>
array_index: Option<Handle<Expression>>
value: Handle<Expression>
Atomic function.
Fields of Atomic
pointer: Handle<Expression>
Pointer to an atomic value.
fun: AtomicFunction
Function to run on the atomic.
value: Handle<Expression>
Value to use in the function.
result: Handle<Expression>
Emitted expression as a result.
Calls a function.
If the result
is Some
, the corresponding expression has to be
Expression::CallResult
, and this statement serves as a barrier for any
operations on that expression.
Fields of Call
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Statement
impl UnwindSafe for Statement
Blanket Implementations
Mutably borrows from an owned value. Read more