Stability | experimental |
---|---|
Maintainer | conal@conal.net |
Abstract syntax for GLSL. Evolving.
- data Program = P {}
- data Shader = Sh [Declaration] [Definition]
- data Declaration = forall a . D [Qualifier] (Pat a)
- data Definition = forall n a . F (Maybe (VectorT n a)) Id [Param] Statement
- data VectorT n a = VectorT (Nat n) (ScalarT a)
- data ScalarT where
- data Param = forall n a . M (VectorT n a) Id
- type Id = String
- data Bind = forall a . B (Pat a) (E a)
- data Statement
- data Qualifier
- data BindO a
- (=::) :: HasType a => V a -> E a -> BindO a
- closeB :: HasType a => BindO a -> Statement
- (=:) :: HasType a => Pat a -> E a -> Statement
- glPosition :: Pat R4
- glFragColor :: Pat R4
- vTrans :: E R4 -> E R4
- nTrans :: E R3 -> E R3
- mainDef :: Statement -> Definition
Syntax types
Program: Vertex shader and Fragment shader
data Declaration Source
Variable declaration/initialization.
data Definition Source
Top-level definition
Statement
Storage qualifier
Handy for building bindings
Utilities
The standard gl_Position variable, which must be set in a vertex shader
The standard gl_FragColor variable, which must be set in a fragment shader
mainDef :: Statement -> DefinitionSource
main
in a shader program.