shady-gen-0.5.1: Functional GPU programming - DSEL & compiler

Stabilityexperimental
Maintainerconal@conal.net

Shady.CompileE

Description

Generate and compile vertex and fragment shaders.

In this version, shader programs are represented by functions function a single expression to a single expression. See also CompileEs, which allows functions between more flexible representations.

Synopsis

Documentation

type Pos = R4Source

For gl_Position

data a :-> o Source

For building vertex/fragment shader pairs. The idea is that a complete parameterized shader program has type u :=> a :- v :--> o, which expands to u :=> (a :-^> v, v :-* o).

u == uniform, a == (vertex) attribute, v == varying, o == fragment output.

When o == () (color-only output), use the short-hand u :=> a :-> v.

General vertex/fragment shader pair.

Constructors

forall v . (HasType v, HasExpr v, PrettyPrec v) => ShaderVF (a :-^ v) (v :-* o) 

type ShaderVF a = a :-> ()Source

Vertex/fragment pair with no extra output besides color

data GLSL u a Source

GLSL vertex program, fragment program, uniform and vertex attribute.

Constructors

GLSL String String (Pat u) (Pat a) 

Instances

(HasExpr u, HasExpr a) => Show (GLSL u a) 
(HasExpr u, HasExpr a) => Pretty (GLSL u a) 

shaderProgram :: (HasType a, HasExpr a, HasType u, HasExpr u) => (u :=> ShaderVF a) -> GLSL u aSource

Compile a parameterized shader program. TODO: generalize to non-() outputs, i.e., to u :=> a :-> o.