fma

Description

Fused multiply-add.

Signature

/// Requires Capability Set 1:
T fma<T>(
    T a,
    T b,
    T c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
vector<T, N> fma<T, int N>(
    vector<T, N> a,
    vector<T, N> b,
    vector<T, N> c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
matrix<T, N, M> fma<T, int N, int M>(
    matrix<T, N, M> a,
    matrix<T, N, M> b,
    matrix<T, N, M> c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 2:
CoopVec<T, N> fma<T, int N>(
    CoopVec<T, N> a,
    CoopVec<T, N> b,
    CoopVec<T, N> c)
    where T : __BuiltinFloatingPointType;

Generic Parameters

T: __BuiltinFloatingPointType

N : int

M : int

Parameters

a : T

The first value to multiply.

b : T

The second value to multiply.

c : T

The value to add to the product of a and b.

a : vector<T, N>

The first value to multiply.

b : vector<T, N>

The second value to multiply.

c : vector<T, N>

The value to add to the product of a and b.

a : matrix<T, N, M>

The first value to multiply.

b : matrix<T, N, M>

The second value to multiply.

c : matrix<T, N, M>

The value to add to the product of a and b.

a : CoopVec<T, N>

The first value to multiply.

b : CoopVec<T, N>

The second value to multiply.

c : CoopVec<T, N>

The value to add to the product of a and b.

Return value

The result of a*b+c.

Availability and Requirements

Capability Set 1

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cpp

Available in all stages.

cuda

Available in all stages.

metal

Available in all stages.

wgsl

Available in all stages.

spirv

Available in all stages.

llvm

Available in all stages.

Capability Set 2

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cpp

Available in all stages.

cuda

Available in all stages.

Requires capability: optix_coopvec.

spirv

Available in all stages.

Requires capability: spvCooperativeVectorNV.