GpuMath¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.
This type spans several pages: part 1 ยท part 2.
saturate¶
x limited to the range 0 through 1.
mix¶
Linear interpolation: a when t is 0, b when t is 1.
step¶
0 where x is below edge, otherwise 1.
smoothstep¶
A smooth curve from 0 at low to 1 at high.
fma¶
a * b + c, computed with a single rounding where the GPU supports it.
reflect¶
The direction of incident reflected about the unit-length surface normal.
refract¶
The direction of unit-length incident refracted through a surface with unit-length normal, where eta is the ratio of refractive indices; zero on total internal reflection.
ddx¶
How fast x changes between horizontally neighboring pixels. Fragment shaders only.
ddy¶
How fast x changes between vertically neighboring pixels. Fragment shaders only.
fwidth¶
abs(ddx(x)) + abs(ddy(x)), for antialiasing procedural edges. Fragment shaders only.