FidelityFX VRS

FidelityFX Variable Rate Shading runtime library.

Enumerations

Name

Description

FfxVrsInitializationFlagBits

An enumeration of bit flags used when creating a “FfxVrsContext“. See “FfxVrsContextDescription“.
FFX_VRS_ALLOW_ADDITIONAL_SHADING_RATES = (1 << 0) – A bit indicating if we should enable additional shading rates.

FfxVrsPass

An enumeration of the pass which constitutes the ShadingRateImage generation algorithm.
FFX_VRS_PASS_IMAGEGEN = 0 – A pass which generates a ShadingRateImage.
FFX_VRS_PASS_COUNT – The number of passes performed by VRS.

Structs

Name

Description

FfxVrsContext

A structure encapsulating the FidelityFX Variable Shading context.

FfxVrsContextDescription

A structure encapsulating the parameters required to initialize FidelityFX Variable Shading.

FfxVrsDispatchDescription

A structure encapsulating the parameters for dispatching the various passes of FidelityFX Variable Shading.

Functions

Return type

Description

FFX_API FfxErrorCode

ffxVrsContextCreate ( FfxVrsContext * pContext, const FfxVrsContextDescription * pContextDescription )
Create a FidelityFX Variable Shading context from the parameters programmed to the “FfxVrsContextDescription“ structure.

FFX_API FfxErrorCode

ffxVrsContextDispatch ( FfxVrsContext * pContext, const FfxVrsDispatchDescription * pDispatchDescription )
Dispatches work to the FidelityFX VRS context.

FFX_API FfxErrorCode

Destroy the FidelityFX VRS context.

FFX_API FfxErrorCode

ffxVrsGetImageSizeFromeRenderResolution ( uint32_t* pImageWidth, uint32_t* pImageHeight, uint32_t renderWidth, uint32_t renderHeight, uint32_t shadingRateImageTileSize )
A helper function to calculate the ShadingRateImage size from a target resolution.

FFX_API FfxVersionNumber

Queries the effect version number.

Macros

Name

Description

FFX_VRS_CONTEXT_COUNT 1

FidelityFX VRS context count.

FFX_VRS_CONTEXT_SIZE (16536)

The size of the context specified in 32bit values.

FFX_VRS_VERSION_MAJOR (1)

FidelityFX VRS major version.

FFX_VRS_VERSION_MINOR (2)

FidelityFX VRS minor version.

FFX_VRS_VERSION_PATCH (0)

FidelityFX VRS patch version.

Detailed description

FidelityFX Variable Rate Shading runtime library.

Global functions

ffxVrsContextCreate

Copied!

FFX_API  FfxErrorCode  ffxVrsContextCreate (
    FfxVrsContext * pContext,
    const FfxVrsContextDescription * pContextDescription
)

Create a FidelityFX Variable Shading context from the parameters programmed to the FfxVrsContextDescription structure.

The context structure is the main object used to interact with the Variable Shading API, and is responsible for the management of the internal resources used by the VRS algorithm. When this API is called, multiple calls will be made via the pointers contained in the backendInterface structure. This backend will attempt to retrieve the device capabilities, and create the internal resources, and pipelines required by VRS to function. Depending on the precise configuration used when creating the FfxVrsContext a different set of resources and pipelines might be requested via the callback functions.

The FfxVrsContext should be destroyed when use of it is completed, typically when an application is unloaded or Variable Shading is disabled by a user. To destroy the VRS context you should call ffxVrsContextDestroy.

Parameters:

pContext

A pointer to a FfxVrsContext structure to populate.

pContextDescription

A pointer to a FfxVrsContextDescription structure.

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_CODE_NULL_POINTER

The operation failed because either context or contextDescription was NULL.

FFX_ERROR_INCOMPLETE_INTERFACE

The operation failed because the FfxVrsContextDescription.callbacks was not fully specified.

FFX_ERROR_BACKEND_API_ERROR

The operation failed because of an error returned from the backend.


ffxVrsContextDispatch

Copied!

FFX_API  FfxErrorCode  ffxVrsContextDispatch (
    FfxVrsContext * pContext,
    const FfxVrsDispatchDescription * pDispatchDescription
)

Dispatches work to the FidelityFX VRS context.

Parameters:

pContext

A pointer to a FfxVrsContext structure to populate.

pDispatchDescription

A pointer to a FfxVrsDispatchDescription structure.

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_CODE_NULL_POINTER

The operation failed because either context or dispatchDescription was NULL.

FFX_ERROR_BACKEND_API_ERROR

The operation failed because of an error returned from the backend.


ffxVrsContextDestroy

Copied!

FFX_API  FfxErrorCode  ffxVrsContextDestroy (FfxVrsContext * pContext)

Destroy the FidelityFX VRS context.

Parameters:

pContext

A pointer to a FfxVrsContext structure to destroy.

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_CODE_NULL_POINTER

The operation failed because either context was NULL.


ffxVrsGetImageSizeFromeRenderResolution

Copied!

FFX_API  FfxErrorCode  ffxVrsGetImageSizeFromeRenderResolution (
    uint32_t* pImageWidth,
    uint32_t* pImageHeight,
    uint32_t renderWidth,
    uint32_t renderHeight,
    uint32_t shadingRateImageTileSize
)

A helper function to calculate the ShadingRateImage size from a target resolution.

Parameters:

pImageWidth

A pointer to a uint32_t which will hold the calculated image width.

pImageHeight

A pointer to a uint32_t which will hold the calculated image height.

renderWidth

The render resolution width.

renderHeight

The render resolution height.

shadingRateImageTileSize

The ShadingRateImage tile size.

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_INVALID_POINTER

Either imageWidth or imageHeight was NULL.


ffxVrsGetEffectVersion

Copied!

FFX_API  FfxVersionNumber  ffxVrsGetEffectVersion ()

Queries the effect version number.

Returns:

The SDK version the effect was built with.


Macros

FFX_VRS_CONTEXT_COUNT

Copied!

#define FFX_VRS_CONTEXT_COUNT 1

FidelityFX VRS context count.

Defines the number of internal effect contexts required by VRS


FFX_VRS_CONTEXT_SIZE

Copied!

#define FFX_VRS_CONTEXT_SIZE (16536)

The size of the context specified in 32bit values.


FFX_VRS_VERSION_MAJOR

Copied!

#define FFX_VRS_VERSION_MAJOR (1)

FidelityFX VRS major version.


FFX_VRS_VERSION_MINOR

Copied!

#define FFX_VRS_VERSION_MINOR (2)

FidelityFX VRS minor version.


FFX_VRS_VERSION_PATCH

Copied!

#define FFX_VRS_VERSION_PATCH (0)

FidelityFX VRS patch version.