GLSL Core
GLSL core defines and functions.
Functions
Return type |
Description |
---|---|
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.
|
|
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.
|
|
ffxPackHalf2x16 (FfxFloat32x2 value)
Pack 2×32-bit floating point values in a single 32bit value.
|
|
ffxF32ToF16 (FfxFloat32 value)
Convert a 32bit IEEE 754 floating point value to its nearest 16bit equivalent.
|
|
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.
|
|
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.
|
|
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 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.
|
|
Compute the reciprocal of a value.
|
|
Compute the reciprocal of a value.
|
|
Compute the reciprocal of a value.
|
|
Compute the reciprocal of a value.
|
|
ffxRsqrt (FfxFloat32 x)
Compute the reciprocal square root of a value.
|
|
ffxRsqrt (FfxFloat32x2 x)
Compute the reciprocal square root of a value.
|
|
ffxRsqrt (FfxFloat32x3 x)
Compute the reciprocal square root of a value.
|
|
rsqrt (FfxFloat32x4 x)
Compute the reciprocal square root of a value.
|
|
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.
|
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.
|
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.
|
A define for abstracting loop unrolling between shading languages.
|
Detailed description
GLSL core defines and functions.
Global functions
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.
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.
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.
ffxF32ToF16
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
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.
ffxLerp
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:
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 GLSL 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 GLSL 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 GLSL 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 GLSL 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 GLSL 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 GLSL 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
.
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 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
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 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
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 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
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 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
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
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
.
ffxMed3
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
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
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
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
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
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 calcuation. |
z |
The third value to include in the min calcuation. |
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
.
ffxReciprocal
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
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
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
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
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
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
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
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
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.
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.