Universal shader translator.
The central structure of the crate is
Functions are described in terms of statement trees. A statement may have branching control flow, and it may be mutating. Statements refer to expressions.
Expressions form a DAG, without any side effects. Expressions need to be emitted in order to take effect. This happens in one of the following ways:
- Constants and function arguments are implicitly emitted at function start.
This corresponds to
- Local and global variables are implicitly emitted. However, in order to use parts
of them in right-hand-side expressions, the
Expression::Loadmust be explicitly emitted, with an exception of
- Result of
Statement::Callis automatically emitted.
Statement::Emitrange is explicitly emitted.
Functions which export shader modules into binary and text formats.
Parsers which load shaders into memory.
Module processing functionality.
An arena holding some kind of component (e.g., type, constant, instruction, etc.) that can be referenced.
Early fragment tests. In a standard situation if a driver determines that it is possible to switch on early depth test it will. Typical situations when early depth test is switched off:
Exported function, to be run at a certain stage in the pipeline.
A function defined in the module.
A function argument.
Variable defined at module level.
A strongly typed reference to an arena item.
Variable defined at function level.
A strongly typed range of handles.
Pipeline binding information for global resources.
Flags describing an image.
Member of a user-defined structure.
A case for a switch statement.
A data type declared in the module.
Size of an array.
Operation that can be applied on two values.
Describes how an input/output variable is to be bound.
Built-in inputs and outputs.
Enables adjusting depth without disabling early Z.
Additional information, dependent on the kind of constant.
Axis on which to compute a derivative.
An expression that can be evaluated to obtain a value.
Sub-class of the image type.
The number of dimensions an image has.
Type of an image query.
The interpolation qualifier of a binding or struct field.
Built-in shader function for math.
Built-in shader function for testing relation between values.
Sampling modifier to control the level of detail.
The sampling qualifiers of a binding or struct field.
Primitive type for a scalar.
A literal scalar value, used in constants.
Stage of the programmable pipeline.
Instructions which make up an executable block.
Class of storage for variables.
Qualifier of the type level, at which a struct can be used.
Component selection for a vector swizzle.
Enum with additional information, depending on the kind of type.
Operation that can be applied on a single value.
Number of components in a vector.
Width of a boolean type, in bytes.
A code block is just a vector of statements.
Number of bytes per scalar.
Hash map that is faster but not resilient to DoS attacks.
Hash set that is faster but not resilient to DoS attacks.