Module luminance::shader::program [] [src]

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 Stages 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

AlterUniform

A uniform altered with a value. Type erasure is performed on the type of the uniform so that this type can be collected and pass down to whatever function needs heterogenous collections of altered uniforms.

Program

A shader program.

Sem

A shader uniform semantic. It holds information on the variable it represents such as a name, its type and its dimension.

Uniform

A shader uniform. Uniform<T> doesn’t hold any value. It’s more like a mapping between the host code and the shader the uniform was retrieved from.

Enums

Dim

Dimension of the uniform.

ProgramError

Errors that a Program can generate.

Type

Type of a uniform.

UniformWarning

Warnings related to uniform issues.

Traits

Uniformable

Types that can behave as Uniform.

Type Definitions

SemIndex

Semantic index.