CPU Core

Core CPU-side defines and functions.

Functions

Return type

Description

static FfxUInt32

Interpret the bit layout of an IEEE-754 floating point value as an unsigned integer.

static FfxFloat32

Compute the linear interopation between two values.

static FfxFloat32

Compute the reciprocal of a value.

static FfxFloat32

Compute the square root of a value.

static FfxFloat32

Compute the factional part of a decimal value.

static FfxFloat32

Compute the reciprocal square root of a value.

static FfxFloat32

Clamp a value to a [0..1] range.

static FfxUInt32

Convert FfxFloat32 to half (in lower 16-bits of output).

static FfxUInt32

Pack 2×32-bit floating point values in a single 32bit value.

Detailed description

Core CPU-side defines and functions.

Global functions

ffxAsUInt32

Copied!

static FfxUInt32  ffxAsUInt32 (FfxFloat32  x)

Interpret the bit layout of an IEEE-754 floating point value as an unsigned integer.

Parameters:

x

A 32bit floating value.

Returns:

An unsigned 32bit integer value containing the bit pattern of x.


ffxLerp

Copied!

static FfxFloat32  ffxLerp (FfxFloat32  x, FfxFloat32  y, FfxFloat32  t)

Compute the linear interopation between two values.

Implemented by calling the GLSL mix instrinsic function. Implements the following math:

Copied!

(1 - t) * x + t * y

Parameters:

x

The first value to lerp between.

y

The second value to lerp between.

t

The value to determine how much of x and how much of y.

Returns:

A linearly interpolated value between x and y according to t.


ffxReciprocal

Copied!

static FfxFloat32  ffxReciprocal (FfxFloat32  x)

Compute the reciprocal of a value.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal value of x.


ffxSqrt

Copied!

static FfxFloat32  ffxSqrt (FfxFloat32  x)

Compute the square root of a value.

Parameters:

x

The first value to compute the min of.

Returns:

The the square root of x.


ffxFract

Copied!

static FfxFloat32  ffxFract (FfxFloat32  x)

Compute the factional part of a decimal value.

This function calculates x - floor(x).

Parameters:

x

The value to compute the fractional part from.

Returns:

The fractional part of x.


ffxRsqrt

Copied!

static FfxFloat32  ffxRsqrt (FfxFloat32  x)

Compute the reciprocal square root of a value.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal square root value of x.


ffxSaturate

Copied!

static FfxFloat32  ffxSaturate (FfxFloat32  x)

Clamp a value to a [0..1] range.

Parameters:

x

The value to clamp to [0..1] range.

Returns:

The clamped version of x.


ffxF32ToF16

Copied!

static FfxUInt32  ffxF32ToF16 (FfxFloat32  f)

Convert FfxFloat32 to half (in lower 16-bits of output).

This function implements the same fast technique that is documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf

The function supports denormals.

Some conversion rules are to make computations possibly “safer” on the GPU, -INF & -NaN -> -65504 +INF & +NaN -> +65504

Parameters:

f

The 32bit floating point value to convert.

Returns:

The closest 16bit floating point value to f.


ffxPackHalf2x16

Copied!

static FfxUInt32  ffxPackHalf2x16 (FfxFloat32x2  x)

Pack 2×32-bit floating point values in a single 32bit value.

This function first converts each component of value into their nearest 16-bit floating point representation, and then stores the X and Y components in the lower and upper 16 bits of the 32bit unsigned integer respectively.

Parameters:

x

A 2-dimensional floating point value to convert and pack.

Returns:

A packed 32bit value containing 2 16bit floating point values.