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.


Related pages

  • Visit the FidelityFX SDK product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!