reckfellENGINE

Built-in shader functions

These are shader-language functions, not C# methods. Match overloads to sampler and argument types. Literals 1 and 1.0 have different types. Vector operations a

On this page

These are shader-language functions, not C# methods. Match overloads to sampler and argument types. Literals 1 and 1.0 have different types. Vector operations are usually component-wise; dot, cross and matrix multiplication are distinct operations.

Restrictions

Signatures below come from the current compiler table. [high-end] marks overloads excluded in low-end mode: do not rely on them in Compatibility. Derivatives and textureQueryLod are fragment-only. An out argument must be writable. This catalog describes the language; every GPU/renderer combination was not compiled or visually tested.

Find a function

abs · acos · acosh · all · any · asin · asinh · atan · atanh · bitCount · bitfieldExtract · bitfieldInsert · bitfieldReverse · bool · bvec2 · bvec3 · bvec4 · ceil · clamp · cos · cosh · cross · dFdx · dFdxCoarse · dFdxFine · dFdy · dFdyCoarse · dFdyFine · degrees · determinant · distance · dot · equal · exp · exp2 · faceforward · findLSB · findMSB · float · floatBitsToInt · floatBitsToUint · floor · fma · fract · frexp · fwidth · fwidthCoarse · fwidthFine · greaterThan · greaterThanEqual · imulExtended · int · intBitsToFloat · inverse · inversesqrt · isinf · isnan · ivec2 · ivec3 · ivec4 · ldexp · length · lessThan · lessThanEqual · log · log2 · mat2 · mat3 · mat4 · matrixCompMult · max · min · mix · mod · modf · normalize · not · notEqual · outerProduct · packHalf2x16 · packSnorm2x16 · packSnorm4x8 · packUnorm2x16 · packUnorm4x8 · pow · radians · reflect · refract · round · roundEven · sign · sin · sinh · smoothstep · sqrt · step · tan · tanh · texelFetch · texture · textureGather · textureGrad · textureLod · textureProj · textureProjGrad · textureProjLod · textureQueryLevels · textureQueryLod · textureSize · transpose · trunc · uaddCarry · uint · uintBitsToFloat · umulExtended · unpackHalf2x16 · unpackSnorm2x16 · unpackSnorm4x8 · unpackUnorm2x16 · unpackUnorm4x8 · usubBorrow · uvec2 · uvec3 · uvec4 · vec2 · vec3 · vec4

abs

Absolute value and sign (-1,0,1). Account for absolute-value overflow of the minimum signed int.

Text
float abs(float x)
vec2 abs(vec2 x)
vec3 abs(vec3 x)
vec4 abs(vec4 x)
int abs(int x)
ivec2 abs(ivec2 x)
ivec3 abs(ivec3 x)
ivec4 abs(ivec4 x)

acos

Inverse functions; input in [-1,1], output in radians.

Text
float acos(float x)
vec2 acos(vec2 x)
vec3 acos(vec3 x)
vec4 acos(vec4 x)

acosh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float acosh(float x)
vec2 acosh(vec2 x)
vec3 acosh(vec3 x)
vec4 acosh(vec4 x)

all

Any/all bvec components and component-wise negation.

Text
bool all(bvec2 x)
bool all(bvec3 x)
bool all(bvec4 x)

any

Any/all bvec components and component-wise negation.

Text
bool any(bvec2 x)
bool any(bvec3 x)
bool any(bvec4 x)

asin

Inverse functions; input in [-1,1], output in radians.

Text
float asin(float x)
vec2 asin(vec2 x)
vec3 asin(vec3 x)
vec4 asin(vec4 x)

asinh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float asinh(float x)
vec2 asinh(vec2 x)
vec3 asinh(vec3 x)
vec4 asinh(vec4 x)

atan

One argument: arctan of that value; two: atan(y,x) with quadrant selection. Preserve y,x order.

Text
float atan(float y_over_x)
vec2 atan(vec2 y_over_x)
vec3 atan(vec3 y_over_x)
vec4 atan(vec4 y_over_x)
float atan(float y, float x)
vec2 atan(vec2 y, vec2 x)
vec3 atan(vec3 y, vec3 x)
vec4 atan(vec4 y, vec4 x)

atanh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float atanh(float x)
vec2 atanh(vec2 x)
vec3 atanh(vec3 x)
vec4 atanh(vec4 x)

bitCount

Extract, insert, reverse bits and count set bits. Keep offset/bits within a 32-bit word.

Text
int bitCount(int value) [high-end]
ivec2 bitCount(ivec2 value) [high-end]
ivec3 bitCount(ivec3 value) [high-end]
ivec4 bitCount(ivec4 value) [high-end]
uint bitCount(uint value) [high-end]
uvec2 bitCount(uvec2 value) [high-end]
uvec3 bitCount(uvec3 value) [high-end]
uvec4 bitCount(uvec4 value) [high-end]

bitfieldExtract

Extract, insert, reverse bits and count set bits. Keep offset/bits within a 32-bit word.

Text
int bitfieldExtract(int value, int offset, int bits) [high-end]
ivec2 bitfieldExtract(ivec2 value, int offset, int bits) [high-end]
ivec3 bitfieldExtract(ivec3 value, int offset, int bits) [high-end]
ivec4 bitfieldExtract(ivec4 value, int offset, int bits) [high-end]
uint bitfieldExtract(uint value, int offset, int bits) [high-end]
uvec2 bitfieldExtract(uvec2 value, int offset, int bits) [high-end]
uvec3 bitfieldExtract(uvec3 value, int offset, int bits) [high-end]
uvec4 bitfieldExtract(uvec4 value, int offset, int bits) [high-end]

bitfieldInsert

Extract, insert, reverse bits and count set bits. Keep offset/bits within a 32-bit word.

Text
int bitfieldInsert(int base, int insert, int offset, int bits) [high-end]
ivec2 bitfieldInsert(ivec2 base, ivec2 insert, int offset, int bits) [high-end]
ivec3 bitfieldInsert(ivec3 base, ivec3 insert, int offset, int bits) [high-end]
ivec4 bitfieldInsert(ivec4 base, ivec4 insert, int offset, int bits) [high-end]
uint bitfieldInsert(uint base, uint insert, int offset, int bits) [high-end]
uvec2 bitfieldInsert(uvec2 base, uvec2 insert, int offset, int bits) [high-end]
uvec3 bitfieldInsert(uvec3 base, uvec3 insert, int offset, int bits) [high-end]
uvec4 bitfieldInsert(uvec4 base, uvec4 insert, int offset, int bits) [high-end]

bitfieldReverse

Extract, insert, reverse bits and count set bits. Keep offset/bits within a 32-bit word.

Text
int bitfieldReverse(int value) [high-end]
ivec2 bitfieldReverse(ivec2 value) [high-end]
ivec3 bitfieldReverse(ivec3 value) [high-end]
ivec4 bitfieldReverse(ivec4 value) [high-end]
uint bitfieldReverse(uint value) [high-end]
uvec2 bitfieldReverse(uvec2 value) [high-end]
uvec3 bitfieldReverse(uvec3 value) [high-end]
uvec4 bitfieldReverse(uvec4 value) [high-end]

bool

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
bool bool(bool)
bool bool(int)
bool bool(uint)
bool bool(float)

bvec2

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
bvec2 bvec2(bool)
bvec2 bvec2(bool, bool)
bvec2 bvec2(bvec2)
bvec2 bvec2(ivec2)
bvec2 bvec2(uvec2)
bvec2 bvec2(vec2)

bvec3

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
bvec3 bvec3(bool)
bvec3 bvec3(bool, bool, bool)
bvec3 bvec3(bvec2, bool)
bvec3 bvec3(bool, bvec2)
bvec3 bvec3(bvec3)
bvec3 bvec3(ivec3)
bvec3 bvec3(uvec3)
bvec3 bvec3(vec3)

bvec4

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
bvec4 bvec4(bool)
bvec4 bvec4(bool, bool, bool, bool)
bvec4 bvec4(bool, bvec2, bool)
bvec4 bvec4(bvec2, bool, bool)
bvec4 bvec4(bool, bool, bvec2)
bvec4 bvec4(bool, bvec3)
bvec4 bvec4(bvec3, bool)
bvec4 bvec4(bvec2, bvec2)
bvec4 bvec4(bvec4)
bvec4 bvec4(ivec4)
bvec4 bvec4(uvec4)
bvec4 bvec4(vec4)

ceil

Round down, up and toward zero; results differ for negative values.

Text
float ceil(float x)
vec2 ceil(vec2 x)
vec3 ceil(vec3 x)
vec4 ceil(vec4 x)

clamp

Minimum, maximum and range clamping. clamp requires min<=max.

Text
float clamp(float x, float minVal, float maxVal)
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal)
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal)
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal)
vec2 clamp(vec2 x, float minVal, float maxVal)
vec3 clamp(vec3 x, float minVal, float maxVal)
vec4 clamp(vec4 x, float minVal, float maxVal)
int clamp(int x, int minVal, int maxVal)
ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal)
ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal)
ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal)
ivec2 clamp(ivec2 x, int minVal, int maxVal)
ivec3 clamp(ivec3 x, int minVal, int maxVal)
ivec4 clamp(ivec4 x, int minVal, int maxVal)
uint clamp(uint x, uint minVal, uint maxVal)
uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal)
uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal)
uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal)
uvec2 clamp(uvec2 x, uint minVal, uint maxVal)
uvec3 clamp(uvec3 x, uint minVal, uint maxVal)
uvec4 clamp(uvec4 x, uint minVal, uint maxVal)

cos

Component-wise sine, cosine and tangent.

Text
float cos(float angle)
vec2 cos(vec2 angle)
vec3 cos(vec3 angle)
vec4 cos(vec4 angle)

cosh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float cosh(float x)
vec2 cosh(vec2 x)
vec3 cosh(vec3 x)
vec4 cosh(vec4 x)

cross

Dot product returns a scalar; cross takes two vec3 values and returns a perpendicular vec3.

Text
vec3 cross(vec3 a, vec3 b)

dFdx

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdx(float p)
vec2 dFdx(vec2 p)
vec3 dFdx(vec3 p)
vec4 dFdx(vec4 p)

dFdxCoarse

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdxCoarse(float p) [high-end]
vec2 dFdxCoarse(vec2 p) [high-end]
vec3 dFdxCoarse(vec3 p) [high-end]
vec4 dFdxCoarse(vec4 p) [high-end]

dFdxFine

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdxFine(float p) [high-end]
vec2 dFdxFine(vec2 p) [high-end]
vec3 dFdxFine(vec3 p) [high-end]
vec4 dFdxFine(vec4 p) [high-end]

dFdy

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdy(float p)
vec2 dFdy(vec2 p)
vec3 dFdy(vec3 p)
vec4 dFdy(vec4 p)

dFdyCoarse

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdyCoarse(float p) [high-end]
vec2 dFdyCoarse(vec2 p) [high-end]
vec3 dFdyCoarse(vec3 p) [high-end]
vec4 dFdyCoarse(vec4 p) [high-end]

dFdyFine

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float dFdyFine(float p) [high-end]
vec2 dFdyFine(vec2 p) [high-end]
vec3 dFdyFine(vec3 p) [high-end]
vec4 dFdyFine(vec4 p) [high-end]

degrees

Degrees ↔ radians. Other trigonometric functions use radians.

Text
float degrees(float radians)
vec2 degrees(vec2 radians)
vec3 degrees(vec3 radians)
vec4 degrees(vec4 radians)

determinant

Determinant and square-matrix inverse. Do not invert a singular matrix.

Text
float determinant(mat2 m)
float determinant(mat3 m)
float determinant(mat4 m)

distance

Euclidean vector length and point distance; array.length() is a separate no-argument method.

Text
float distance(float a, float b)
float distance(vec2 a, vec2 b)
float distance(vec3 a, vec3 b)
float distance(vec4 a, vec4 b)

dot

Dot product returns a scalar; cross takes two vec3 values and returns a perpendicular vec3.

Text
float dot(float a, float b)
float dot(vec2 a, vec2 b)
float dot(vec3 a, vec3 b)
float dot(vec4 a, vec4 b)

equal

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 equal(vec2 a, vec2 b)
bvec3 equal(vec3 a, vec3 b)
bvec4 equal(vec4 a, vec4 b)
bvec2 equal(ivec2 a, ivec2 b)
bvec3 equal(ivec3 a, ivec3 b)
bvec4 equal(ivec4 a, ivec4 b)
bvec2 equal(uvec2 a, uvec2 b)
bvec3 equal(uvec3 a, uvec3 b)
bvec4 equal(uvec4 a, uvec4 b)
bvec2 equal(bvec2 a, bvec2 b)
bvec3 equal(bvec3 a, bvec3 b)
bvec4 equal(bvec4 a, bvec4 b)

exp

Base-e/base-2 exponentials and logarithms. log/log2 require x>0.

Text
float exp(float x)
vec2 exp(vec2 x)
vec3 exp(vec3 x)
vec4 exp(vec4 x)

exp2

Base-e/base-2 exponentials and logarithms. log/log2 require x>0.

Text
float exp2(float x)
vec2 exp2(vec2 x)
vec3 exp2(vec3 x)
vec4 exp2(vec4 x)

faceforward

Reflection, refraction and normal orientation. Normalize directions/normals for physical interpretation; refract takes a refractive-index ratio.

Text
vec2 faceforward(vec2 N, vec2 I, vec2 Nref)
vec3 faceforward(vec3 N, vec3 I, vec3 Nref)
vec4 faceforward(vec4 N, vec4 I, vec4 Nref)

findLSB

Index of the least/most significant bit; handle -1 for special inputs including zero.

Text
int findLSB(int value) [high-end]
ivec2 findLSB(ivec2 value) [high-end]
ivec3 findLSB(ivec3 value) [high-end]
ivec4 findLSB(ivec4 value) [high-end]
uint findLSB(uint value) [high-end]
uvec2 findLSB(uvec2 value) [high-end]
uvec3 findLSB(uvec3 value) [high-end]
uvec4 findLSB(uvec4 value) [high-end]

findMSB

Index of the least/most significant bit; handle -1 for special inputs including zero.

Text
int findMSB(int value) [high-end]
ivec2 findMSB(ivec2 value) [high-end]
ivec3 findMSB(ivec3 value) [high-end]
ivec4 findMSB(ivec4 value) [high-end]
uint findMSB(uint value) [high-end]
uvec2 findMSB(uvec2 value) [high-end]
uvec3 findMSB(uvec3 value) [high-end]
uvec4 findMSB(uvec4 value) [high-end]

float

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
float float(bool)
float float(int)
float float(uint)
float float(float)

floatBitsToInt

Bit reinterpretation, not numeric conversion. Use a type constructor for numeric conversion.

Text
int floatBitsToInt(float x)
ivec2 floatBitsToInt(vec2 x)
ivec3 floatBitsToInt(vec3 x)
ivec4 floatBitsToInt(vec4 x)

floatBitsToUint

Bit reinterpretation, not numeric conversion. Use a type constructor for numeric conversion.

Text
uint floatBitsToUint(float x)
uvec2 floatBitsToUint(vec2 x)
uvec3 floatBitsToUint(vec3 x)
uvec4 floatBitsToUint(vec4 x)

floor

Round down, up and toward zero; results differ for negative values.

Text
float floor(float x)
vec2 floor(vec2 x)
vec3 floor(vec3 x)
vec4 floor(vec4 x)

fma

Fused multiply-add a*b+c; do not assume the same precision as separate operations.

Text
float fma(float a, float b, float c) [high-end]
vec2 fma(vec2 a, vec2 b, vec2 c) [high-end]
vec3 fma(vec3 a, vec3 b, vec3 c) [high-end]
vec4 fma(vec4 a, vec4 b, vec4 c) [high-end]

fract

fract=x-floor(x); mod=x-y*floor(x/y), y!=0; modf returns the fractional part and writes the integral part to out.

Text
float fract(float x)
vec2 fract(vec2 x)
vec3 fract(vec3 x)
vec4 fract(vec4 x)

frexp

Decompose x=significand*2^exponent and compose it. The current compiler marks argument two of both functions out, including ldexp; pass a writable variable rather than a literal.

Text
float frexp(float x, out int exp) [high-end]
vec2 frexp(vec2 x, out ivec2 exp) [high-end]
vec3 frexp(vec3 x, out ivec3 exp) [high-end]
vec4 frexp(vec4 x, out ivec4 exp) [high-end]

fwidth

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float fwidth(float p)
vec2 fwidth(vec2 p)
vec3 fwidth(vec3 p)
vec4 fwidth(vec4 p)

fwidthCoarse

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float fwidthCoarse(float p) [high-end]
vec2 fwidthCoarse(vec2 p) [high-end]
vec3 fwidthCoarse(vec3 p) [high-end]
vec4 fwidthCoarse(vec4 p) [high-end]

fwidthFine

Screen derivatives in fragment; fwidth=abs(dFdx)+abs(dFdy). Not for vertex; do not rely on defined results in nonuniform control flow.

Fragment only.

Text
float fwidthFine(float p) [high-end]
vec2 fwidthFine(vec2 p) [high-end]
vec3 fwidthFine(vec3 p) [high-end]
vec4 fwidthFine(vec4 p) [high-end]

greaterThan

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 greaterThan(vec2 a, vec2 b)
bvec3 greaterThan(vec3 a, vec3 b)
bvec4 greaterThan(vec4 a, vec4 b)
bvec2 greaterThan(ivec2 a, ivec2 b)
bvec3 greaterThan(ivec3 a, ivec3 b)
bvec4 greaterThan(ivec4 a, ivec4 b)
bvec2 greaterThan(uvec2 a, uvec2 b)
bvec3 greaterThan(uvec3 a, uvec3 b)
bvec4 greaterThan(uvec4 a, uvec4 b)

greaterThanEqual

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 greaterThanEqual(vec2 a, vec2 b)
bvec3 greaterThanEqual(vec3 a, vec3 b)
bvec4 greaterThanEqual(vec4 a, vec4 b)
bvec2 greaterThanEqual(ivec2 a, ivec2 b)
bvec3 greaterThanEqual(ivec3 a, ivec3 b)
bvec4 greaterThanEqual(ivec4 a, ivec4 b)
bvec2 greaterThanEqual(uvec2 a, uvec2 b)
bvec3 greaterThanEqual(uvec3 a, uvec3 b)
bvec4 greaterThanEqual(uvec4 a, uvec4 b)

imulExtended

Extended multiplication writes high and low halves to out parameters; return type is void.

Text
void imulExtended(int x, int y, out int msb, out int lsb) [high-end]
void imulExtended(ivec2 x, ivec2 y, out ivec2 msb, out ivec2 lsb) [high-end]
void imulExtended(ivec3 x, ivec3 y, out ivec3 msb, out ivec3 lsb) [high-end]
void imulExtended(ivec4 x, ivec4 y, out ivec4 msb, out ivec4 lsb) [high-end]

int

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
int int(bool)
int int(int)
int int(uint)
int int(float)

intBitsToFloat

Bit reinterpretation, not numeric conversion. Use a type constructor for numeric conversion.

Text
float intBitsToFloat(int x)
vec2 intBitsToFloat(ivec2 x)
vec3 intBitsToFloat(ivec3 x)
vec4 intBitsToFloat(ivec4 x)

inverse

Determinant and square-matrix inverse. Do not invert a singular matrix.

Text
mat2 inverse(mat2 m)
mat3 inverse(mat3 m)
mat4 inverse(mat4 m)

inversesqrt

Square root and reciprocal square root; sqrt requires x>=0, inversesqrt requires x>0.

Text
float inversesqrt(float x)
vec2 inversesqrt(vec2 x)
vec3 inversesqrt(vec3 x)
vec4 inversesqrt(vec4 x)

isinf

Component-wise NaN/infinity tests; results are bool/bvec, not repaired inputs.

Text
bool isinf(float x)
bvec2 isinf(vec2 x)
bvec3 isinf(vec3 x)
bvec4 isinf(vec4 x)

isnan

Component-wise NaN/infinity tests; results are bool/bvec, not repaired inputs.

Text
bool isnan(float x)
bvec2 isnan(vec2 x)
bvec3 isnan(vec3 x)
bvec4 isnan(vec4 x)

ivec2

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
ivec2 ivec2(int)
ivec2 ivec2(int, int)
ivec2 ivec2(bvec2)
ivec2 ivec2(ivec2)
ivec2 ivec2(uvec2)
ivec2 ivec2(vec2)

ivec3

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
ivec3 ivec3(int)
ivec3 ivec3(int, int, int)
ivec3 ivec3(ivec2, int)
ivec3 ivec3(int, ivec2)
ivec3 ivec3(bvec3)
ivec3 ivec3(ivec3)
ivec3 ivec3(uvec3)
ivec3 ivec3(vec3)

ivec4

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
ivec4 ivec4(int)
ivec4 ivec4(int, int, int, int)
ivec4 ivec4(int, ivec2, int)
ivec4 ivec4(ivec2, int, int)
ivec4 ivec4(int, int, ivec2)
ivec4 ivec4(int, ivec3)
ivec4 ivec4(ivec3, int)
ivec4 ivec4(ivec2, ivec2)
ivec4 ivec4(bvec4)
ivec4 ivec4(ivec4)
ivec4 ivec4(uvec4)
ivec4 ivec4(vec4)

ldexp

Decompose x=significand*2^exponent and compose it. The current compiler marks argument two of both functions out, including ldexp; pass a writable variable rather than a literal.

Text
float ldexp(float x, out int exp) [high-end]
vec2 ldexp(vec2 x, out ivec2 exp) [high-end]
vec3 ldexp(vec3 x, out ivec3 exp) [high-end]
vec4 ldexp(vec4 x, out ivec4 exp) [high-end]

length

Euclidean vector length and point distance; array.length() is a separate no-argument method.

Text
float length(float x)
float length(vec2 x)
float length(vec3 x)
float length(vec4 x)
int array.length()

lessThan

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 lessThan(vec2 a, vec2 b)
bvec3 lessThan(vec3 a, vec3 b)
bvec4 lessThan(vec4 a, vec4 b)
bvec2 lessThan(ivec2 a, ivec2 b)
bvec3 lessThan(ivec3 a, ivec3 b)
bvec4 lessThan(ivec4 a, ivec4 b)
bvec3 lessThan(uvec3 a, uvec3 b)
bvec4 lessThan(uvec4 a, uvec4 b)
bvec2 lessThan(uvec2 a, uvec2 b)

lessThanEqual

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 lessThanEqual(vec2 a, vec2 b)
bvec3 lessThanEqual(vec3 a, vec3 b)
bvec4 lessThanEqual(vec4 a, vec4 b)
bvec2 lessThanEqual(ivec2 a, ivec2 b)
bvec3 lessThanEqual(ivec3 a, ivec3 b)
bvec4 lessThanEqual(ivec4 a, ivec4 b)
bvec2 lessThanEqual(uvec2 a, uvec2 b)
bvec3 lessThanEqual(uvec3 a, uvec3 b)
bvec4 lessThanEqual(uvec4 a, uvec4 b)

log

Base-e/base-2 exponentials and logarithms. log/log2 require x>0.

Text
float log(float x)
vec2 log(vec2 x)
vec3 log(vec3 x)
vec4 log(vec4 x)

log2

Base-e/base-2 exponentials and logarithms. log/log2 require x>0.

Text
float log2(float x)
vec2 log2(vec2 x)
vec3 log2(vec3 x)
vec4 log2(vec4 x)

mat2

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
mat2 mat2(vec2, vec2)
mat2 mat2(float)
mat2 mat2(mat3)
mat2 mat2(mat4)

mat3

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
mat3 mat3(vec3, vec3, vec3)
mat3 mat3(float)
mat3 mat3(mat2)
mat3 mat3(mat4)

mat4

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
mat4 mat4(vec4, vec4, vec4, vec4)
mat4 mat4(float)
mat4 mat4(mat2)
mat4 mat4(mat3)

matrixCompMult

Component-wise matrix product, vector outer product and transpose. matrixCompMult is not ordinary matrix multiplication with *.

Text
mat2 matrixCompMult(mat2 a, mat2 b)
mat3 matrixCompMult(mat3 a, mat3 b)
mat4 matrixCompMult(mat4 a, mat4 b)

max

Minimum, maximum and range clamping. clamp requires min<=max.

Text
float max(float a, float b)
vec2 max(vec2 a, vec2 b)
vec2 max(vec2 a, float b)
vec3 max(vec3 a, vec3 b)
vec3 max(vec3 a, float b)
vec4 max(vec4 a, vec4 b)
vec4 max(vec4 a, float b)
int max(int a, int b)
ivec2 max(ivec2 a, ivec2 b)
ivec2 max(ivec2 a, int b)
ivec3 max(ivec3 a, ivec3 b)
ivec3 max(ivec3 a, int b)
ivec4 max(ivec4 a, ivec4 b)
ivec4 max(ivec4 a, int b)
uint max(uint a, uint b)
uvec2 max(uvec2 a, uvec2 b)
uvec2 max(uvec2 a, uint b)
uvec3 max(uvec3 a, uvec3 b)
uvec3 max(uvec3 a, uint b)
uvec4 max(uvec4 a, uvec4 b)
uvec4 max(uvec4 a, uint b)

min

Minimum, maximum and range clamping. clamp requires min<=max.

Text
float min(float a, float b)
vec2 min(vec2 a, vec2 b)
vec2 min(vec2 a, float b)
vec3 min(vec3 a, vec3 b)
vec3 min(vec3 a, float b)
vec4 min(vec4 a, vec4 b)
vec4 min(vec4 a, float b)
int min(int a, int b)
ivec2 min(ivec2 a, ivec2 b)
ivec2 min(ivec2 a, int b)
ivec3 min(ivec3 a, ivec3 b)
ivec3 min(ivec3 a, int b)
ivec4 min(ivec4 a, ivec4 b)
ivec4 min(ivec4 a, int b)
uint min(uint a, uint b)
uvec2 min(uvec2 a, uvec2 b)
uvec2 min(uvec2 a, uint b)
uvec3 min(uvec3 a, uvec3 b)
uvec3 min(uvec3 a, uint b)
uvec4 min(uvec4 a, uvec4 b)
uvec4 min(uvec4 a, uint b)

mix

Linear interpolation x*(1-a)+y*a; a outside [0,1] extrapolates. Boolean overloads select components.

Text
float mix(float a, float b, float value)
vec2 mix(vec2 a, vec2 b, float value)
vec2 mix(vec2 a, vec2 b, bvec2 value)
vec2 mix(vec2 a, vec2 b, vec2 value)
vec3 mix(vec3 a, vec3 b, float value)
vec3 mix(vec3 a, vec3 b, bvec3 value)
vec3 mix(vec3 a, vec3 b, vec3 value)
vec4 mix(vec4 a, vec4 b, float value)
vec4 mix(vec4 a, vec4 b, bvec4 value)
vec4 mix(vec4 a, vec4 b, vec4 value)

mod

fract=x-floor(x); mod=x-y*floor(x/y), y!=0; modf returns the fractional part and writes the integral part to out.

Text
float mod(float x, float y)
vec2 mod(vec2 x, vec2 y)
vec2 mod(vec2 x, float y)
vec3 mod(vec3 x, vec3 y)
vec3 mod(vec3 x, float y)
vec4 mod(vec4 x, vec4 y)
vec4 mod(vec4 x, float y)

modf

fract=x-floor(x); mod=x-y*floor(x/y), y!=0; modf returns the fractional part and writes the integral part to out.

Text
float modf(float x, out float i)
vec2 modf(vec2 x, out vec2 i)
vec3 modf(vec3 x, out vec3 i)
vec4 modf(vec4 x, out vec4 i)

normalize

Unit-length vector. Supply your own fallback before calling with zero input.

Text
float normalize(float v)
vec2 normalize(vec2 v)
vec3 normalize(vec3 v)
vec4 normalize(vec4 v)

not

Any/all bvec components and component-wise negation.

Text
bvec2 not(bvec2 x)
bvec3 not(bvec3 x)
bvec4 not(bvec4 x)

notEqual

Component-wise vector comparisons return bvec. Use all/any to obtain one bool.

Text
bvec2 notEqual(vec2 a, vec2 b)
bvec3 notEqual(vec3 a, vec3 b)
bvec4 notEqual(vec4 a, vec4 b)
bvec2 notEqual(ivec2 a, ivec2 b)
bvec3 notEqual(ivec3 a, ivec3 b)
bvec4 notEqual(ivec4 a, ivec4 b)
bvec2 notEqual(uvec2 a, uvec2 b)
bvec3 notEqual(uvec3 a, uvec3 b)
bvec4 notEqual(uvec4 a, uvec4 b)
bvec2 notEqual(bvec2 a, bvec2 b)
bvec3 notEqual(bvec3 a, bvec3 b)
bvec4 notEqual(bvec4 a, bvec4 b)

outerProduct

Component-wise matrix product, vector outer product and transpose. matrixCompMult is not ordinary matrix multiplication with *.

Text
mat2 outerProduct(vec2 c, vec2 r)
mat3 outerProduct(vec3 c, vec3 r)
mat4 outerProduct(vec4 c, vec4 r)

packHalf2x16

Pack two floats as half precision and unpack them; precision can be lost.

Text
uint packHalf2x16(vec2 v)

packSnorm2x16

Pack/unpack signed normalized [-1,1] components in a uint.

Text
uint packSnorm2x16(vec2 v)

packSnorm4x8

Pack/unpack signed normalized [-1,1] components in a uint.

Text
uint packSnorm4x8(vec4 v)

packUnorm2x16

Pack/unpack unsigned normalized [0,1] components in a uint.

Text
uint packUnorm2x16(vec2 v)

packUnorm4x8

Pack/unpack unsigned normalized [0,1] components in a uint.

Text
uint packUnorm4x8(vec4 v)

pow

x raised to y. Negative bases are outside the general defined domain; also avoid zero with y<=0.

Text
float pow(float x, float y)
vec2 pow(vec2 x, vec2 y)
vec3 pow(vec3 x, vec3 y)
vec4 pow(vec4 x, vec4 y)

radians

Degrees ↔ radians. Other trigonometric functions use radians.

Text
float radians(float degrees)
vec2 radians(vec2 degrees)
vec3 radians(vec3 degrees)
vec4 radians(vec4 degrees)

reflect

Reflection, refraction and normal orientation. Normalize directions/normals for physical interpretation; refract takes a refractive-index ratio.

Text
vec2 reflect(vec2 I, vec2 N)
vec3 reflect(vec3 I, vec3 N)
vec4 reflect(vec4 I, vec4 N)

refract

Reflection, refraction and normal orientation. Normalize directions/normals for physical interpretation; refract takes a refractive-index ratio.

Text
vec2 refract(vec2 I, vec2 N, float eta)
vec3 refract(vec3 I, vec3 N, float eta)
vec4 refract(vec4 I, vec4 N, float eta)

round

Nearest integer: roundEven resolves halfway cases to even; do not use round when ties-to-even is required.

Text
float round(float x)
vec2 round(vec2 x)
vec3 round(vec3 x)
vec4 round(vec4 x)

roundEven

Nearest integer: roundEven resolves halfway cases to even; do not use round when ties-to-even is required.

Text
float roundEven(float x)
vec2 roundEven(vec2 x)
vec3 roundEven(vec3 x)
vec4 roundEven(vec4 x)

sign

Absolute value and sign (-1,0,1). Account for absolute-value overflow of the minimum signed int.

Text
float sign(float x)
vec2 sign(vec2 x)
vec3 sign(vec3 x)
vec4 sign(vec4 x)
int sign(int x)
ivec2 sign(ivec2 x)
ivec3 sign(ivec3 x)
ivec4 sign(ivec4 x)

sin

Component-wise sine, cosine and tangent.

Text
float sin(float angle)
vec2 sin(vec2 angle)
vec3 sin(vec3 angle)
vec4 sin(vec4 angle)

sinh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float sinh(float x)
vec2 sinh(vec2 x)
vec3 sinh(vec3 x)
vec4 sinh(vec4 x)

smoothstep

step(edge,x) returns zero for x<edge, one otherwise. smoothstep smooths the transition; edge0 must be below edge1.

Text
float smoothstep(float edge0, float edge1, float value)
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 value)
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 value)
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 value)
vec2 smoothstep(float edge0, float edge1, vec2 value)
vec3 smoothstep(float edge0, float edge1, vec3 value)
vec4 smoothstep(float edge0, float edge1, vec4 value)

sqrt

Square root and reciprocal square root; sqrt requires x>=0, inversesqrt requires x>0.

Text
float sqrt(float x)
vec2 sqrt(vec2 x)
vec3 sqrt(vec3 x)
vec4 sqrt(vec4 x)

step

step(edge,x) returns zero for x<edge, one otherwise. smoothstep smooths the transition; edge0 must be below edge1.

Text
float step(float edge, float x)
vec2 step(vec2 edge, vec2 x)
vec3 step(vec3 edge, vec3 x)
vec4 step(vec4 edge, vec4 x)
vec2 step(float edge, vec2 x)
vec3 step(float edge, vec3 x)
vec4 step(float edge, vec4 x)

tan

Component-wise sine, cosine and tangent.

Text
float tan(float angle)
vec2 tan(vec2 angle)
vec3 tan(vec3 angle)
vec4 tan(vec4 angle)

tanh

Hyperbolic and inverse functions; acosh requires x>=1, atanh requires abs(x)<1.

Text
float tanh(float x)
vec2 tanh(vec2 x)
vec3 tanh(vec3 x)
vec4 tanh(vec4 x)

texelFetch

Read a texel by integer coordinate and LOD without ordinary texture filtering. Check bounds.

Text
vec4 texelFetch(sampler2D sampler, ivec2 coords, int lod)
ivec4 texelFetch(isampler2D sampler, ivec2 coords, int lod)
uvec4 texelFetch(usampler2D sampler, ivec2 coords, int lod)
vec4 texelFetch(sampler2DArray sampler, ivec3 coords, int lod)
ivec4 texelFetch(isampler2DArray sampler, ivec3 coords, int lod)
uvec4 texelFetch(usampler2DArray sampler, ivec3 coords, int lod)
vec4 texelFetch(sampler3D sampler, ivec3 coords, int lod)
ivec4 texelFetch(isampler3D sampler, ivec3 coords, int lod)
uvec4 texelFetch(usampler3D sampler, ivec3 coords, int lod)

texture

Texture sampling; textureProj divides coordinates by the projection component. Sampler type determines result type.

Text
vec4 texture(sampler2D sampler, vec2 coords)
vec4 texture(sampler2D sampler, vec2 coords, float bias)
uvec4 texture(usampler2D sampler, vec2 coords)
uvec4 texture(usampler2D sampler, vec2 coords, float bias)
ivec4 texture(isampler2D sampler, vec2 coords)
ivec4 texture(isampler2D sampler, vec2 coords, float bias)
vec4 texture(sampler2DArray sampler, vec3 coords)
vec4 texture(sampler2DArray sampler, vec3 coords, float bias)
uvec4 texture(usampler2DArray sampler, vec3 coords)
uvec4 texture(usampler2DArray sampler, vec3 coords, float bias)
ivec4 texture(isampler2DArray sampler, vec3 coords)
ivec4 texture(isampler2DArray sampler, vec3 coords, float bias)
vec4 texture(sampler3D sampler, vec3 coords)
vec4 texture(sampler3D sampler, vec3 coords, float bias)
uvec4 texture(usampler3D sampler, vec3 coords)
uvec4 texture(usampler3D sampler, vec3 coords, float bias)
ivec4 texture(isampler3D sampler, vec3 coords)
ivec4 texture(isampler3D sampler, vec3 coords, float bias)
vec4 texture(samplerCube sampler, vec3 coords)
vec4 texture(samplerCube sampler, vec3 coords, float bias)
vec4 texture(samplerCubeArray sampler, vec4 coords)
vec4 texture(samplerCubeArray sampler, vec4 coords, float bias)
vec4 texture(samplerExternalOES sampler, vec2 coords)
vec4 texture(samplerExternalOES sampler, vec2 coords, float bias)

textureGather

Gather four values of one selected channel. The component argument must be a constant from zero through three.

Text
vec4 textureGather(sampler2D sampler, vec2 coords) [high-end]
ivec4 textureGather(isampler2D sampler, vec2 coords) [high-end]
uvec4 textureGather(usampler2D sampler, vec2 coords) [high-end]
vec4 textureGather(sampler2D sampler, vec2 coords, int comp) [high-end]
ivec4 textureGather(isampler2D sampler, vec2 coords, int comp) [high-end]
uvec4 textureGather(usampler2D sampler, vec2 coords, int comp) [high-end]
vec4 textureGather(sampler2DArray sampler, vec3 coords) [high-end]
ivec4 textureGather(isampler2DArray sampler, vec3 coords) [high-end]
uvec4 textureGather(usampler2DArray sampler, vec3 coords) [high-end]
vec4 textureGather(sampler2DArray sampler, vec3 coords, int comp) [high-end]
ivec4 textureGather(isampler2DArray sampler, vec3 coords, int comp) [high-end]
uvec4 textureGather(usampler2DArray sampler, vec3 coords, int comp) [high-end]
vec4 textureGather(samplerCube sampler, vec3 coords) [high-end]
vec4 textureGather(samplerCube sampler, vec3 coords, int comp) [high-end]

textureGrad

Sampling with explicit coordinate gradients for mip selection.

Text
vec4 textureGrad(sampler2D sampler, vec2 coords, vec2 dPdx, vec2 dPdy)
ivec4 textureGrad(isampler2D sampler, vec2 coords, vec2 dPdx, vec2 dPdy)
uvec4 textureGrad(usampler2D sampler, vec2 coords, vec2 dPdx, vec2 dPdy)
vec4 textureGrad(sampler2DArray sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
ivec4 textureGrad(isampler2DArray sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
uvec4 textureGrad(usampler2DArray sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
vec4 textureGrad(sampler3D sampler, vec3 coords, vec3 dPdx, vec3 dPdy)
ivec4 textureGrad(isampler3D sampler, vec3 coords, vec3 dPdx, vec3 dPdy)
uvec4 textureGrad(usampler3D sampler, vec3 coords, vec3 dPdx, vec3 dPdy)
vec4 textureGrad(samplerCube sampler, vec3 coords, vec3 dPdx, vec3 dPdy)
vec4 textureGrad(samplerCubeArray sampler, vec4 coords, vec3 dPdx, vec3 dPdy)

textureLod

Sampling with explicit LOD; the projected variant also transforms coordinates.

Text
vec4 textureLod(sampler2D sampler, vec2 coords, float lod)
ivec4 textureLod(isampler2D sampler, vec2 coords, float lod)
uvec4 textureLod(usampler2D sampler, vec2 coords, float lod)
vec4 textureLod(sampler2DArray sampler, vec3 coords, float lod)
ivec4 textureLod(isampler2DArray sampler, vec3 coords, float lod)
uvec4 textureLod(usampler2DArray sampler, vec3 coords, float lod)
vec4 textureLod(sampler3D sampler, vec3 coords, float lod)
ivec4 textureLod(isampler3D sampler, vec3 coords, float lod)
uvec4 textureLod(usampler3D sampler, vec3 coords, float lod)
vec4 textureLod(samplerCube sampler, vec3 coords, float lod)
vec4 textureLod(samplerCubeArray sampler, vec4 coords, float lod)

textureProj

Texture sampling; textureProj divides coordinates by the projection component. Sampler type determines result type.

Text
vec4 textureProj(sampler2D sampler, vec3 coords)
vec4 textureProj(sampler2D sampler, vec4 coords)
vec4 textureProj(sampler2D sampler, vec3 coords, float bias)
vec4 textureProj(sampler2D sampler, vec4 coords, float bias)
ivec4 textureProj(isampler2D sampler, vec3 coords)
ivec4 textureProj(isampler2D sampler, vec4 coords)
ivec4 textureProj(isampler2D sampler, vec3 coords, float bias)
ivec4 textureProj(isampler2D sampler, vec4 coords, float bias)
uvec4 textureProj(usampler2D sampler, vec3 coords)
uvec4 textureProj(usampler2D sampler, vec4 coords)
uvec4 textureProj(usampler2D sampler, vec3 coords, float bias)
uvec4 textureProj(usampler2D sampler, vec4 coords, float bias)
vec4 textureProj(sampler3D sampler, vec4 coords)
vec4 textureProj(sampler3D sampler, vec4 coords, float bias)
ivec4 textureProj(isampler3D sampler, vec4 coords)
ivec4 textureProj(isampler3D sampler, vec4 coords, float bias)
uvec4 textureProj(usampler3D sampler, vec4 coords)
uvec4 textureProj(usampler3D sampler, vec4 coords, float bias)

textureProjGrad

Sampling with explicit coordinate gradients for mip selection.

Text
vec4 textureProjGrad(sampler2D sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
vec4 textureProjGrad(sampler2D sampler, vec4 coords, vec2 dPdx, vec2 dPdy)
ivec4 textureProjGrad(isampler2D sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
ivec4 textureProjGrad(isampler2D sampler, vec4 coords, vec2 dPdx, vec2 dPdy)
uvec4 textureProjGrad(usampler2D sampler, vec3 coords, vec2 dPdx, vec2 dPdy)
uvec4 textureProjGrad(usampler2D sampler, vec4 coords, vec2 dPdx, vec2 dPdy)
vec4 textureProjGrad(sampler3D sampler, vec4 coords, vec3 dPdx, vec3 dPdy)
ivec4 textureProjGrad(isampler3D sampler, vec4 coords, vec3 dPdx, vec3 dPdy)
uvec4 textureProjGrad(usampler3D sampler, vec4 coords, vec3 dPdx, vec3 dPdy)

textureProjLod

Sampling with explicit LOD; the projected variant also transforms coordinates.

Text
vec4 textureProjLod(sampler2D sampler, vec3 coords, float lod)
vec4 textureProjLod(sampler2D sampler, vec4 coords, float lod)
ivec4 textureProjLod(isampler2D sampler, vec3 coords, float lod)
ivec4 textureProjLod(isampler2D sampler, vec4 coords, float lod)
uvec4 textureProjLod(usampler2D sampler, vec3 coords, float lod)
uvec4 textureProjLod(usampler2D sampler, vec4 coords, float lod)
vec4 textureProjLod(sampler3D sampler, vec4 coords, float lod)
ivec4 textureProjLod(isampler3D sampler, vec4 coords, float lod)
uvec4 textureProjLod(usampler3D sampler, vec4 coords, float lod)

textureQueryLevels

Mip dimensions, mip-level count and LOD query. textureQueryLod is fragment-only; check renderer availability.

Text
int textureQueryLevels(sampler2D sampler) [high-end]
int textureQueryLevels(isampler2D sampler) [high-end]
int textureQueryLevels(usampler2D sampler) [high-end]
int textureQueryLevels(sampler2DArray sampler) [high-end]
int textureQueryLevels(isampler2DArray sampler) [high-end]
int textureQueryLevels(usampler2DArray sampler) [high-end]
int textureQueryLevels(sampler3D sampler) [high-end]
int textureQueryLevels(isampler3D sampler) [high-end]
int textureQueryLevels(usampler3D sampler) [high-end]
int textureQueryLevels(samplerCube sampler) [high-end]

textureQueryLod

Mip dimensions, mip-level count and LOD query. textureQueryLod is fragment-only; check renderer availability.

Fragment only.

Text
vec2 textureQueryLod(sampler2D sampler, vec2 coords) [high-end]
vec2 textureQueryLod(isampler2D sampler, vec2 coords) [high-end]
vec2 textureQueryLod(usampler2D sampler, vec2 coords) [high-end]
vec2 textureQueryLod(sampler2DArray sampler, vec2 coords) [high-end]
vec2 textureQueryLod(isampler2DArray sampler, vec2 coords) [high-end]
vec2 textureQueryLod(usampler2DArray sampler, vec2 coords) [high-end]
vec2 textureQueryLod(sampler3D sampler, vec3 coords) [high-end]
vec2 textureQueryLod(isampler3D sampler, vec3 coords) [high-end]
vec2 textureQueryLod(usampler3D sampler, vec3 coords) [high-end]
vec2 textureQueryLod(samplerCube sampler, vec3 coords) [high-end]

textureSize

Mip dimensions, mip-level count and LOD query. textureQueryLod is fragment-only; check renderer availability.

Text
ivec2 textureSize(sampler2D sampler, int lod)
ivec2 textureSize(isampler2D sampler, int lod)
ivec2 textureSize(usampler2D sampler, int lod)
ivec3 textureSize(sampler2DArray sampler, int lod)
ivec3 textureSize(isampler2DArray sampler, int lod)
ivec3 textureSize(usampler2DArray sampler, int lod)
ivec3 textureSize(sampler3D sampler, int lod)
ivec3 textureSize(isampler3D sampler, int lod)
ivec3 textureSize(usampler3D sampler, int lod)
ivec2 textureSize(samplerCube sampler, int lod)
ivec2 textureSize(samplerCubeArray sampler, int lod)

transpose

Component-wise matrix product, vector outer product and transpose. matrixCompMult is not ordinary matrix multiplication with *.

Text
mat2 transpose(mat2 m)
mat3 transpose(mat3 m)
mat4 transpose(mat4 m)

trunc

Round down, up and toward zero; results differ for negative values.

Text
float trunc(float x)
vec2 trunc(vec2 x)
vec3 trunc(vec3 x)
vec4 trunc(vec4 x)

uaddCarry

Unsigned addition/subtraction with a separate carry/borrow out argument.

Text
uint uaddCarry(uint x, uint y, out uint carry) [high-end]
uvec2 uaddCarry(uvec2 x, uvec2 y, out uvec2 carry) [high-end]
uvec3 uaddCarry(uvec3 x, uvec3 y, out uvec3 carry) [high-end]
uvec4 uaddCarry(uvec4 x, uvec4 y, out uvec4 carry) [high-end]

uint

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
uint uint(bool)
uint uint(int)
uint uint(uint)
uint uint(float)

uintBitsToFloat

Bit reinterpretation, not numeric conversion. Use a type constructor for numeric conversion.

Text
float uintBitsToFloat(uint x)
vec2 uintBitsToFloat(uvec2 x)
vec3 uintBitsToFloat(uvec3 x)
vec4 uintBitsToFloat(uvec4 x)

umulExtended

Extended multiplication writes high and low halves to out parameters; return type is void.

Text
void umulExtended(uint x, uint y, out uint msb, out uint lsb) [high-end]
void umulExtended(uvec2 x, uvec2 y, out uvec2 msb, out uvec2 lsb) [high-end]
void umulExtended(uvec3 x, uvec3 y, out uvec3 msb, out uvec3 lsb) [high-end]
void umulExtended(uvec4 x, uvec4 y, out uvec4 msb, out uvec4 lsb) [high-end]

unpackHalf2x16

Pack two floats as half precision and unpack them; precision can be lost.

Text
vec2 unpackHalf2x16(uint v)

unpackSnorm2x16

Pack/unpack signed normalized [-1,1] components in a uint.

Text
vec2 unpackSnorm2x16(uint v)

unpackSnorm4x8

Pack/unpack signed normalized [-1,1] components in a uint.

Text
vec4 unpackSnorm4x8(uint v)

unpackUnorm2x16

Pack/unpack unsigned normalized [0,1] components in a uint.

Text
vec2 unpackUnorm2x16(uint v)

unpackUnorm4x8

Pack/unpack unsigned normalized [0,1] components in a uint.

Text
vec4 unpackUnorm4x8(uint v)

usubBorrow

Unsigned addition/subtraction with a separate carry/borrow out argument.

Text
uint usubBorrow(uint x, uint y, out uint borrow) [high-end]
uvec2 usubBorrow(uvec2 x, uvec2 y, out uvec2 borrow) [high-end]
uvec3 usubBorrow(uvec3 x, uvec3 y, out uvec3 borrow) [high-end]
uvec4 usubBorrow(uvec4 x, uvec4 y, out uvec4 borrow) [high-end]

uvec2

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
uvec2 uvec2(uint)
uvec2 uvec2(uint, uint)
uvec2 uvec2(bvec2)
uvec2 uvec2(ivec2)
uvec2 uvec2(uvec2)
uvec2 uvec2(vec2)

uvec3

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
uvec3 uvec3(uint)
uvec3 uvec3(uint, uint, uint)
uvec3 uvec3(uvec2, uint)
uvec3 uvec3(uint, uvec2)
uvec3 uvec3(bvec3)
uvec3 uvec3(ivec3)
uvec3 uvec3(uvec3)
uvec3 uvec3(vec3)

uvec4

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
uvec4 uvec4(uint)
uvec4 uvec4(uint, uint, uint, uint)
uvec4 uvec4(uint, uvec2, uint)
uvec4 uvec4(uvec2, uint, uint)
uvec4 uvec4(uint, uint, uvec2)
uvec4 uvec4(uint, uvec3)
uvec4 uvec4(uvec3, uint)
uvec4 uvec4(uvec2, uvec2)
uvec4 uvec4(bvec4)
uvec4 uvec4(ivec4)
uvec4 uvec4(uvec4)
uvec4 uvec4(vec4)

vec2

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
vec2 vec2(float)
vec2 vec2(float, float)
vec2 vec2(bvec2)
vec2 vec2(ivec2)
vec2 vec2(uvec2)
vec2 vec2(vec2)

vec3

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
vec3 vec3(float)
vec3 vec3(float, float, float)
vec3 vec3(vec2, float)
vec3 vec3(float, vec2)
vec3 vec3(bvec3)
vec3 vec3(ivec3)
vec3 vec3(uvec3)
vec3 vec3(vec3)

vec4

Type constructors. A scalar matrix argument fills its diagonal rather than every entry; a scalar vector argument is replicated.

Text
vec4 vec4(float)
vec4 vec4(float, float, float, float)
vec4 vec4(float, vec2, float)
vec4 vec4(vec2, float, float)
vec4 vec4(float, float, vec2)
vec4 vec4(float, vec3)
vec4 vec4(vec3, float)
vec4 vec4(vec2, vec2)
vec4 vec4(bvec4)
vec4 vec4(ivec4)
vec4 vec4(uvec4)
vec4 vec4(vec4)

Diagnosis

No matching overload: compare float/int, vector dimensions and sampler type. Unknown function: check renderer and spelling. Out-argument error: supply a variable. NaN/Inf: check domains and zero divisors before calling. For textures also check import, mipmaps and UVs: a valid signature does not establish a correct material.

GLSL semantics: official Khronos reference. Reckfell availability follows this catalog and the selected renderer, not merely a function’s presence in OpenGL.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.