Enum naga::Expression[][src]

pub enum Expression {
Show variants Access { base: Handle<Expression>, index: Handle<Expression>, }, AccessIndex { base: Handle<Expression>, index: u32, }, Constant(Handle<Constant>), Splat { size: VectorSize, value: Handle<Expression>, }, Swizzle { size: VectorSize, vector: Handle<Expression>, pattern: [SwizzleComponent; 4], }, Compose { ty: Handle<Type>, components: Vec<Handle<Expression>>, }, FunctionArgument(u32), GlobalVariable(Handle<GlobalVariable>), LocalVariable(Handle<LocalVariable>), Load { pointer: Handle<Expression>, }, ImageSample { image: Handle<Expression>, sampler: Handle<Expression>, coordinate: Handle<Expression>, array_index: Option<Handle<Expression>>, offset: Option<Handle<Constant>>, level: SampleLevel, depth_ref: Option<Handle<Expression>>, }, ImageLoad { image: Handle<Expression>, coordinate: Handle<Expression>, array_index: Option<Handle<Expression>>, index: Option<Handle<Expression>>, }, ImageQuery { image: Handle<Expression>, query: ImageQuery, }, Unary { op: UnaryOperator, expr: Handle<Expression>, }, Binary { op: BinaryOperator, left: Handle<Expression>, right: Handle<Expression>, }, Select { condition: Handle<Expression>, accept: Handle<Expression>, reject: Handle<Expression>, }, Derivative { axis: DerivativeAxis, expr: Handle<Expression>, }, Relational { fun: RelationalFunction, argument: Handle<Expression>, }, Math { fun: MathFunction, arg: Handle<Expression>, arg1: Option<Handle<Expression>>, arg2: Option<Handle<Expression>>, }, As { expr: Handle<Expression>, kind: ScalarKind, convert: bool, }, Call(Handle<Function>), ArrayLength(Handle<Expression>),
}
Expand description

An expression that can be evaluated to obtain a value.

This is a Single Static Assignment (SSA) scheme similar to SPIR-V.

Variants

Access

Array access with a computed index.

Show fields

Fields of Access

base: Handle<Expression>index: Handle<Expression>
AccessIndex

Array access with a known index.

Show fields

Fields of AccessIndex

base: Handle<Expression>index: u32
Constant(Handle<Constant>)

Constant value.

Splat

Splat scalar into a vector.

Show fields

Fields of Splat

size: VectorSizevalue: Handle<Expression>
Swizzle

Vector swizzle.

Show fields

Fields of Swizzle

size: VectorSizevector: Handle<Expression>pattern: [SwizzleComponent; 4]
Compose

Composite expression.

Show fields

Fields of Compose

ty: Handle<Type>components: Vec<Handle<Expression>>
FunctionArgument(u32)

Reference a function parameter, by its index.

GlobalVariable(Handle<GlobalVariable>)

Reference a global variable.

LocalVariable(Handle<LocalVariable>)

Reference a local variable.

Load

Load a value indirectly.

Show fields

Fields of Load

pointer: Handle<Expression>
ImageSample

Sample a point from a sampled or a depth image.

Show fields

Fields of ImageSample

image: Handle<Expression>sampler: Handle<Expression>coordinate: Handle<Expression>array_index: Option<Handle<Expression>>offset: Option<Handle<Constant>>level: SampleLeveldepth_ref: Option<Handle<Expression>>
ImageLoad

Load a texel from an image.

Show fields

Fields of ImageLoad

image: Handle<Expression>coordinate: Handle<Expression>array_index: Option<Handle<Expression>>index: Option<Handle<Expression>>

For storage images, this is None. For sampled images, this is the Some(Level). For multisampled images, this is Some(Sample).

ImageQuery

Query information from an image.

Show fields

Fields of ImageQuery

image: Handle<Expression>query: ImageQuery
Unary

Apply an unary operator.

Show fields

Fields of Unary

op: UnaryOperatorexpr: Handle<Expression>
Binary

Apply a binary operator.

Show fields

Fields of Binary

op: BinaryOperatorleft: Handle<Expression>right: Handle<Expression>
Select

Select between two values based on a condition.

Show fields

Fields of Select

condition: Handle<Expression>

Boolean expression

accept: Handle<Expression>reject: Handle<Expression>
Derivative

Compute the derivative on an axis.

Show fields

Fields of Derivative

axis: DerivativeAxisexpr: Handle<Expression>
Relational

Call a relational function.

Show fields

Fields of Relational

fun: RelationalFunctionargument: Handle<Expression>
Math

Call a math function

Show fields

Fields of Math

fun: MathFunctionarg: Handle<Expression>arg1: Option<Handle<Expression>>arg2: Option<Handle<Expression>>
As

Cast a simply type to another kind.

Show fields

Fields of As

expr: Handle<Expression>

Source expression, which can only be a scalar or a vector.

kind: ScalarKind

Target scalar kind.

convert: bool

True = conversion needs to take place; False = bitcast.

Result of calling another function.

ArrayLength(Handle<Expression>)

Get the length of an array. The expression must resolve to a pointer to an array with a dynamic size.

This doesn’t match the semantics of spirv’s OpArrayLength, which must be passed a pointer to a structure containing a runtime array in its’ last field.

Implementations

impl Expression[src]

pub fn needs_pre_emit(&self) -> bool[src]

Returns true if the expression is considered emitted at the start of a function.

Trait Implementations

impl Clone for Expression[src]

fn clone(&self) -> Expression[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Expression[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Expression[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Expression[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]