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
Expand description

Array access with a computed index.

Show fields

Fields of Access

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

Array access with a known index.

Show fields

Fields of AccessIndex

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

Constant value.

Splat
Expand description

Splat scalar into a vector.

Show fields

Fields of Splat

size: VectorSizevalue: Handle<Expression>
Swizzle
Expand description

Vector swizzle.

Show fields

Fields of Swizzle

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

Composite expression.

Show fields

Fields of Compose

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

Reference a function parameter, by its index.

GlobalVariable(Handle<GlobalVariable>)
Expand description

Reference a global variable.

LocalVariable(Handle<LocalVariable>)
Expand description

Reference a local variable.

Load
Expand description

Load a value indirectly.

Show fields

Fields of Load

pointer: Handle<Expression>
ImageSample
Expand description

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
Expand description

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>>
Expand description

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

ImageQuery
Expand description

Query information from an image.

Show fields

Fields of ImageQuery

image: Handle<Expression>query: ImageQuery
Unary
Expand description

Apply an unary operator.

Show fields

Fields of Unary

op: UnaryOperatorexpr: Handle<Expression>
Binary
Expand description

Apply a binary operator.

Show fields

Fields of Binary

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

Select between two values based on a condition.

Show fields

Fields of Select

condition: Handle<Expression>
Expand description

Boolean expression

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

Compute the derivative on an axis.

Show fields

Fields of Derivative

axis: DerivativeAxisexpr: Handle<Expression>
Relational
Expand description

Call a relational function.

Show fields

Fields of Relational

fun: RelationalFunctionargument: Handle<Expression>
Math
Expand description

Call a math function

Show fields

Fields of Math

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

Cast a simply type to another kind.

Show fields

Fields of As

expr: Handle<Expression>
Expand description

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

kind: ScalarKind
Expand description

Target scalar kind.

convert: bool
Expand description

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

Expand description

Result of calling another function.

ArrayLength(Handle<Expression>)
Expand description

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]