Built in Functions

Where specified,
T denotes a float, vec2, vec3, or vec4.
U denotes vec2, vec3, vec4, ivec2, ivec3, or ivec4.
M denotes any matrix type.
B denotes bvec2, bvec3, or bvec4.

Trigonometrical Functions (returning T):
radians(T degrees),
degrees(T radians),
sin(T radians),
cos(T radians),
tan(T radians),
asin(T x),
acos(T x),
atan(T x),
atan(T y, T x).
Exponential Functions (returning T):
pow(T x, T y),
exp(T x),
log(T x),
exp2(T x),
log2(T x),
sqrt(T x),
inversesqrt(T x)
Common Functions (returning T):
abs(T x),
floor(T x),
ceil(T x) ,
mod(T x, T y),
min(T x,T y),
max(T x,T y)

sign(T x): returns -1.0, 0.0, or 1.0

fract(T x): x-floor(x)

clamp(T x, T m1, T m2): min(max(x,m1),m2)

mix(T x, T y, T a): linear blend of x and y

step(T edge, T x): 0.0 if x<edge, else 1.0

smoothstep(T edge0, T edge1, T x): clip, smooth
Geometric Functions
returning float:
length(T x), distance(T p0, T p1), dot(T x, T y)

returning vec3:
cross(vec3 x, vec3 y)

returning M:
matrixCompMult(M x, M y):
multiplies x by y component-wise

returning T:
normalize(T x)

faceforward(T N,T l, T Nref):
returns N if dot(Nref,l)<0, else –N

reflect(T l, T N):
reflection direction l-2*dot(N,l)*N

refract(T l, T N, float eta):
refraction vector
Vector Relational Functions:
returning B:
lessThan(U x,U y)
lessThanEqual(U x, U y)
greaterThan(U x, U y)
greaterThanEqual(U x, U y)
equal(U x, U y)
equal(B x, B y)
notEqual(U x, U y)
notEqual(B x, B y)
not(B x)

returning bool:
any(B x): true if any component is true
all(B x): true if all components are true
Texture Lookup Functions (returning vec4):
only in vertex shaders:
texture2DLod(sampler2D s, vec2 coord, float lod)
texture2DProjLod(sampler2D s, vec3 coord, float lod)
texture2DProjLod(sampler2D s, vec4 coord, float lod)
textureCudeLod(samplerCube s, vec3 coord,float lod)

only in fragment shaders:
texture2D(sampler2D s, vec2 coord, float bias)
texture2DProj(sampler2D s, vec3 coord, float bias)
texture2DProj(sampler2D s,vec4 coord, float bias)
textureCube(samplerCube s, vec3 coord, float bias)

in both shaders:
texture2D(sampler2D s, vec2 coord)
texture2DProj(sampler2D s, vec3 coord)
texture2DProj(sampler2D s,vec4 coord)
textureCube(samplerCube s, vec3 coord)