ContextCreate

Function ContextCreate 

Source
pub unsafe extern "C" fn ContextCreate(
    context: *mut Context,
    contextDescription: *const ContextDescription,
) -> ErrorCode
Expand description

Create a FidelityFX Super Resolution 2 context from the parameters programmed to the FfxFsr2CreateParams structure.

The context structure is the main object used to interact with the FSR2 API, and is responsible for the management of the internal resources used by the FSR2 algorithm. When this API is called, multiple calls will be made via the pointers contained in the callbacks structure. These callbacks will attempt to retreive the device capabilities, and create the internal resources, and pipelines required by FSR2’s frame-to-frame function. Depending on the precise configuration used when creating the FfxFsr2Context a different set of resources and pipelines might be requested via the callback functions.

The flags included in the flags field of FfxFsr2Context how match the configuration of your application as well as the intended use of FSR2. It is important that these flags are set correctly (as well as a correct programmed FfxFsr2DispatchDescription) to ensure correct operation. It is recommended to consult the overview documentation for further details on how FSR2 should be integerated into an application.

When the FfxFsr2Context is created, you should use the ffxFsr2ContextDispatch function each frame where FSR2 upscaling should be applied. See the documentation of ffxFsr2ContextDispatch for more details.

The FfxFsr2Context should be destroyed when use of it is completed, typically when an application is unloaded or FSR2 upscaling is disabled by a user. To destroy the FSR2 context you should call ffxFsr2ContextDestroy.

@param [out] context A pointer to a FfxFsr2Context structure to populate. @param [in] contextDescription A pointer to a FfxFsr2ContextDescription structure.

@retval FFX_OK The operation completed successfully. @retval FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. @retval FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr2ContextDescription.callbacks was not fully specified. @retval FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.

@ingroup FSR2