GLSL Core

GLSL core defines and functions.

Functions

Return type

Description

FfxFloat32

Interprets the bit pattern of x as a floating-point number.

FfxFloat32x2

Interprets the bit pattern of x as a floating-point number.

FfxFloat32x3

Interprets the bit pattern of x as a floating-point number.

FfxFloat32x4

Interprets the bit pattern of x as a floating-point number.

FfxUInt32

Interprets the bit pattern of x as an unsigned integer.

FfxUInt32x2

Interprets the bit pattern of x as an unsigned integer.

FfxUInt32x3

Interprets the bit pattern of x as an unsigned integer.

FfxUInt32x4

Interprets the bit pattern of x as an unsigned integer.

FfxUInt32

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

FfxUInt32

Convert a 32bit IEEE 754 floating point value to its nearest 16bit equivalent.

FfxFloat32x2

Broadcast a scalar value to a 2-dimensional floating point vector.

FfxFloat32x3

Broadcast a scalar value to a 3-dimensional floating point vector.

FfxFloat32x4

Broadcast a scalar value to a 4-dimensional floating point vector.

FfxInt32x2

Broadcast a scalar value to a 2-dimensional signed integer vector.

FfxInt32x3

Broadcast a scalar value to a 3-dimensional signed integer vector.

FfxInt32x4

Broadcast a scalar value to a 4-dimensional signed integer vector.

FfxUInt32x2

Broadcast a scalar value to a 2-dimensional unsigned integer vector.

FfxUInt32x3

Broadcast a scalar value to a 3-dimensional unsigned integer vector.

FfxUInt32x4

Broadcast a scalar value to a 4-dimensional unsigned integer vector.

FfxUInt32

ffxBitfieldExtract (FfxUInt32 src, FfxUInt32 off, FfxUInt32 bits)

FfxUInt32

ffxBitfieldInsert (FfxUInt32 src, FfxUInt32 ins, FfxUInt32 mask)

FfxUInt32

ffxBitfieldInsertMask (FfxUInt32 src, FfxUInt32 ins, FfxUInt32 bits)

FfxFloat32

Compute the linear interopation between two values.

FfxFloat32x2

Compute the linear interopation between two values.

FfxFloat32x2

Compute the linear interopation between two values.

FfxFloat32x3

Compute the linear interopation between two values.

FfxFloat32x3

Compute the linear interopation between two values.

FfxFloat32x4

Compute the linear interopation between two values.

FfxFloat32x4

Compute the linear interopation between two values.

FfxFloat32

Compute the maximum of three values.

FfxFloat32x2

Compute the maximum of three values.

FfxFloat32x3

Compute the maximum of three values.

FfxFloat32x4

Compute the maximum of three values.

FfxUInt32

Compute the maximum of three values.

FfxUInt32x2

Compute the maximum of three values.

FfxUInt32x3

Compute the maximum of three values.

FfxUInt32x4

Compute the maximum of three values.

FfxFloat32

Compute the median of three values.

FfxFloat32x2

Compute the median of three values.

FfxFloat32x3

Compute the median of three values.

FfxFloat32x4

Compute the median of three values.

FfxInt32

Compute the median of three values.

FfxInt32x2

Compute the median of three values.

FfxInt32x3

Compute the median of three values.

FfxInt32x4

Compute the median of three values.

FfxFloat32

Compute the minimum of three values.

FfxFloat32x2

Compute the minimum of three values.

FfxFloat32x3

Compute the minimum of three values.

FfxFloat32x4

Compute the minimum of three values.

FfxUInt32

Compute the minimum of three values.

FfxUInt32x2

Compute the minimum of three values.

FfxUInt32x3

Compute the minimum of three values.

FfxUInt32x4

Compute the minimum of three values.

FfxFloat32

Compute the reciprocal of a value.

FfxFloat32x2

Compute the reciprocal of a value.

FfxFloat32x3

Compute the reciprocal of a value.

FfxFloat32x4

Compute the reciprocal of a value.

FfxFloat32

Compute the reciprocal square root of a value.

FfxFloat32x2

Compute the reciprocal square root of a value.

FfxFloat32x3

Compute the reciprocal square root of a value.

FfxFloat32x4

Compute the reciprocal square root of a value.

FfxFloat32

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

FfxFloat32x2

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

FfxFloat32x3

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

FfxFloat32x4

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

FfxFloat32

Compute the factional part of a decimal value.

FfxFloat32x2

Compute the factional part of a decimal value.

FfxFloat32x3

Compute the factional part of a decimal value.

FfxFloat32x4

Compute the factional part of a decimal value.

FfxFloat32

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

FfxFloat32x2

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

FfxFloat32x3

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

FfxFloat32x4

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

Macros

Name

Description

FFX_ATOMIC_ADD (x, y) atomicAdd(x, y)

A define for abstracting compute atomic additions between shading languages.

FFX_ATOMIC_ADD_RETURN (x, y, r) r = atomicAdd(x, y)

A define for abstracting compute atomic additions between shading languages.

FFX_ATOMIC_MAX (x, y) atomicMax(x, y)

A define for abstracting compute atomic max between shading languages.

FFX_ATOMIC_MIN (x, y) atomicMin(x, y)

A define for abstracting compute atomic min between shading languages.

FFX_ATOMIC_OR (x, y) atomicOr(x, y)

A define for abstracting compute atomic OR between shading languages.

FFX_BROADCAST_FLOAT32 (x) FfxFloat32(x)

Broadcast a scalar value to a 1-dimensional floating point vector.

FFX_BROADCAST_FLOAT32X2 (x) FfxFloat32x2(FfxFloat32(x))

Broadcast a scalar value to a 2-dimensional floating point vector.

FFX_BROADCAST_FLOAT32X3 (x) FfxFloat32x3(FfxFloat32(x))

Broadcast a scalar value to a 3-dimensional floating point vector.

FFX_BROADCAST_FLOAT32X4 (x) FfxFloat32x4(FfxFloat32(x))

Broadcast a scalar value to a 4-dimensional floating point vector.

FFX_BROADCAST_INT32 (x) FfxInt32(x)

Broadcast a scalar value to a 1-dimensional signed integer vector.

FFX_BROADCAST_INT32X2 (x) FfxInt32x2(FfxInt32(x))

Broadcast a scalar value to a 2-dimensional signed integer vector.

FFX_BROADCAST_INT32X3 (x) FfxInt32x3(FfxInt32(x))

Broadcast a scalar value to a 3-dimensional signed integer vector.

FFX_BROADCAST_INT32X4 (x) FfxInt32x4(FfxInt32(x))

Broadcast a scalar value to a 4-dimensional signed integer vector.

FFX_BROADCAST_MIN_FLOAT16 (x) FFX_MIN16_F(x)

Broadcast a scalar value to a 1-dimensional half-precision floating point vector.

FFX_BROADCAST_MIN_FLOAT16X2 (x) FFX_MIN16_F2(FFX_MIN16_F(x))

Broadcast a scalar value to a 2-dimensional half-precision floating point vector.

FFX_BROADCAST_MIN_FLOAT16X3 (x) FFX_MIN16_F3(FFX_MIN16_F(x))

Broadcast a scalar value to a 3-dimensional half-precision floating point vector.

FFX_BROADCAST_MIN_FLOAT16X4 (x) FFX_MIN16_F4(FFX_MIN16_F(x))

Broadcast a scalar value to a 4-dimensional half-precision floating point vector.

FFX_BROADCAST_MIN_INT16 (x) FFX_MIN16_I(x)

Broadcast a scalar value to a 1-dimensional half-precision signed integer vector.

FFX_BROADCAST_MIN_INT16X2 (x) FFX_MIN16_I2(FFX_MIN16_I(x))

Broadcast a scalar value to a 2-dimensional half-precision signed integer vector.

FFX_BROADCAST_MIN_INT16X3 (x) FFX_MIN16_I3(FFX_MIN16_I(x))

Broadcast a scalar value to a 3-dimensional half-precision signed integer vector.

FFX_BROADCAST_MIN_INT16X4 (x) FFX_MIN16_I4(FFX_MIN16_I(x))

Broadcast a scalar value to a 4-dimensional half-precision signed integer vector.

FFX_BROADCAST_MIN_UINT16 (x) FFX_MIN16_U(x)

Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector.

FFX_BROADCAST_MIN_UINT16X2 (x) FFX_MIN16_U2(FFX_MIN16_U(x))

Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector.

FFX_BROADCAST_MIN_UINT16X3 (x) FFX_MIN16_U3(FFX_MIN16_U(x))

Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector.

FFX_BROADCAST_MIN_UINT16X4 (x) FFX_MIN16_U4(FFX_MIN16_U(x))

Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector.

FFX_BROADCAST_UINT32 (x) FfxUInt32(x)

Broadcast a scalar value to a 1-dimensional unsigned integer vector.

FFX_BROADCAST_UINT32X2 (x) FfxUInt32x2(FfxUInt32(x))

Broadcast a scalar value to a 2-dimensional unsigned integer vector.

FFX_BROADCAST_UINT32X3 (x) FfxUInt32x3(FfxUInt32(x))

Broadcast a scalar value to a 3-dimensional unsigned integer vector.

FFX_BROADCAST_UINT32X4 (x) FfxUInt32x4(FfxUInt32(x))

Broadcast a scalar value to a 4-dimensional unsigned integer vector.

FFX_EQUAL (x, y) equal(x, y)

A define for abstracting an ‘equal’ comparison operator between two types.

FFX_GREATER_THAN (x, y) greaterThan(x, y)

A define for abstracting a ‘greater than’ comparison operator between two types.

FFX_GREATER_THAN_EQUAL (x, y) greaterThanEqual(x, y)

A define for abstracting a ‘greater than or equal’ comparison operator between two types.

FFX_GROUPSHARED shared

A define for abstracting shared memory between shading languages.

FFX_GROUP_MEMORY_BARRIER groupMemoryBarrier(); barrier()

A define for abstracting compute memory barriers between shading languages.

FFX_LESS_THAN (x, y) lessThan(x, y)

A define for abstracting a ‘less than’ comparison operator between two types.

FFX_LESS_THAN_EQUAL (x, y) lessThanEqual(x, y)

A define for abstracting a ‘less than or equal’ comparison operator between two types.

FFX_MATRIX_MULTIPLY (a, b) (a * b)

A define for abstracting matrix multiply operations between shading languages.

FFX_MODULO (a, b) (mod(a, b))

A define for abstracting modulo operations between shading languages.

FFX_NOT_EQUAL (x, y) notEqual(x, y)

A define for abstracting a ‘not equal’ comparison operator between two types.

FFX_SELECT (cond, arg1, arg2) cond ? arg1 : arg2

A define for abstracting select functionality for pre/post HLSL 21.

FFX_STATIC

A define added to accept static markup on functions to aid CPU/GPU portability of code.

FFX_TRANSFORM_VECTOR (a, b) (a * b)

A define for abstracting vector transformations between shading languages.

FFX_UNROLL

A define for abstracting loop unrolling between shading languages.

Detailed description

GLSL core defines and functions.

Global functions

ffxAsFloat

Copied!

FfxFloat32  ffxAsFloat (FfxUInt32  x)

Interprets the bit pattern of x as a floating-point number.

Parameters:

x

The input value.

Returns:

The input interpreted as a floating-point number.


ffxAsFloat

Copied!

FfxFloat32x2  ffxAsFloat (FfxUInt32x2  x)

Interprets the bit pattern of x as a floating-point number.

Parameters:

x

The input value.

Returns:

The input interpreted as a floating-point number.


ffxAsFloat

Copied!

FfxFloat32x3  ffxAsFloat (FfxUInt32x3  x)

Interprets the bit pattern of x as a floating-point number.

Parameters:

x

The input value.

Returns:

The input interpreted as a floating-point number.


ffxAsFloat

Copied!

FfxFloat32x4  ffxAsFloat (FfxUInt32x4  x)

Interprets the bit pattern of x as a floating-point number.

Parameters:

x

The input value.

Returns:

The input interpreted as a floating-point number.


ffxAsUInt32

Copied!

FfxUInt32  ffxAsUInt32 (FfxFloat32  x)

Interprets the bit pattern of x as an unsigned integer.

Parameters:

x

The input value.

Returns:

The input interpreted as an unsigned integer.


ffxAsUInt32

Copied!

FfxUInt32x2  ffxAsUInt32 (FfxFloat32x2  x)

Interprets the bit pattern of x as an unsigned integer.

Parameters:

x

The input value.

Returns:

The input interpreted as an unsigned integer.


ffxAsUInt32

Copied!

FfxUInt32x3  ffxAsUInt32 (FfxFloat32x3  x)

Interprets the bit pattern of x as an unsigned integer.

Parameters:

x

The input value.

Returns:

The input interpreted as an unsigned integer.


ffxAsUInt32

Copied!

FfxUInt32x4  ffxAsUInt32 (FfxFloat32x4  x)

Interprets the bit pattern of x as an unsigned integer.

Parameters:

x

The input value.

Returns:

The input interpreted as an unsigned integer.


ffxPackHalf2x16

Copied!

FfxUInt32  ffxPackHalf2x16 (FfxFloat32x2  value)

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:

value

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

Returns:

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


ffxF32ToF16

Copied!

FfxUInt32  ffxF32ToF16 (FfxFloat32  value)

Convert a 32bit IEEE 754 floating point value to its nearest 16bit equivalent.

Parameters:

value

The value to convert.

Returns:

The nearest 16bit equivalent of value.


ffxBroadcast2

Copied!

FfxFloat32x2  ffxBroadcast2 (FfxFloat32  value)

Broadcast a scalar value to a 2-dimensional floating point vector.

Parameters:

value

The value to to broadcast.

Returns:

A 2-dimensional floating point vector with value in each component.


ffxBroadcast3

Copied!

FfxFloat32x3  ffxBroadcast3 (FfxFloat32  value)

Broadcast a scalar value to a 3-dimensional floating point vector.

Parameters:

value

The value to to broadcast.

Returns:

A 3-dimensional floating point vector with value in each component.


ffxBroadcast4

Copied!

FfxFloat32x4  ffxBroadcast4 (FfxFloat32  value)

Broadcast a scalar value to a 4-dimensional floating point vector.

Parameters:

value

The value to to broadcast.

Returns:

A 4-dimensional floating point vector with value in each component.


ffxBroadcast2

Copied!

FfxInt32x2  ffxBroadcast2 (FfxInt32  value)

Broadcast a scalar value to a 2-dimensional signed integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 2-dimensional signed integer vector with value in each component.


ffxBroadcast3

Copied!

FfxInt32x3  ffxBroadcast3 (FfxInt32  value)

Broadcast a scalar value to a 3-dimensional signed integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 3-dimensional signed integer vector with value in each component.


ffxBroadcast4

Copied!

FfxInt32x4  ffxBroadcast4 (FfxInt32  value)

Broadcast a scalar value to a 4-dimensional signed integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 4-dimensional signed integer vector with value in each component.


ffxBroadcast2

Copied!

FfxUInt32x2  ffxBroadcast2 (FfxUInt32  value)

Broadcast a scalar value to a 2-dimensional unsigned integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 2-dimensional unsigned integer vector with value in each component.


ffxBroadcast3

Copied!

FfxUInt32x3  ffxBroadcast3 (FfxUInt32  value)

Broadcast a scalar value to a 3-dimensional unsigned integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 3-dimensional unsigned integer vector with value in each component.


ffxBroadcast4

Copied!

FfxUInt32x4  ffxBroadcast4 (FfxUInt32  value)

Broadcast a scalar value to a 4-dimensional unsigned integer vector.

Parameters:

value

The value to to broadcast.

Returns:

A 4-dimensional unsigned integer vector with value in each component.


ffxLerp

Copied!

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.


ffxLerp

Copied!

FfxFloat32x2  ffxLerp (FfxFloat32x2  x, FfxFloat32x2  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.


ffxLerp

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.


ffxLerp

Copied!

FfxFloat32x3  ffxLerp (FfxFloat32x3  x, FfxFloat32x3  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.


ffxLerp

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.


ffxLerp

Copied!

FfxFloat32x4  ffxLerp (FfxFloat32x4  x, FfxFloat32x4  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.


ffxLerp

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.


ffxMax3

Copied!

FfxFloat32  ffxMax3 (FfxFloat32  x, FfxFloat32  y, FfxFloat32  z)

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Copied!

FfxUInt32  ffxMax3 (FfxUInt32  x, FfxUInt32  y, FfxUInt32  z)

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Copied!

FfxUInt32x2  ffxMax3 (FfxUInt32x2  x, FfxUInt32x2  y, FfxUInt32x2  z)

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN or RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Copied!

FfxUInt32x3  ffxMax3 (FfxUInt32x3  x, FfxUInt32x3  y, FfxUInt32x3  z)

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMax3

Copied!

FfxUInt32x4  ffxMax3 (FfxUInt32x4  x, FfxUInt32x4  y, FfxUInt32x4  z)

Compute the maximum of three values.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the max calculation.

y

The second value to include in the max calcuation.

z

The third value to include in the max calcuation.

Returns:

The maximum value of x, y, and z.


ffxMed3

Copied!

FfxFloat32  ffxMed3 (FfxFloat32  x, FfxFloat32  y, FfxFloat32  z)

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Copied!

FfxInt32  ffxMed3 (FfxInt32  x, FfxInt32  y, FfxInt32  z)

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_I32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Copied!

FfxInt32x2  ffxMed3 (FfxInt32x2  x, FfxInt32x2  y, FfxInt32x2  z)

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_I32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Copied!

FfxInt32x3  ffxMed3 (FfxInt32x3  x, FfxInt32x3  y, FfxInt32x3  z)

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_I32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMed3

Copied!

FfxInt32x4  ffxMed3 (FfxInt32x4  x, FfxInt32x4  y, FfxInt32x4  z)

Compute the median of three values.

NOTE: This function should compile down to a single V_MED3_I32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the median calculation.

y

The second value to include in the median calcuation.

z

The third value to include in the median calcuation.

Returns:

The median value of x, y, and z.


ffxMin3

Copied!

FfxFloat32  ffxMin3 (FfxFloat32  x, FfxFloat32  y, FfxFloat32  z)

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN and RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Copied!

FfxUInt32  ffxMin3 (FfxUInt32  x, FfxUInt32  y, FfxUInt32  z)

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Copied!

FfxUInt32x2  ffxMin3 (FfxUInt32x2  x, FfxUInt32x2  y, FfxUInt32x2  z)

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Copied!

FfxUInt32x3  ffxMin3 (FfxUInt32x3  x, FfxUInt32x3  y, FfxUInt32x3  z)

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxMin3

Copied!

FfxUInt32x4  ffxMin3 (FfxUInt32x4  x, FfxUInt32x4  y, FfxUInt32x4  z)

Compute the minimum of three values.

NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware.

Parameters:

x

The first value to include in the min calculation.

y

The second value to include in the min calcuation.

z

The third value to include in the min calcuation.

Returns:

The minimum value of x, y, and z.


ffxReciprocal

Copied!

FfxFloat32  ffxReciprocal (FfxFloat32  x)

Compute the reciprocal of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal value of x.


ffxReciprocal

Copied!

FfxFloat32x2  ffxReciprocal (FfxFloat32x2  x)

Compute the reciprocal of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal value of x.


ffxReciprocal

Copied!

FfxFloat32x3  ffxReciprocal (FfxFloat32x3  x)

Compute the reciprocal of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal value of x.


ffxReciprocal

Copied!

FfxFloat32x4  ffxReciprocal (FfxFloat32x4  x)

Compute the reciprocal of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal value of x.


ffxRsqrt

Copied!

FfxFloat32  ffxRsqrt (FfxFloat32  x)

Compute the reciprocal square root of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal square root value of x.


ffxRsqrt

Copied!

FfxFloat32x2  ffxRsqrt (FfxFloat32x2  x)

Compute the reciprocal square root of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal square root value of x.


ffxRsqrt

Copied!

FfxFloat32x3  ffxRsqrt (FfxFloat32x3  x)

Compute the reciprocal square root of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal square root value of x.


rsqrt

Copied!

FfxFloat32x4  rsqrt (FfxFloat32x4  x)

Compute the reciprocal square root of a value.

NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used.

Parameters:

x

The value to compute the reciprocal for.

Returns:

The reciprocal square root value of x.


ffxSaturate

Copied!

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.


ffxSaturate

Copied!

FfxFloat32x2  ffxSaturate (FfxFloat32x2  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.


ffxSaturate

Copied!

FfxFloat32x3  ffxSaturate (FfxFloat32x3  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.


ffxSaturate

Copied!

FfxFloat32x4  ffxSaturate (FfxFloat32x4  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.


ffxFract

Copied!

FfxFloat32  ffxFract (FfxFloat32  x)

Compute the factional part of a decimal value.

This function calculates x - floor(x). Where floor is the intrinsic HLSL function.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is worth further noting that this function is intentionally distinct from the HLSL frac intrinsic function.

Parameters:

x

The value to compute the fractional part from.

Returns:

The fractional part of x.


ffxFract

Copied!

FfxFloat32x2  ffxFract (FfxFloat32x2  x)

Compute the factional part of a decimal value.

This function calculates x - floor(x). Where floor is the intrinsic HLSL function.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is worth further noting that this function is intentionally distinct from the HLSL frac intrinsic function.

Parameters:

x

The value to compute the fractional part from.

Returns:

The fractional part of x.


ffxFract

Copied!

FfxFloat32x3  ffxFract (FfxFloat32x3  x)

Compute the factional part of a decimal value.

This function calculates x - floor(x). Where floor is the intrinsic HLSL function.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is worth further noting that this function is intentionally distinct from the HLSL frac intrinsic function.

Parameters:

x

The value to compute the fractional part from.

Returns:

The fractional part of x.


ffxFract

Copied!

FfxFloat32x4  ffxFract (FfxFloat32x4  x)

Compute the factional part of a decimal value.

This function calculates x - floor(x). Where floor is the intrinsic HLSL function.

NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is worth further noting that this function is intentionally distinct from the HLSL frac intrinsic function.

Parameters:

x

The value to compute the fractional part from.

Returns:

The fractional part of x.


ffxRound

Copied!

FfxFloat32  ffxRound (FfxFloat32  x)

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

Parameters:

x

The value to be rounded.

Returns:

The nearest integer from x. The nearest even integer from x if equidistant from 2 integer.


ffxRound

Copied!

FfxFloat32x2  ffxRound (FfxFloat32x2  x)

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

Parameters:

x

The value to be rounded.

Returns:

The nearest integer from x. The nearest even integer from x if equidistant from 2 integer.


ffxRound

Copied!

FfxFloat32x3  ffxRound (FfxFloat32x3  x)

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

Parameters:

x

The value to be rounded.

Returns:

The nearest integer from x. The nearest even integer from x if equidistant from 2 integer.


ffxRound

Copied!

FfxFloat32x4  ffxRound (FfxFloat32x4  x)

Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.

Parameters:

x

The value to be rounded.

Returns:

The nearest integer from x. The nearest even integer from x if equidistant from 2 integer.


Macros

FFX_ATOMIC_ADD

Copied!

#define FFX_ATOMIC_ADD (x, y) atomicAdd(x, y)

A define for abstracting compute atomic additions between shading languages.


FFX_ATOMIC_ADD_RETURN

Copied!

#define FFX_ATOMIC_ADD_RETURN (x, y, r) r = atomicAdd(x, y)

A define for abstracting compute atomic additions between shading languages.


FFX_ATOMIC_MAX

Copied!

#define FFX_ATOMIC_MAX (x, y) atomicMax(x, y)

A define for abstracting compute atomic max between shading languages.


FFX_ATOMIC_MIN

Copied!

#define FFX_ATOMIC_MIN (x, y) atomicMin(x, y)

A define for abstracting compute atomic min between shading languages.


FFX_ATOMIC_OR

Copied!

#define FFX_ATOMIC_OR (x, y) atomicOr(x, y)

A define for abstracting compute atomic OR between shading languages.


FFX_BROADCAST_FLOAT32

Copied!

#define FFX_BROADCAST_FLOAT32 (x) FfxFloat32(x)

Broadcast a scalar value to a 1-dimensional floating point vector.


FFX_BROADCAST_FLOAT32X2

Copied!

#define FFX_BROADCAST_FLOAT32X2 (x) FfxFloat32x2(FfxFloat32(x))

Broadcast a scalar value to a 2-dimensional floating point vector.


FFX_BROADCAST_FLOAT32X3

Copied!

#define FFX_BROADCAST_FLOAT32X3 (x) FfxFloat32x3(FfxFloat32(x))

Broadcast a scalar value to a 3-dimensional floating point vector.


FFX_BROADCAST_FLOAT32X4

Copied!

#define FFX_BROADCAST_FLOAT32X4 (x) FfxFloat32x4(FfxFloat32(x))

Broadcast a scalar value to a 4-dimensional floating point vector.


FFX_BROADCAST_INT32

Copied!

#define FFX_BROADCAST_INT32 (x) FfxInt32(x)

Broadcast a scalar value to a 1-dimensional signed integer vector.


FFX_BROADCAST_INT32X2

Copied!

#define FFX_BROADCAST_INT32X2 (x) FfxInt32x2(FfxInt32(x))

Broadcast a scalar value to a 2-dimensional signed integer vector.


FFX_BROADCAST_INT32X3

Copied!

#define FFX_BROADCAST_INT32X3 (x) FfxInt32x3(FfxInt32(x))

Broadcast a scalar value to a 3-dimensional signed integer vector.


FFX_BROADCAST_INT32X4

Copied!

#define FFX_BROADCAST_INT32X4 (x) FfxInt32x4(FfxInt32(x))

Broadcast a scalar value to a 4-dimensional signed integer vector.


FFX_BROADCAST_MIN_FLOAT16

Copied!

#define FFX_BROADCAST_MIN_FLOAT16 (x) FFX_MIN16_F(x)

Broadcast a scalar value to a 1-dimensional half-precision floating point vector.


FFX_BROADCAST_MIN_FLOAT16X2

Copied!

#define FFX_BROADCAST_MIN_FLOAT16X2 (x) FFX_MIN16_F2(FFX_MIN16_F(x))

Broadcast a scalar value to a 2-dimensional half-precision floating point vector.


FFX_BROADCAST_MIN_FLOAT16X3

Copied!

#define FFX_BROADCAST_MIN_FLOAT16X3 (x) FFX_MIN16_F3(FFX_MIN16_F(x))

Broadcast a scalar value to a 3-dimensional half-precision floating point vector.


FFX_BROADCAST_MIN_FLOAT16X4

Copied!

#define FFX_BROADCAST_MIN_FLOAT16X4 (x) FFX_MIN16_F4(FFX_MIN16_F(x))

Broadcast a scalar value to a 4-dimensional half-precision floating point vector.


FFX_BROADCAST_MIN_INT16

Copied!

#define FFX_BROADCAST_MIN_INT16 (x) FFX_MIN16_I(x)

Broadcast a scalar value to a 1-dimensional half-precision signed integer vector.


FFX_BROADCAST_MIN_INT16X2

Copied!

#define FFX_BROADCAST_MIN_INT16X2 (x) FFX_MIN16_I2(FFX_MIN16_I(x))

Broadcast a scalar value to a 2-dimensional half-precision signed integer vector.


FFX_BROADCAST_MIN_INT16X3

Copied!

#define FFX_BROADCAST_MIN_INT16X3 (x) FFX_MIN16_I3(FFX_MIN16_I(x))

Broadcast a scalar value to a 3-dimensional half-precision signed integer vector.


FFX_BROADCAST_MIN_INT16X4

Copied!

#define FFX_BROADCAST_MIN_INT16X4 (x) FFX_MIN16_I4(FFX_MIN16_I(x))

Broadcast a scalar value to a 4-dimensional half-precision signed integer vector.


FFX_BROADCAST_MIN_UINT16

Copied!

#define FFX_BROADCAST_MIN_UINT16 (x) FFX_MIN16_U(x)

Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector.


FFX_BROADCAST_MIN_UINT16X2

Copied!

#define FFX_BROADCAST_MIN_UINT16X2 (x) FFX_MIN16_U2(FFX_MIN16_U(x))

Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector.


FFX_BROADCAST_MIN_UINT16X3

Copied!

#define FFX_BROADCAST_MIN_UINT16X3 (x) FFX_MIN16_U3(FFX_MIN16_U(x))

Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector.


FFX_BROADCAST_MIN_UINT16X4

Copied!

#define FFX_BROADCAST_MIN_UINT16X4 (x) FFX_MIN16_U4(FFX_MIN16_U(x))

Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector.


FFX_BROADCAST_UINT32

Copied!

#define FFX_BROADCAST_UINT32 (x) FfxUInt32(x)

Broadcast a scalar value to a 1-dimensional unsigned integer vector.


FFX_BROADCAST_UINT32X2

Copied!

#define FFX_BROADCAST_UINT32X2 (x) FfxUInt32x2(FfxUInt32(x))

Broadcast a scalar value to a 2-dimensional unsigned integer vector.


FFX_BROADCAST_UINT32X3

Copied!

#define FFX_BROADCAST_UINT32X3 (x) FfxUInt32x3(FfxUInt32(x))

Broadcast a scalar value to a 3-dimensional unsigned integer vector.


FFX_BROADCAST_UINT32X4

Copied!

#define FFX_BROADCAST_UINT32X4 (x) FfxUInt32x4(FfxUInt32(x))

Broadcast a scalar value to a 4-dimensional unsigned integer vector.


FFX_EQUAL

Copied!

#define FFX_EQUAL (x, y) equal(x, y)

A define for abstracting an ‘equal’ comparison operator between two types.


FFX_GREATER_THAN

Copied!

#define FFX_GREATER_THAN (x, y) greaterThan(x, y)

A define for abstracting a ‘greater than’ comparison operator between two types.


FFX_GREATER_THAN_EQUAL

Copied!

#define FFX_GREATER_THAN_EQUAL (x, y) greaterThanEqual(x, y)

A define for abstracting a ‘greater than or equal’ comparison operator between two types.


FFX_GROUPSHARED

Copied!

#define FFX_GROUPSHARED shared

A define for abstracting shared memory between shading languages.


FFX_GROUP_MEMORY_BARRIER

Copied!

#define FFX_GROUP_MEMORY_BARRIER groupMemoryBarrier(); barrier()

A define for abstracting compute memory barriers between shading languages.


FFX_LESS_THAN

Copied!

#define FFX_LESS_THAN (x, y) lessThan(x, y)

A define for abstracting a ‘less than’ comparison operator between two types.


FFX_LESS_THAN_EQUAL

Copied!

#define FFX_LESS_THAN_EQUAL (x, y) lessThanEqual(x, y)

A define for abstracting a ‘less than or equal’ comparison operator between two types.


FFX_MATRIX_MULTIPLY

Copied!

#define FFX_MATRIX_MULTIPLY (a, b) (a * b)

A define for abstracting matrix multiply operations between shading languages.


FFX_MODULO

Copied!

#define FFX_MODULO (a, b) (mod(a, b))

A define for abstracting modulo operations between shading languages.


FFX_NOT_EQUAL

Copied!

#define FFX_NOT_EQUAL (x, y) notEqual(x, y)

A define for abstracting a ‘not equal’ comparison operator between two types.


FFX_SELECT

Copied!

#define FFX_SELECT (cond, arg1, arg2) cond ? arg1 : arg2

A define for abstracting select functionality for pre/post HLSL 21.


FFX_STATIC

Copied!

#define FFX_STATIC

A define added to accept static markup on functions to aid CPU/GPU portability of code.


FFX_TRANSFORM_VECTOR

Copied!

#define FFX_TRANSFORM_VECTOR (a, b) (a * b)

A define for abstracting vector transformations between shading languages.


FFX_UNROLL

Copied!

#define FFX_UNROLL

A define for abstracting loop unrolling between shading languages.