HDK
|
The VM library provides methods to operate on vectors of float or integer data. The library will use SIMD instructions (Altivec, SSE, etc.) so operations may be more efficient than native code.
Most functions have several different signatures for uniform or varying values. A uniform value is the same for all elements of the vector arrays (i.e. a scalar value). A varying value is potentially different.
For example
Most functions also have a SISD implementation which is illustrative of what the function actually does. The vector forms can be significantly faster than the SISD versions.
For example, to add one array of floats to another, instead of
you could use (which is often faster).
There are two forms of comparison functions. The fast version of the standard operations (i.e. VM_Math::lt()) will return 0 or 1 only. The fast version (i.e. VM_Math::fastlt()) will return 0 for false
values, but may return any other value for true
values.
VM_Math::lt(d, a, b)
VM_Math::fastlt(d, a, b)
VM_Math::le(d, a, b)
VM_Math::fastle(d, a, b)
VM_Math::gt(d, a, b)
VM_Math::fastgt(d, a, b)
VM_Math::ge(d, a, b)
VM_Math::fastge(d, a, b)
VM_Math::eq(d, a, b)
VM_Math::fasteq(d, a, b)
VM_Math::ne(d, a, b)
VM_Math::fastne(d, a, b)
VM_Math::add(d, a, b)
VM_Math::sub(d, a, b)
VM_Math::mul(d, a, b)
VM_Math::div(d, a, b)
VM_Math::safediv(d, a, b)
VM_Math::fdiv(d, a, b)
VM_Math::max(d, a, b)
VM_Math::min(d, a, b)
VM_Math::clamp(d, a, b)
VM_Math::dot(a,b,n)
VM_Math::zerocount(a,n)
VM_Math::scaleoffset(d, a, b)
VM_Math::madd(d, a, b)
VM_Math::sqrt(d, a)
VM_Math::fsqrt(d, a)
sqrt()
since it uses the reciprocal function. VM_Math::isqrt(d, a)
VM_Math::floor(a)
VM_Math::cast(a)
VM_Math::negate(d, a)
VM_Math::invert(d, a)
VM_Math::abs(d, a)
VM_Math::wpoint(d,a,b,c,e)
VM_Math::iwpoint(d,a,b,e)
VM_Math::set(d, a)
VM_Math::set(d, a, disabled)
VM_Math::lerp(d, a, b, t)