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 backends.
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
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 toPerspective
and its sampling toCenter
. -
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 Binding
s 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
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