Struct naga::Module[][src]

pub struct Module {
    pub types: Arena<Type>,
    pub constants: Arena<Constant>,
    pub global_variables: Arena<GlobalVariable>,
    pub functions: Arena<Function>,
    pub entry_points: Vec<EntryPoint>,
}
Expand description

Shader module.

A module is a set of constants, global variables and functions, as well as the types required to define them.

Some functions are marked as entry points, to be used in a certain shader stage.

To create a new module, use the Default implementation. Alternatively, you can load an existing shader using one of the available front ends.

When finished, you can export modules using one of the available back ends.

Fields

types: Arena<Type>
Expand description

Storage for the types defined in this module.

constants: Arena<Constant>
Expand description

Storage for the constants defined in this module.

global_variables: Arena<GlobalVariable>
Expand description

Storage for the global variables defined in this module.

functions: Arena<Function>
Expand description

Storage for the functions defined in this module.

entry_points: Vec<EntryPoint>
Expand description

Entry points.

Implementations

impl Module[src]

pub fn apply_common_default_interpolation(&mut self)[src]

Apply the usual default interpolation for vertex shader outputs and fragment shader inputs.

For every Binding that is a vertex shader output or a fragment shader input, and that has an interpolation or sampling of None, assign a default interpolation and sampling as follows:

  • If the Binding’s type contains only 32-bit floating-point values or vectors of such, default its interpolation to Perspective and its sampling to Center.

  • Otherwise, mark its interpolation as Flat.

When struct appear in input or output types, apply these rules to their leaves, since those are the things that actually get assigned locations.

This function is a utility front ends may use to satisfy the Naga IR’s requirement that all I/O Bindings from the vertex shader to the fragment shader must have non-None interpolation values. This requirement is meant to ensure that input languages’ policies have been applied appropriately.

All the shader languages Naga supports have similar rules: perspective-correct, center-sampled interpolation is the default for any binding that can vary, and everything else either defaults to flat, or requires an explicit flat qualifier/attribute/what-have-you.

Trait Implementations

impl Debug for Module[src]

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

Formats the value using the given formatter. Read more

impl Default for Module[src]

fn default() -> Module[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Module[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 Module[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

impl RefUnwindSafe for Module

impl Send for Module

impl Sync for Module

impl Unpin for Module

impl UnwindSafe for Module

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, 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]