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

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>

Storage for the types defined in this module.

constants: Arena<Constant>

Storage for the constants defined in this module.

global_variables: Arena<GlobalVariable>

Storage for the global variables defined in this module.

functions: Arena<Function>

Storage for the functions defined in this module.

entry_points: Vec<EntryPoint>

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]

impl Default for Module[src]

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

impl Serialize for Module[src]

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]

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

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

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

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

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

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.

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.