HLSL Core
HLSL core defines and functions.
Functions
Return type |
Description |
---|---|
ffxPackHalf2x16 (FfxFloat32x2 value)
Pack 2×32-bit floating point values in a single 32bit value.
|
|
ffxBroadcast2 (FfxFloat32 value)
Broadcast a scalar value to a 2-dimensional floating point vector.
|
|
ffxBroadcast3 (FfxFloat32 value)
Broadcast a scalar value to a 3-dimensional floating point vector.
|
|
ffxBroadcast4 (FfxFloat32 value)
Broadcast a scalar value to a 4-dimensional floating point vector.
|
|
ffxBroadcast2 (FfxInt32 value)
Broadcast a scalar value to a 2-dimensional signed integer vector.
|
|
ffxBroadcast3 (FfxInt32 value)
Broadcast a scalar value to a 3-dimensional signed integer vector.
|
|
ffxBroadcast4 (FfxInt32 value)
Broadcast a scalar value to a 4-dimensional signed integer vector.
|
|
ffxBroadcast2 (FfxUInt32 value)
Broadcast a scalar value to a 2-dimensional unsigned integer vector.
|
|
ffxBroadcast3 (FfxUInt32 value)
Broadcast a scalar value to a 3-dimensional unsigned integer vector.
|
|
ffxBroadcast4 (FfxUInt32 value)
Broadcast a scalar value to a 4-dimensional unsigned integer vector.
|
|
Interprets the bit pattern of x as an unsigned integer.
|
|
Interprets the bit pattern of x as an unsigned integer.
|
|
Interprets the bit pattern of x as an unsigned integer.
|
|
Interprets the bit pattern of x as an unsigned integer.
|
|
ffxAsFloat (FfxUInt32 x)
Interprets the bit pattern of x as a floating-point number.
|
|
Interprets the bit pattern of x as a floating-point number.
|
|
Interprets the bit pattern of x as a floating-point number.
|
|
Interprets the bit pattern of x as a floating-point number.
|
|
Compute the inverse of a value.
|
|
Compute the inverse of a value.
|
|
Compute the inverse of a value.
|
|
Compute the inverse of a value.
|
|
ffxRsqrt (FfxFloat32 x)
Compute the inverse square root of a value.
|
|
ffxRsqrt (FfxFloat32x2 x)
Compute the inverse square root of a value.
|
|
ffxRsqrt (FfxFloat32x3 x)
Compute the inverse square root of a value.
|
|
ffxRsqrt (FfxFloat32x4 x)
Compute the inverse square root of a value.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Compute the linear interopation between two values.
|
|
Clamp a value to a [0..1] range.
|
|
Clamp a value to a [0..1] range.
|
|
Clamp a value to a [0..1] range.
|
|
Clamp a value to a [0..1] range.
|
|
ffxFract (FfxFloat32 x)
Compute the factional part of a decimal value.
|
|
ffxFract (FfxFloat32x2 x)
Compute the factional part of a decimal value.
|
|
ffxFract (FfxFloat32x3 x)
Compute the factional part of a decimal value.
|
|
ffxFract (FfxFloat32x4 x)
Compute the factional part of a decimal value.
|
|
ffxRound (FfxFloat32 x)
Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.
|
|
ffxRound (FfxFloat32x2 x)
Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.
|
|
ffxRound (FfxFloat32x3 x)
Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.
|
|
ffxRound (FfxFloat32x4 x)
Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the maximum of three values.
|
|
Compute the median of three values.
|
|
Compute the median of three values.
|
|
Compute the median of three values.
|
|
Compute the median of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
|
Compute the minimum of three values.
|
Macros
Name |
Description |
---|---|
FFX_ATOMIC_ADD (x, y) InterlockedAdd(x, y) |
A define for abstracting compute atomic additions between shading languages.
|
FFX_ATOMIC_ADD_RETURN (x, y, r) InterlockedAdd(x, y, r) |
A define for abstracting compute atomic additions between shading languages.
|
FFX_ATOMIC_MAX (x, y) InterlockedMax(x, y) |
A define for abstracting compute atomic max between shading languages.
|
FFX_ATOMIC_MIN (x, y) InterlockedMin(x, y) |
A define for abstracting compute atomic min between shading languages.
|
FFX_ATOMIC_OR (x, y) InterlockedOr(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) FfxFloat32(x) |
Broadcast a scalar value to a 2-dimensional floating point vector.
|
FFX_BROADCAST_FLOAT32X3 (x) FfxFloat32(x) |
Broadcast a scalar value to a 3-dimensional floating point vector.
|
FFX_BROADCAST_FLOAT32X4 (x) 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) FfxInt32(x) |
Broadcast a scalar value to a 2-dimensional signed integer vector.
|
FFX_BROADCAST_INT32X3 (x) FfxInt32(x) |
Broadcast a scalar value to a 3-dimensional signed integer vector.
|
FFX_BROADCAST_INT32X4 (x) FfxInt32(x) |
Broadcast a scalar value to a 4-dimensional signed integer vector.
|
FFX_BROADCAST_MIN_FLOAT16 (a) FFX_MIN16_F(a) |
Broadcast a scalar value to a 1-dimensional half-precision floating point vector.
|
FFX_BROADCAST_MIN_FLOAT16X2 (a) FFX_MIN16_F(a) |
Broadcast a scalar value to a 2-dimensional half-precision floating point vector.
|
FFX_BROADCAST_MIN_FLOAT16X3 (a) FFX_MIN16_F(a) |
Broadcast a scalar value to a 3-dimensional half-precision floating point vector.
|
FFX_BROADCAST_MIN_FLOAT16X4 (a) FFX_MIN16_F(a) |
Broadcast a scalar value to a 4-dimensional half-precision floating point vector.
|
FFX_BROADCAST_MIN_INT16 (a) FFX_MIN16_I(a) |
Broadcast a scalar value to a 1-dimensional half-precision signed integer vector.
|
FFX_BROADCAST_MIN_INT16X2 (a) FFX_MIN16_I(a) |
Broadcast a scalar value to a 2-dimensional half-precision signed integer vector.
|
FFX_BROADCAST_MIN_INT16X3 (a) FFX_MIN16_I(a) |
Broadcast a scalar value to a 3-dimensional half-precision signed integer vector.
|
FFX_BROADCAST_MIN_INT16X4 (a) FFX_MIN16_I(a) |
Broadcast a scalar value to a 4-dimensional half-precision signed integer vector.
|
FFX_BROADCAST_MIN_UINT16 (a) FFX_MIN16_U(a) |
Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector.
|
FFX_BROADCAST_MIN_UINT16X2 (a) FFX_MIN16_U(a) |
Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector.
|
FFX_BROADCAST_MIN_UINT16X3 (a) FFX_MIN16_U(a) |
Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector.
|
FFX_BROADCAST_MIN_UINT16X4 (a) FFX_MIN16_U(a) |
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) FfxUInt32(x) |
Broadcast a scalar value to a 2-dimensional unsigned integer vector.
|
FFX_BROADCAST_UINT32X3 (x) FfxUInt32(x) |
Broadcast a scalar value to a 4-dimensional unsigned integer vector.
|
FFX_BROADCAST_UINT32X4 (x) FfxUInt32(x) |
Broadcast a scalar value to a 4-dimensional unsigned integer vector.
|
FFX_EQUAL (x, y) x == y |
A define for abstracting an ‘equal’ comparison operator between two types.
|
FFX_GREATER_THAN (x, y) x > y |
A define for abstracting a ‘greater than’ comparison operator between two types.
|
FFX_GREATER_THAN_EQUAL (x, y) x >= y |
A define for abstracting a ‘greater than or equal’ comparison operator between two types.
|
FFX_GROUPSHARED groupshared |
A define for abstracting shared memory between shading languages.
|
FFX_GROUP_MEMORY_BARRIER GroupMemoryBarrierWithGroupSync() |
A define for abstracting compute memory barriers between shading languages.
|
FFX_LESS_THAN (x, y) x < y |
A define for abstracting a ‘less than’ comparison operator between two types.
|
FFX_LESS_THAN_EQUAL (x, y) x <= y |
A define for abstracting a ‘less than or equal’ comparison operator between two types.
|
FFX_MATRIX_MULTIPLY (a, b) mul(a, b) |
A define for abstracting matrix multiply operations between shading languages.
|
FFX_MODULO (a, b) (fmod(a, b)) |
A define for abstracting modulo operations between shading languages.
|
FFX_NOT_EQUAL (x, y) 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 static |
A define added to accept static markup on functions to aid CPU/GPU portability of code.
|
FFX_TRANSFORM_VECTOR (a, b) mul(a, b) |
A define for abstracting vector transformations between shading languages.
|
FFX_UNROLL [unroll] |
A define for abstracting loop unrolling between shading languages.
|
ffxF32ToF16 f32tof16 |
Convert FfxFloat32 to half (in lower 16-bits of output).
|
Detailed description
HLSL core defines and functions.
Global functions
ffxPackHalf2x16
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.
ffxBroadcast2
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
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
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
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
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
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
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
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
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.
ffxAsUInt32
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
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
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
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.
ffxAsFloat
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
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
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
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.
ffxReciprocal
FfxFloat32 ffxReciprocal (FfxFloat32 x)
Compute the inverse of a value.
Parameters:
x |
The value to calulate the inverse of. |
Returns:
The inverse of x
.
ffxReciprocal
FfxFloat32x2 ffxReciprocal (FfxFloat32x2 x)
Compute the inverse of a value.
Parameters:
x |
The value to calulate the inverse of. |
Returns:
The inverse of x
.
ffxReciprocal
FfxFloat32x3 ffxReciprocal (FfxFloat32x3 x)
Compute the inverse of a value.
Parameters:
x |
The value to calulate the inverse of. |
Returns:
The inverse of x
.
ffxReciprocal
FfxFloat32x4 ffxReciprocal (FfxFloat32x4 x)
Compute the inverse of a value.
Parameters:
x |
The value to calulate the inverse of. |
Returns:
The inverse of x
.
ffxRsqrt
FfxFloat32 ffxRsqrt (FfxFloat32 x)
Compute the inverse square root of a value.
Parameters:
x |
The value to calulate the inverse square root of. |
Returns:
The inverse square root of x
.
ffxRsqrt
FfxFloat32x2 ffxRsqrt (FfxFloat32x2 x)
Compute the inverse square root of a value.
Parameters:
x |
The value to calulate the inverse square root of. |
Returns:
The inverse square root of x
.
ffxRsqrt
FfxFloat32x3 ffxRsqrt (FfxFloat32x3 x)
Compute the inverse square root of a value.
Parameters:
x |
The value to calulate the inverse square root of. |
Returns:
The inverse square root of x
.
ffxRsqrt
FfxFloat32x4 ffxRsqrt (FfxFloat32x4 x)
Compute the inverse square root of a value.
Parameters:
x |
The value to calulate the inverse square root of. |
Returns:
The inverse square root of x
.
ffxLerp
FfxFloat32 ffxLerp (FfxFloat32 x, FfxFloat32 y, FfxFloat32 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x2 ffxLerp (FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x2 ffxLerp (FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x3 ffxLerp (FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x3 ffxLerp (FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x4 ffxLerp (FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxLerp
FfxFloat32x4 ffxLerp (FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 t)
Compute the linear interopation between two values.
Implemented by calling the HLSL mix
instrinsic function. Implements the following math:
Parameters:
x |
The first value to lerp between. |
y |
The second value to lerp between. |
t |
The value to determine how much of |
Returns:
A linearly interpolated value between x
and y
according to t
.
ffxSaturate
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
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
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
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
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
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
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
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
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
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
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
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.
ffxMax3
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/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
FfxFloat32x2 ffxMax3 (FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 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
FfxFloat32x3 ffxMax3 (FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 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
FfxFloat32x4 ffxMax3 (FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 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
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
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/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
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
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
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
FfxFloat32x2 ffxMed3 (FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 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
FfxFloat32x3 ffxMed3 (FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 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
FfxFloat32x4 ffxMed3 (FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 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
.
ffxMin3
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/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
FfxFloat32x2 ffxMin3 (FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 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
FfxFloat32x3 ffxMin3 (FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 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
FfxFloat32x4 ffxMin3 (FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 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
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
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
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 calculation. |
z |
The third value to include in the min calculation. |
Returns:
The minimum value of x
, y
, and z
.
ffxMin3
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
.
Macros
FFX_ATOMIC_ADD
A define for abstracting compute atomic additions between shading languages.
FFX_ATOMIC_ADD_RETURN
A define for abstracting compute atomic additions between shading languages.
FFX_ATOMIC_MAX
A define for abstracting compute atomic max between shading languages.
FFX_ATOMIC_MIN
A define for abstracting compute atomic min between shading languages.
FFX_ATOMIC_OR
A define for abstracting compute atomic OR between shading languages.
FFX_BROADCAST_FLOAT32
Broadcast a scalar value to a 1-dimensional floating point vector.
FFX_BROADCAST_FLOAT32X2
Broadcast a scalar value to a 2-dimensional floating point vector.
FFX_BROADCAST_FLOAT32X3
Broadcast a scalar value to a 3-dimensional floating point vector.
FFX_BROADCAST_FLOAT32X4
Broadcast a scalar value to a 4-dimensional floating point vector.
FFX_BROADCAST_INT32
Broadcast a scalar value to a 1-dimensional signed integer vector.
FFX_BROADCAST_INT32X2
Broadcast a scalar value to a 2-dimensional signed integer vector.
FFX_BROADCAST_INT32X3
Broadcast a scalar value to a 3-dimensional signed integer vector.
FFX_BROADCAST_INT32X4
Broadcast a scalar value to a 4-dimensional signed integer vector.
FFX_BROADCAST_MIN_FLOAT16
Broadcast a scalar value to a 1-dimensional half-precision floating point vector.
FFX_BROADCAST_MIN_FLOAT16X2
Broadcast a scalar value to a 2-dimensional half-precision floating point vector.
FFX_BROADCAST_MIN_FLOAT16X3
Broadcast a scalar value to a 3-dimensional half-precision floating point vector.
FFX_BROADCAST_MIN_FLOAT16X4
Broadcast a scalar value to a 4-dimensional half-precision floating point vector.
FFX_BROADCAST_MIN_INT16
Broadcast a scalar value to a 1-dimensional half-precision signed integer vector.
FFX_BROADCAST_MIN_INT16X2
Broadcast a scalar value to a 2-dimensional half-precision signed integer vector.
FFX_BROADCAST_MIN_INT16X3
Broadcast a scalar value to a 3-dimensional half-precision signed integer vector.
FFX_BROADCAST_MIN_INT16X4
Broadcast a scalar value to a 4-dimensional half-precision signed integer vector.
FFX_BROADCAST_MIN_UINT16
Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector.
FFX_BROADCAST_MIN_UINT16X2
Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector.
FFX_BROADCAST_MIN_UINT16X3
Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector.
FFX_BROADCAST_MIN_UINT16X4
Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector.
FFX_BROADCAST_UINT32
Broadcast a scalar value to a 1-dimensional unsigned integer vector.
FFX_BROADCAST_UINT32X2
Broadcast a scalar value to a 2-dimensional unsigned integer vector.
FFX_BROADCAST_UINT32X3
Broadcast a scalar value to a 4-dimensional unsigned integer vector.
FFX_BROADCAST_UINT32X4
Broadcast a scalar value to a 4-dimensional unsigned integer vector.
FFX_EQUAL
A define for abstracting an ‘equal’ comparison operator between two types.
FFX_GREATER_THAN
A define for abstracting a ‘greater than’ comparison operator between two types.
FFX_GREATER_THAN_EQUAL
A define for abstracting a ‘greater than or equal’ comparison operator between two types.
FFX_GROUPSHARED
A define for abstracting shared memory between shading languages.
FFX_GROUP_MEMORY_BARRIER
A define for abstracting compute memory barriers between shading languages.
FFX_LESS_THAN
A define for abstracting a ‘less than’ comparison operator between two types.
FFX_LESS_THAN_EQUAL
A define for abstracting a ‘less than or equal’ comparison operator between two types.
FFX_MATRIX_MULTIPLY
A define for abstracting matrix multiply operations between shading languages.
FFX_MODULO
A define for abstracting modulo operations between shading languages.
FFX_NOT_EQUAL
A define for abstracting a ‘not equal’ comparison operator between two types.
FFX_SELECT
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 define for abstracting vector transformations between shading languages.
FFX_UNROLL
A define for abstracting loop unrolling between shading languages.
ffxF32ToF16
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
.