[−][src]Module luminance::shader::program
Shader programs related types and functions.
A shader Program
is an object representing several operations. It’s a streaming program that
will operate on vertices, vertex patches, primitives and/or fragments.
Note: shader programs don’t have to run on all those objects; they can be ran only on vertices and fragments, for instance.
Creating a shader program is very simple. You need shader Stage
s representing each step of the
processing.
You have to provide at least a vertex and a fragment stages. If you want tessellation processing, you need to provide a tessellation control and tessellation evaluation stages. If you want primitives processing, you need to add a geometry stage.
In order to customize the behavior of your shader programs, you have access to uniforms. For
more details about them, see the documentation for the type Uniform
and trait Uniformable
.
When creating a new shader program, you have to provide code to declare its uniform semantics.
The uniform semantics represent a mapping between the variables declared in your shader
sources and variables you have access in your host code in Rust. Typically, you declare your
variable – Uniform
– in Rust as const
and use the function Uniform::sem
to get the
semantic associated with the string you pass in.
**Becareful: currently, uniforms are a bit messy as you have to provide a per-program unique number when you use the
Uniform::new
method. Efforts will be done in that direction in later releases.
You can create a Program
with its new
associated function.
Structs
Program | A typed shader program. |
ProgramInterface | The shader program interface. |
RawProgram | A raw shader program. |
Uniform | A contravariant shader uniform. |
UniformBuilder | Build uniforms to fold them to a uniform interface. |
Enums
ProgramError | Errors that a |
ProgramWarning | Program warnings, not necessarily considered blocking errors. |
Type | Type of a uniform. |
UniformWarning | Warnings related to uniform issues. |
VertexAttribWarning | Warnings related to vertex attributes issues. |
Traits
UniformInterface | Class of types that can act as uniform interfaces in typed programs. |
Uniformable | Types that can behave as |