Utilities

Utility Macros used by the FidelityFX SDK.

Functions

Return type

Description

uint8_t

ffxCountBitsSet (uint32_t val)
Computes the number of bits set to 1 in a integer.

Macros

Detailed description

Utility Macros used by the FidelityFX SDK.

Global functions

ffxCountBitsSet

Copied!

uint8_t ffxCountBitsSet (uint32_t val)

Computes the number of bits set to 1 in a integer.

Parameters:

val

Integer mask.

Returns:

Number of bits set to 1 in provided val.


Macros

FFX_ABSOLUTE

Copied!

#define FFX_ABSOLUTE (x) (((x) < 0) ? (-(x)) : (x))

Helper macro to return the abs of an integer value.


FFX_ALIGN_UP

Copied!

#define FFX_ALIGN_UP (x, y) (((x) + ((y)-1)) & ~((y)-1))

Helper macro to align an integer to the specified power of 2 boundary.


FFX_ARRAY_ELEMENTS

Copied!

#define FFX_ARRAY_ELEMENTS (x) (int32_t)((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))

Helper macro to work out the number of elements in an array.


FFX_CONTAINS_FLAG

Copied!

#define FFX_CONTAINS_FLAG (options, key) (((options) & key) == key)

Helper macro to check if the specified key is set in a bitfield.


FFX_DIVIDE_ROUNDING_UP

Copied!

#define FFX_DIVIDE_ROUNDING_UP (x, y) ((x + y - 1) / y)

Helper macro to compute the rounded-up integer division of two unsigned integers.


FFX_FORWARD_DECLARE

Copied!

#define FFX_FORWARD_DECLARE (x) typedef struct x x

Helper macro to forward declare a structure.


FFX_IS_ALIGNED

Copied!

#define FFX_IS_ALIGNED (x) (((x) != 0) && ((x) & ((x)-1)))

Helper macro to check if a value is aligned.


FFX_MAKE_VERSION

Copied!

#define FFX_MAKE_VERSION (major, minor, patch) ((major << 22) | (minor << 12) | patch)

Helper macro to create the version number.

Use this to specify no version.


FFX_MAXIMUM

Copied!

#define FFX_MAXIMUM (x, y) (((x) > (y)) ? (x) : (y))

Helper macro to return the maximum of two values.


FFX_MAXIMUM_PATH

Copied!

#define FFX_MAXIMUM_PATH (260)

The maximum length of a path that can be specified to the FidelityFX API.


FFX_MINIMUM

Copied!

#define FFX_MINIMUM (x, y) (((x) < (y)) ? (x) : (y))

Helper macro to return the minimum of two values.


FFX_SAFE_FREE

Copied!

#define FFX_SAFE_FREE (x, freeFunc)     do {                 \\
    if (x)           \\
    {                \\
        freeFunc(x); \\
        x = nullptr; \\
    }                \\
} while (false)

Helper macro to do safe free on a pointer.


FFX_SIGN

Copied!

#define FFX_SIGN (x) (((x) < 0) ? -1 : 1)

Helper macro to return sign of a value.


FFX_STR

Copied!

#define FFX_STR (s) FFX_XSTR(s)

Helper macro to stri.gify a value.


FFX_UNUSED

Copied!

#define FFX_UNUSED (x) ((void)(x))

Helper macro to avoid warnings about unused variables.