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

Stabilityexperimental
Maintainerconal@conal.net

Shady.CompileEs

Description

Generate and compile vertex and fragment shaders. Unlike Shady.CompileE, this version allows a looser structure to the inputs & outputs of shaders, according to FromE. You can use the types and compile in this module, or just shaders, along with Shady.CompileE, e.g., compile (shaders sh).

Synopsis

Documentation

shaders :: forall u' a' o'. (FromE u', FromE a', FromE o') => (o ~ ExpT o', a ~ ExpT a', u ~ ExpT u') => (HasExpr o, HasType o, Show o) => (u' -> a' :-> o') -> u :=> (a :-> o)Source

Convert loosely structured shaders into single-exp shader

type Pos = R4Source

For gl_Position

data a' :-> o' Source

General vertex/fragment shader pair.

Constructors

forall v' v . (FromE v', v ~ ExpT 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.

Instances

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

shaderProgram :: forall u' a' u a. (FromE u', u ~ ExpT u', FromE a', a ~ ExpT a') => (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.