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 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 interface. The uniform interface refers to a type of your own that will be kept by the shader program and exposed to you when you’ll express the need to update its uniforms. That uniform interface is created via a closure you pass. That closure takes as arguments a ProgramProxy used to retrieve Uniforms from the program being constructed. That pattern, that can be a bit overwhelming at first, is important to keep things safe and functional. Keep in mind that you can make the closure fail, so that you can notify a Uniform lookup failure, for instance.

You can create a Program with its new associated function.

Example

TODO

Structs

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

HasProgram

Trait to implement to provide shader program features.

Uniformable

Types that can behave as Uniform.

Type Definitions

SemIndex

Semantic index.