### FFX C++ API Context Creation Example Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api This C++ wrapper example shows how to create an FFX context, automatically linking chained descriptions. ```cpp // equivalent of above, chain of createUpscale and createBackend will be linked automatically. ffxReturnCode_t retCode = ffx::ContextCreate(upscaleContext, nullptr, createUpscale, createBackend); ``` -------------------------------- ### Init Function Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Initializes the render module. All setup code should be placed here. ```APIDOC ## Init(const json &initData) ### Description Rendermodule initialization function. This is where all setup code needs to happen. ### Method Init ### Parameters #### Request Body - **initData** (const json &) - Required - Initialization data. ### Attributes virtual ``` -------------------------------- ### FFX C API Context Creation Example Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Example of creating an FFX context using the C API. It demonstrates setting up description structures and chaining them via pNext. ```c struct ffxCreateBackendDX12Desc createBackend = /*...*/; struct ffxCreateContextDescUpscale createUpscale = { 0 }; createUpscale.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_UPSCALE; // fill struct ... createUpscale.header.pNext = &createBackend.header; ffxContext upscaleContext = NULL; ffxReturnCode_t retCode = ffxContextCreate(&upscaleContext, &createUpscale.header, NULL); // handle errors ``` -------------------------------- ### FSR 3.0 DX12 Backend Interface Setup Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Sets up the DX12 backend interface for FSR 3.0, including scratch buffer allocation. ```c FfxFsr3ContextDescription fsr3ContextDesc = {0}; // create backend interface (DX12) size_t scratchBufferSize = ffxGetScratchMemorySizeDX12(1); void* scratchBuffer = malloc(scrathBufferSize); memset(scratchBuffer, 0, scrathBufferSize); errorCode = ffxGetInterfaceDX12(&fsr3ContextDesc.backendInterfaceUpscaling, ffxGetDeviceDX12(dx12Device), scratchBuffer, scratchBufferSize, 1); assert(errorCode == FFX_OK); ``` -------------------------------- ### AnimatedTexturesRenderModule Init Function Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Initializes the render module. All setup code should be placed here. It takes JSON initialization data as input. ```cpp virtual void Init(const json &initData) override ``` -------------------------------- ### FSR 3.1 Upscaling Context Creation (C++ API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.1 upscaling context using the FFX API in C++. Requires backend interface setup. ```cpp ffx::CreateContextDescFsrUpscale fsrContextDesc{}; // fill fsrContextDesc ... // backend interface desc ... ffx::CreateContext(&upscalingContext, nullptr, fsrContextDesc, backendDesc); ``` -------------------------------- ### FSR 3.1 Upscaling Context Creation (C API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.1 upscaling context using the FFX API in C. Requires backend interface setup. ```c ffxCreateContextDescFsrUpscale fsrContextDesc = {0}; fsrContextDesc.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_FSR_UPSCALE; // fill fsrContextDesc ... // backend interface desc ... fsrContextDesc.header.pNext = &backendDesc.header; ffxCreateContext(&upscalingContext, &fsrContextDesc.header, NULL); ``` -------------------------------- ### FSR 3.0 Upscaling Context Creation Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.0 context for upscaling only. Requires backend interface setup. ```c FfxFsr3ContextDescription fsr3ContextDesc = {0}; // create backend interface ... // fill fsr3ContextDesc ... fsr3ContextDesc.flags |= FFX_FSR3_ENABLE_UPSCALING_ONLY; ffxFsr3ContextCreate(&fsr3Context, &fsr3ContextDesc); ``` -------------------------------- ### FSR 3.0 Context Creation (Upscale + Framegen) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.0 context supporting both upscaling and frame generation. Requires multiple backend interface setups. ```c FfxFsr3ContextDescription fsr3ContextDesc = {0}; // create backend interface (x3) ... // fill fsr3ContextDesc ... ffxFsr3ContextCreate(&fsr3Context, &fsr3ContextDesc); ``` -------------------------------- ### Query FSR Version IDs and Names (C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Use this C++ helper to query available FSR versions for a specific creation type. Ensure you use version IDs returned by ffxQuery and do not hard-code them. This example demonstrates querying the count first, then filling the version IDs and names. ```cpp ffx::QueryDescGetVersions versionQuery{}; versionQuery.createDescType = FFX_API_CREATE_CONTEXT_DESC_TYPE_UPSCALE; versionQuery.device = GetDX12Device(); // only for DirectX 12 applications uint64_t versionCount = 0; versionQuery.outputCount = &versionCount; // get number of versions for allocation ffxQuery(nullptr, &versionQuery.header); std::vector versionNames; std::vector versionIds; m_FsrVersionIds.resize(versionCount); versionNames.resize(versionCount); versionQuery.versionIds = versionIds.data(); versionQuery.versionNames = versionNames.data(); // fill version ids and names arrays. ffxQuery(nullptr, &versionQuery.header); ``` -------------------------------- ### Query Upscale Ratio and Render Resolution (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 In FSR 3.1 with the FFX API C, use `ffxQuery` with specific query descriptors to get the upscale ratio and render resolution. ```c float upscaleRatio; struct ffxQueryDescFsrGetUpscaleRatioFromQualityMode queryDesc1 = {0}; queryDesc1.header.type = FFX_API_QUERY_DESC_TYPE_FSR_GETUPSCALERATIOFROMQUALITYMODE; queryDesc1.qualityMode = FFX_FSR_QUALITY_MODE_BALANCED; queryDesc1.pOutUpscaleRatio = &upscaleRatio; ffxQuery(&fsrContext, &queryDesc1.header); // --> uint32_t renderWidth, renderHeight; struct ffxQueryDescFsrGetRenderResolutionFromQualityMode queryDesc2 = {0}; queryDesc2.header.type = FFX_API_QUERY_DESC_TYPE_FSR_GETRENDERRESOLUTIONFROMQUALITYMODE; queryDesc2.displayWidth = displayWidth; queryDesc2.displayHeight = displayHeight; queryDesc2.qualityMode = FFX_FSR_QUALITY_MODE_BALANCED; queryDesc2.pOutRenderWidth = &renderWidth; queryDesc2.pOutRenderHeight = &renderHeight; ffxQuery(&fsrContext, &queryDesc2.header); ``` -------------------------------- ### Destroy Context and Backend Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Provides examples for destroying the FSR context and releasing backend resources for FSR 3.0 and FSR 3.1. ```APIDOC ## FSR 3.0 Context and Backend Destruction ### Description Destroys the FSR 3.0 context and frees backend resources. ### Code Example ```c ffxFsr3ContextDestroy(&fsr3Context); // for each backend interface: free(backendInterface.scratchBuffer); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C Context Destruction ### Description Destroys the FSR 3.1 context using the FFX API in C. ### Code Example ```c ffxDestroyContext(&fsrContext, NULL); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C++ Context Destruction ### Description Destroys the FSR 3.1 context using the FFX API in C++. ### Code Example ```cpp ffx::DestroyContext(fsrContext, nullptr); ``` ``` -------------------------------- ### Configure Miscellaneous Sample Options Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Set various miscellaneous options for sample execution, including font size, AGSEnabled, StablePowerState, InvertedDepth, MotionVectorGeneration, OverrideSceneSamplers, and BuildRayTracingAccelerationStructure. ```json "FontSize": 13, "AGSEnabled": false, "StablePowerState": false, "InvertedDepth": true, "MotionVectorGeneration": "", "OverrideSceneSamplers": true, "BuildRayTracingAccelerationStructure": false, ``` -------------------------------- ### Configure Sample Benchmarking Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Enables benchmarking of the sample for a specified duration, with options to set output path, append data, and choose JSON format. ```bash -benchmark [duration=X] ``` -------------------------------- ### Run in Fullscreen Mode Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Runs the sample in borderless full-screen mode. ```bash -fullscreen ``` -------------------------------- ### Configure Content Loading for Samples Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Define content blocks to dictate the scene, camera, and particles loaded at runtime. These can be overridden from the command line. ```json "Content": { "ParticleSpawners": [ { "Name": "FSRSpawner", "AtlasPath": "media/particles/atlas.dds", "Position": [ 0.0, 0.0, 0.0 ], "Sort": true, "Emitters": [ { "Name": "Smoke", "SpawnOffset": [ 0.0, 0.0, 1.4 ], "SpawnOffsetVariance": [ 0.1, 0.0, 0.1 ], "SpawnVelocity": [ 0.0, 0.2, 0.0 ], "SpawnVelocityVariance": 1.0, "ParticlesPerSecond": 10, "Lifespan": 50.0, "SpawnSize": 0.4, "KillSize": 1.0, "Mass": 0.0003, "AtlasIndex": 0, "Flags": { "Reactive": true, "Streaks": false } }, ] } ], "Scenes": [ "../media/Chess/scene.gltf" ], "Camera": "Camera_1", "DiffuseIBL": "../media/IBL/mud_road_puresky_Diffuse.dds", "SpecularIBL": "../media/IBL/mud_road_puresky_Specular.dds", "SkyMap": "../media/IBL/mud_road_puresky_Specular.dds", "SceneExposure": 1.355 } ``` -------------------------------- ### Enable RenderDoc Capture Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Enables the UI and options to take RenderDoc captures from the sample runtime. ```bash -renderdoc ``` -------------------------------- ### Configure Present Callback (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Sets up the present callback and its user context within the FSR 3.1 frame generation configuration using FFX API C. ```c // ... struct ffxConfigureDescFrameGeneration config; config.presentCallback = myPresentCallback; config.presentCallbackUserContext = &myEngineContext; ``` -------------------------------- ### Enable CPU Validation and Debug Shaders Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Launches the sample with CPU validation, memory leak checks, and FidelityFX Cauldron Framework shaders built with debug information. ```bash -devmode ``` -------------------------------- ### Set Custom Resolution Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Overrides the default startup resolution with the specified width and height. ```bash -resolution [WIDTH] [HEIGHT] ``` -------------------------------- ### Enable PIX Capture Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Enables the UI and options to take PIX captures from the sample runtime. ```bash -pix ``` -------------------------------- ### Configure Feature Support and Shader Model Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Set feature toggles and the minimum required shader model. Unsupported features or shader models will cause the sample to halt. ```json "FeatureSupport": { "VRSTier1": false, "VRSTier2": false, "RT1.0": false, "RT1.1": false, "FP16": false, "ShaderModel": "SM6_0" } ``` -------------------------------- ### FSR 3.1 DX12 Backend Creation (C++ API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.1 context with a DX12 backend using the FFX API in C++. The backend description is passed directly. ```cpp ffx::CreateContextDescFsrUpscale fsrContextDesc{}; // fill fsrContextDesc ... // backend interface desc (dx12) ffx::CreateBackendDX12Desc backendDesc{}; backendDesc.device = dx12Device; ffx::CreateContext(&upscalingContext, nullptr, fsrContextDesc, backendDesc); ``` -------------------------------- ### Configure Presentation Settings Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Set swapchain properties like backbuffer count, Vsync, fullscreen mode, resolution, and display mode. HDR modes require specific monitor capabilities and Windows settings. ```json "Presentation": { "BackBufferCount": 3, "Vsync": false, "Fullscreen": false, "Width": 2560, "Height": 1440, "Mode": "DISPLAYMODE_LDR" } ``` -------------------------------- ### FSR 3.1 DX12 Backend Creation (C API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates an FSR 3.1 context with a DX12 backend using the FFX API in C. The backend description is linked via pNext. ```c ffxCreateContextDescFsrUpscale fsrContextDesc = {0}; // fill fsrContextDesc ... // backend interface desc (dx12) ffxCreateBackendDX12Desc backendDesc = {0}; backendDesc.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_BACKEND_DX12; backendDesc.device = dx12Device; fsrContextDesc.header.pNext = &backendDesc.header; // create context and backend ffxCreateContext(&upscalingContext, &fsrContextDesc.header, NULL); ``` -------------------------------- ### Configure Render Module Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Use RenderModuleOptions to specify initialization data for render modules. This can be overridden in sample configuration files. ```json "RenderModuleOptions": { "ZPrepass": false, "VariableShading": false } ``` -------------------------------- ### FSR 3.1 Context Creation (Upscale + Framegen, C++ API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates separate FSR 3.1 contexts for upscaling and frame generation using the FFX API in C++. Both are passed the same backend description. ```cpp ffx::CreateContextDescFsrUpscale fsrContextDesc{}; // fill fsrContextDesc ... // backend interface desc ... ffx::CreateContext(&upscalingContext, nullptr, fsrContextDesc, backendDesc); ffx::CreateContextDescFsrFrameGen fgContextDesc{}; // fill fgContextDesc ... // backend interface desc ... ffx::CreateContext(&frameGenContext, nullptr, fgContextDesc, backendDesc); ``` -------------------------------- ### Configure Debugging Options Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Enable development mode, debug shaders, and capture tools like RenderDoc or PIX. Development mode automatically enables debug shaders and CPU validation. ```json "DebugOptions": { "DevelopmentMode": false, "DebugShaders": false, "EnableRenderDocCapture": false, "EnablePixCapture": false } ``` -------------------------------- ### FSR 3.1 Context Creation (Upscale + Framegen, C API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Creates separate FSR 3.1 contexts for upscaling and frame generation using the FFX API in C. Both link to the same backend description. ```c ffxCreateContextDescFsrUpscale fsrContextDesc = {0}; fsrContextDesc.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_FSR_UPSCALE; // fill fsrContextDesc ... // backend interface desc ... fsrContextDesc.header.pNext = &backendDesc.header; ffxCreateContext(&upscalingContext, &fsrContextDesc.header, NULL); ffxCreateContextDescFsrFrameGeneneration fgContextDesc = {0}; // fill fgContextDesc ... // backend interface desc ... fgContextDesc.header.pNext = &backendDesc.header; ffxCreateContext(&frameGenContext, &fgContextDesc.header, NULL); ``` -------------------------------- ### Query Information with ffxQuery Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Use ffxQuery to retrieve information or resources from an effect. The context must be valid, and output values are written through pointers in the query description. ```c ffxReturnCode_t ffxQuery(ffxContext* context, ffxQueryDescHeader* desc); ``` -------------------------------- ### Dispatch Upscaling and Frame Generation Prepare Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Shows how to dispatch both the upscaling pass and prepare resources for frame generation in FSR 3.0 and FSR 3.1. ```APIDOC ## FSR 3.0 Upscaling and Frame Generation Prepare ### Description Dispatches the upscaling pass and prepares resources for frame generation in FSR 3.0. ### Code Example ```c // dispatch upscaling and prepare resources for frame generation FfxFsr3DispatchUpscaleDescription params = {0}; // fill params ... ffxFsr3ContextDispatchUpscale(&fsr3Context, ¶ms); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C Upscaling and Frame Generation Prepare ### Description Dispatches the upscaling pass and prepares resources for frame generation in FSR 3.1 using the FFX API in C. ### Code Example ```c struct ffxDispatchDescFsrUpscale upscaleParams = {0}; upscaleParams.header.type = FFX_API_DISPATCH_DESC_TYPE_FSR_UPSCALE; struct ffxDispatchDescFrameGenerationPrepare frameGenParams = {0}; frameGenParams.header.type = FFX_API_DISPATCH_DESC_TYPE_FRAMEGENERATION_PREPARE; // fill both structs with params ... ffxDispatch(&fsrContext, &upscaleParams); ffxDispatch(&fgContext, &frameGenParams); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C++ Upscaling and Frame Generation Prepare ### Description Dispatches the upscaling pass and prepares resources for frame generation in FSR 3.1 using the FFX API in C++. ### Code Example ```cpp ffx::DispatchDescFsrUpscale upscaleParams{}; ffx::DispatchDescFrameGenerationPrepare frameGenParams{}; // fill both structs with params ... ffx::Dispatch(fsrContext, upscaleParams); ffx::Dispatch(fgContext, frameGenParams); ``` ``` -------------------------------- ### Define Render Resources and Aliases Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Specify resources to be created at framework initialization, including their format and resolution. Resource aliases provide alternative names for accessing resources. ```json "RenderResources": { "MotionVectorTarget": { "Format": "RG16_FLOAT", "RenderResolution": true }, "GBufferMotionVectorRT": "MotionVectorTarget" } ``` -------------------------------- ### Dispatch Upscaling and Frame Generation Prepare (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches both upscaling and frame generation preparation using the FSR 3.1 FFX API in C. Requires separate descriptors for each pass. ```c struct ffxDispatchDescFsrUpscale upscaleParams = {0}; upscaleParams.header.type = FFX_API_DISPATCH_DESC_TYPE_FSR_UPSCALE; struct ffxDispatchDescFrameGenerationPrepare frameGenParams = {0}; frameGenParams.header.type = FFX_API_DISPATCH_DESC_TYPE_FRAMEGENERATION_PREPARE; // fill both structs with params ... ffxDispatch(&fsrContext, &upscaleParams); ffxDispatch(&fgContext, &frameGenParams); ``` -------------------------------- ### ffxQuery Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Queries information or resources from an effect. The context must be a valid context created by `ffxCreateContext`, unless documentation for a specific query states otherwise. Output values will be returned by writing through pointers passed in the query description. ```APIDOC ## ffxQuery ### Description Queries information or resources from an effect. ### Signature ```c ffxReturnCode_t ffxQuery(ffxContext* context, ffxQueryDescHeader* desc); ``` ### Parameters - **context** (`ffxContext*`): A valid context created by `ffxCreateContext`. - **desc** (`ffxQueryDescHeader*`): Pointer to the query description structure. Output values are written through pointers within this structure. ``` -------------------------------- ### Dispatch Upscaling and Frame Generation Prepare (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches both upscaling and frame generation preparation using the FSR 3.1 FFX API in C++. ```cpp ffx::DispatchDescFsrUpscale upscaleParams{}; ffx::DispatchDescFrameGenerationPrepare frameGenParams{}; // fill both structs with params ... ffx::Dispatch(fsrContext, upscaleParams); ffx::Dispatch(fgContext, frameGenParams); ``` -------------------------------- ### Dispatch Rendering Commands with ffxDispatch Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Use ffxDispatch to send rendering commands or execute other functionality. The context must be valid. GPU dispatches encode commands into a buffer, while CPU dispatches execute immediately. ```c ffxReturnCode_t ffxDispatch(ffxContext* context, const ffxDispatchDescHeader* desc); ``` -------------------------------- ### Generate Visual Studio Solution Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/building-samples Use this batch script to generate Visual Studio solutions for the FidelityFX SDK samples. You can choose to build the SDK as a DLL or a static library and select which samples to include. ```batch > \"\BuildSamplesSolution[DX12/VK].bat\" ``` -------------------------------- ### Load Custom Scene Content Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Overrides the default scene to load at startup with custom glTF 2.0 content. Multiple scenes can be loaded. ```bash -loadcontent [SCENE PATH] ``` -------------------------------- ### ffxDispatch Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Dispatches rendering commands or other functionality. The context must be a valid context created by `ffxCreateContext`. GPU rendering dispatches will encode their commands into a command list/buffer passed as input. CPU dispatches will usually execute their function synchronously and immediately. ```APIDOC ## ffxDispatch ### Description Dispatches rendering commands or other functionality for an effect. ### Signature ```c ffxReturnCode_t ffxDispatch(ffxContext* context, const ffxDispatchDescHeader* desc); ``` ### Parameters - **context** (`ffxContext*`): A valid context created by `ffxCreateContext`. - **desc** (`const ffxDispatchDescHeader*`): Pointer to the dispatch description structure. ### Notes - GPU rendering dispatches will encode their commands into a command list/buffer passed as input. - CPU dispatches will usually execute their function synchronously and immediately. ``` -------------------------------- ### Dispatch Upscaling and Frame Generation Prepare (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the upscaling pass and prepares resources for frame generation using the FSR 3.0 API. ```c // dispatch upscaling and prepare resources for frame generation FfxFsr3DispatchUpscaleDescription params = {0}; // fill params ... ffxFsr3ContextDispatchUpscale(&fsr3Context, ¶ms); ``` -------------------------------- ### Query Upscale Ratio and Render Resolution (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 For FSR 3.1 using the FFX API C++, utilize `ffx::Query` with query descriptors to retrieve upscale ratio and render resolution. ```cpp float upscaleRatio; ffx::QueryDescFsrGetUpscaleRatioFromQualityMode queryDesc1{}; queryDesc1.qualityMode = FFX_FSR_QUALITY_MODE_BALANCED; queryDesc1.pOutUpscaleRatio = &upscaleRatio; ffx::Query(fsrContext, queryDesc1); // --> uint32_t renderWidth, renderHeight; ffx::QueryDescFsrGetRenderResolutionFromQualityMode queryDesc2{}; queryDesc2.displayWidth = displayWidth; queryDesc2.displayHeight = displayHeight; queryDesc2.qualityMode = FFX_FSR_QUALITY_MODE_BALANCED; queryDesc2.pOutRenderWidth = &renderWidth; queryDesc2.pOutRenderHeight = &renderHeight; ffx::Query(fsrContext, queryDesc2); ``` -------------------------------- ### Configure Effect with ffxConfigure Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Use ffxConfigure to set parameters for an effect. The context must be valid, and effects have a key-value configuration struct for simple options. ```c ffxReturnCode_t ffxConfigure(ffxContext* context, const ffxConfigureDescHeader* desc); ``` -------------------------------- ### ffxConfigure Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Configures an effect. The context must be a valid context created by `ffxCreateContext`, unless documentation for a specific configure description states otherwise. All effects have a key-value configure struct used for simple options. ```APIDOC ## ffxConfigure ### Description Configures an effect with specified parameters. ### Signature ```c ffxReturnCode_t ffxConfigure(ffxContext* context, const ffxConfigureDescHeader* desc); ``` ### Parameters - **context** (`ffxContext*`): A valid context created by `ffxCreateContext`. - **desc** (`const ffxConfigureDescHeader*`): Pointer to the configuration description structure. ### Key-Value Configuration Example ```c struct ffxConfigureDescUpscaleKeyValue { ffxConfigureDescHeader header; uint64_t key; ///< Configuration key, member of the FfxApiConfigureUpscaleKey enumeration. uint64_t u64; ///< Integer value or enum value to set. void* ptr; ///< Pointer to set or pointer to value to set. }; ``` ### Notes The available keys and constraints on values to pass are specified in the relevant technique’s documentation. ``` -------------------------------- ### Configure Frame Generation (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 For FSR 3.1 using FFX API C++, frame generation configuration is done via `ffxConfigure` and `ffx::ConfigureDescFrameGeneration`. ```cpp ffx::ConfigureDescFrameGeneration config{}; // fill config ... ffxConfigure(fsrContext, config); ``` -------------------------------- ### Dispatch Upscaling (No Frame Generation) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Demonstrates how to dispatch the upscaling pass for FSR 3.0 and FSR 3.1 using both C and C++ APIs. ```APIDOC ## FSR 3.0 Upscaling Dispatch ### Description Dispatches the upscaling pass for FSR 3.0. ### Code Example ```c // (context created with UPSCALING_ONLY flag) FfxFsr3DispatchUpscaleDescription params = {0}; // fill params ... ffxFsr3ContextDispatchUpscale(&fsr3Context, ¶ms); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C Upscaling Dispatch ### Description Dispatches the upscaling pass for FSR 3.1 using the FFX API in C. ### Code Example ```c struct ffxDispatchDescFsrUpscale params = {0}; params.header.type = FFX_API_DISPATCH_DESC_TYPE_FSR_UPSCALE; // fill params ... ffxDispatch(&fsrContext, ¶ms); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C++ Upscaling Dispatch ### Description Dispatches the upscaling pass for FSR 3.1 using the FFX API in C++. ### Code Example ```cpp ffx::DispatchDescFsrUpscale params{}; // fill params ... ffx::Dispatch(fsrContext, params); ``` ``` -------------------------------- ### Key-Value Configuration Structure Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Defines the structure for key-value configuration within ffxConfigure, used for setting simple options with integer or pointer values. ```c struct ffxConfigureDescUpscaleKeyValue { ffxConfigureDescHeader header; uint64_t key; ///< Configuration key, member of the FfxApiConfigureUpscaleKey enumeration. uint64_t u64; ///< Integer value or enum value to set. void* ptr; ///< Pointer to set or pointer to value to set. }; ``` -------------------------------- ### Enable Validation Layers Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Configure CPU and GPU validation layers. GPU validation can significantly impact performance. ```json "Validation": { "CpuValidationLayerEnabled": false, "GpuValidationLayerEnabled": false } ``` -------------------------------- ### FFX API Context Creation Declaration Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api This is the C API declaration for creating an FFX context. Ensure the context pointer is initialized to null and use the header pointer for descriptions. ```c ffxReturnCode_t ffxCreateContext(ffxContext* context, ffxCreateContextDescHeader* desc, const ffxAllocationCallbacks* memCb); ``` -------------------------------- ### Parameters Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pParameters private member, a pointer to a cauldron::ParameterSet object. ```cpp cauldron::ParameterSet * m_pParameters = = nullptr ``` -------------------------------- ### Configure Present Callback (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Assigns the custom present callback function and its user context in FSR 3.1 frame generation configuration using FFX API C++. ```cpp // ... ffx::ConfigureDescFrameGeneration config; config.presentCallback = myPresentCallback; config.presentCallbackUserContext = &myEngineContext; ``` -------------------------------- ### Set Depth Distribution Layout Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Toggles between infinite inverted depth (default) and regular depth distribution layouts. ```bash -inverteddepth [1 or 0] ``` -------------------------------- ### ffxCreateContext Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Creates a FidelityFX context. The context should be initialized to null before the call. The second argument is a pointer to the struct header, not the struct itself. The third argument is used for custom allocators and may be null. ```APIDOC ## ffxCreateContext ### Description Creates a FidelityFX context. ### Signature ```c ffxReturnCode_t ffxCreateContext(ffxContext* context, ffxCreateContextDescHeader* desc, const ffxAllocationCallbacks* memCb); ``` ### Parameters - **context** (*ffxContext**): A pointer to the ffxContext to be created. Should be initialized to `NULL` before the call. - **desc** (*ffxCreateContextDescHeader**): A pointer to the struct header describing the context to create. - **memCb** (*const ffxAllocationCallbacks**): Optional. Custom memory allocation callbacks. If `NULL`, default allocators are used. ### Example (C/C++) ```c struct ffxCreateBackendDX12Desc createBackend = { /* ... */ }; struct ffxCreateContextDescUpscale createUpscale = { 0 }; createUpscale.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_UPSCALE; // ... fill struct ... createUpscale.header.pNext = &createBackend.header; ffxContext upscaleContext = NULL; ffxReturnCode_t retCode = ffxContextCreate(&upscaleContext, &createUpscale.header, NULL); // handle errors ``` ### Example (C++ Wrapper) ```cpp // equivalent of above, chain of createUpscale and createBackend will be linked automatically. ffxReturnCode_t retCode = ffx::ContextCreate(upscaleContext, nullptr, createUpscale, createBackend); ``` ``` -------------------------------- ### Take Screenshot on Exit Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Takes a screenshot of the very last frame rendered before the sample quits. ```bash -screenshot ``` -------------------------------- ### Set Default Camera Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples When loading content, attempts to set the default camera to the one specified by name. Uses a default camera if the named entity is not found. ```bash -camera ["CAMERA NAME"] ``` -------------------------------- ### Configure Frame Generation (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 This snippet shows how to configure frame generation in FSR 3.0 using the `FfxFrameGenerationConfig` structure. ```c++ FfxFrameGenerationConfig config = {0}; // fill config ... ffxFsr3ConfigureFrameGeneration(&fsr3Context, &config); ``` -------------------------------- ### Dispatch Frame Generation (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the frame generation pass using the FSR 3.1 FFX API in C++. This involves querying for command list and output texture before dispatching. ```cpp ffx::DispatchDescFrameGeneration dispatchFg{}; ffx::QueryDescFrameGenerationSwapChainInterpolationCommandListDX12 queryCmdList{}; queryCmdList.pOutCommandList = &dispatchFg.commandList; ffx::Query(swapChainContext, queryCmdList); ffx::QueryDescFrameGenerationSwapChainInterpolationTextureDX12 queryFiTexture{}; queryFiTexture.pOutTexture = &dispatchFg.outputs[0]; ffx::Query(swapChainContext, queryFiTexture); // other parameters ... ffx::Dispatch(fgContext, dispatchFg); ``` -------------------------------- ### Dispatch Frame Generation (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the frame generation pass using the FSR 3.1 FFX API in C. This involves querying for command list and output texture before dispatching. ```c struct ffxDispatchDescFrameGeneration dispatchFg = {0}; dispatchFg.header.type = FFX_API_DISPATCH_DESC_TYPE_FRAMEGENERATION; struct ffxQueryDescFrameGenerationSwapChainInterpolationCommandListDX12 queryCmdList = {0}; queryCmdList.header.type = FFX_API_QUERY_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_INTERPOLATIONCOMMANDLIST_DX12; queryCmdList.pOutCommandList = &dispatchFg.commandList; ffxQuery(&swapChainContext, &queryCmdList); struct ffxQueryDescFrameGenerationSwapChainInterpolationTextureDX12 queryFiTexture{}; queryFiTexture.header.type = FFX_API_QUERY_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_INTERPOLATIONTEXTURE_DX12; queryFiTexture.pOutTexture = &dispatchFg.outputs[0]; ffxQuery(&swapChainContext, &queryFiTexture); // other parameters ... ffxDispatch(&fgContext, &dispatchFg); ``` -------------------------------- ### Configure Frame Generation (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 In FSR 3.1 with FFX API C, frame generation is configured using `ffxConfigure` and the `ffxConfigureDescFrameGeneration` structure. ```c struct ffxConfigureDescFrameGeneration config = {0}; config.header.type = FFX_API_CONFIGURE_DESC_TYPE_FRAMEGENERATION; // fill config ... ffxConfigure(&fsrContext, &config); ``` -------------------------------- ### AnimatedTexturesRenderModule Constructor Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Constructs an instance of the AnimatedTexturesRenderModule. ```APIDOC ## AnimatedTexturesRenderModule() ### Description Constructs an instance of the AnimatedTexturesRenderModule. ### Method Constructor ### Parameters None ``` -------------------------------- ### Dispatch Frame Generation (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the frame generation pass without a callback mode using the FSR 3.0 API. Requires obtaining command list and output texture. ```c FfxFrameGenerationDispatchDescription fgDesc = {0}; ffxGetFrameinterpolationCommandlistDX12(ffxSwapChain, fgDesc.commandList); fgDesc.outputs[0] = ffxGetFrameinterpolationTextureDX12(ffxSwapChain); // other parameters ... ffxFsr3DispatchFrameGeneration(&fgDesc); ``` -------------------------------- ### Query Upscale Ratio and Render Resolution (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Use these functions in FSR 3.0 to determine the upscale ratio and calculate the required render resolution based on quality mode. ```c++ float upscaleRatio = ffxFsr3GetUpscaleRatioFromQualityMode(FFX_FSR3_QUALITY_MODE_BALANCED); // --> uint32_t renderWidth, renderHeight; ffxFsr3GetRenderResolutionFromQualityMode(&renderWidth, &renderHeight, displayWidth, displayHeight, FFX_FSR3_QUALITY_MODE_BALANCED); ``` -------------------------------- ### Configure Allocation Pool Sizes Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Define default sizes for various allocation pools used by the graphics framework, such as upload heaps and dynamic buffers. ```json "Allocations": { "UploadHeapSize": 419430400, "DynamicBufferPoolSize": 15728640, "GPUSamplerViewCount": 300, "GPUResourceViewCount": 50000, "CPUResourceViewCount": 50000, "CPURenderViewCount": 100, "CPUDepthViewCount": 100 } ``` -------------------------------- ### RasterViews Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pRasterViews private member, an array of 5 pointers to cauldron::RasterView objects. ```cpp std::array m_pRasterViews = = {} ``` -------------------------------- ### Present Callback Function (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Declares a custom present callback function for FSR 3.1 with FFX API C++. It includes the user context pointer. ```cpp extern "C" ffxReturnCode_t myPresentCallback(ffxCallbackDescFrameGenerationPresent* params, void* pUserCtx) { // pre-presentation work, e.g. UI return FFX_API_RETURN_OK; } ``` -------------------------------- ### UISection Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pUISection private member, a pointer to a cauldron::UISection object. ```cpp cauldron::UISection * m_pUISection = = nullptr ``` -------------------------------- ### Textures Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_Textures private member, a vector of pointers to constant cauldron::Texture objects. ```cpp std::vector m_Textures = = {} ``` -------------------------------- ### Execute Function Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Executes the render module's logic for a given frame. ```APIDOC ## Execute(double deltaTime, cauldron::CommandList *pCmdList) ### Description Executes the render module. ### Method Execute ### Parameters #### Request Body - **deltaTime** (double) - Required - The time elapsed since the last frame. - **pCmdList** (cauldron::CommandList *) - Required - Pointer to the command list for rendering commands. ``` -------------------------------- ### Set Display Mode Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Overrides the default display mode to use, supporting various HDR and LDR options. ```bash -displaymode [DISPLAYMODE] ``` -------------------------------- ### Dispatch Frame Generation (No Callback Mode) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Illustrates how to dispatch frame generation without using callbacks for FSR 3.0 and FSR 3.1. ```APIDOC ## FSR 3.0 Frame Generation Dispatch ### Description Dispatches frame generation in FSR 3.0 without using callbacks. ### Code Example ```c FfxFrameGenerationDispatchDescription fgDesc = {0}; ffxGetFrameinterpolationCommandlistDX12(ffxSwapChain, fgDesc.commandList); fgDesc.outputs[0] = ffxGetFrameinterpolationTextureDX12(ffxSwapChain); // other parameters ... ffxFsr3DispatchFrameGeneration(&fgDesc); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C Frame Generation Dispatch ### Description Dispatches frame generation in FSR 3.1 using the FFX API in C, without callbacks. ### Code Example ```c struct ffxDispatchDescFrameGeneration dispatchFg = {0}; dispatchFg.header.type = FFX_API_DISPATCH_DESC_TYPE_FRAMEGENERATION; struct ffxQueryDescFrameGenerationSwapChainInterpolationCommandListDX12 queryCmdList = {0}; queryCmdList.header.type = FFX_API_QUERY_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_INTERPOLATIONCOMMANDLIST_DX12; queryCmdList.pOutCommandList = &dispatchFg.commandList; ffxQuery(&swapChainContext, &queryCmdList); struct ffxQueryDescFrameGenerationSwapChainInterpolationTextureDX12 queryFiTexture{}; queryFiTexture.header.type = FFX_API_QUERY_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_INTERPOLATIONTEXTURE_DX12; queryFiTexture.pOutTexture = &dispatchFg.outputs[0]; ffxQuery(&swapChainContext, &queryFiTexture); // other parameters ... ffxDispatch(&fgContext, &dispatchFg); ``` ``` ```APIDOC ## FSR 3.1 / FFX API C++ Frame Generation Dispatch ### Description Dispatches frame generation in FSR 3.1 using the FFX API in C++, without callbacks. ### Code Example ```cpp ffx::DispatchDescFrameGeneration dispatchFg{}; ffx::QueryDescFrameGenerationSwapChainInterpolationCommandListDX12 queryCmdList{}; queryCmdList.pOutCommandList = &dispatchFg.commandList; ffx::Query(swapChainContext, queryCmdList); ffx::QueryDescFrameGenerationSwapChainInterpolationTextureDX12 queryFiTexture{}; queryFiTexture.pOutTexture = &dispatchFg.outputs[0]; ffx::Query(swapChainContext, queryFiTexture); // other parameters ... ffx::Dispatch(fgContext, dispatchFg); ``` ``` -------------------------------- ### Configure Present Callback (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Assigns a custom present callback function and its context to the FSR 3.0 frame generation configuration. ```c++ // ... FfxFrameGenerationConfig config; config.presentCallback = myPresentCallback; config.presentCallbackContext = &myEngineContext; ``` -------------------------------- ### AnimatedTexturesRenderModule Execute Function Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Executes the render module's logic. It takes the time delta and a command list as parameters. ```cpp virtual void Execute(double deltaTime, cauldron::CommandList *pCmdList) override ``` -------------------------------- ### RootSignature Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pRootSignature private member, a pointer to a cauldron::RootSignature object. ```cpp cauldron::RootSignature * m_pRootSignature = = nullptr ``` -------------------------------- ### Override Specular Image-Based Lighting Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/running-samples Overrides the default specular image-based lighting source with a specified texture path. ```bash -specularibl [PATH] ``` -------------------------------- ### Query Jitter Count and Offset (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 For FSR 3.1 with FFX API C, use `ffxQuery` with specific descriptors to obtain the jitter phase count and offset. ```c int32_t jitterCount; struct ffxQueryDescFsrGetJitterPhaseCount queryDesc1 = {0}; queryDesc1.header.type = FFX_API_QUERY_DESC_TYPE_FSR_GETJITTERPHASECOUNT; queryDesc1.renderWidth = renderWidth; queryDesc1.displayWidth = displayWidth; queryDesc1.pOutPhaseCount = &jitterCount; ffxQuery(&fsrContext, &queryDesc1.header); // --> float jitterX, jitterY; struct ffxQueryDescFsrGetJitterOffset queryDesc2 = {0}; queryDesc2.header.type = FFX_API_QUERY_DESC_TYPE_FSR_GETJITTEROFFSET; queryDesc2.index = jitterIndex; queryDesc2.phaseCount = jitterCount; queryDesc2.pOutX = &jitterX; queryDesc2.pOutY = &jitterY; ffxQuery(&fsrContext, &queryDesc2.header); ``` -------------------------------- ### FSR 3.1 Context Declaration (C API) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Declares FSR 3.1 context variables using the FFX API in C. ```c ffxContext upscalingContext, framegenContext; ``` -------------------------------- ### Present Callback Function (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Defines a custom present callback function for FSR 3.1 using the FFX API C. This version includes a user context pointer. ```c ffxReturnCode_t myPresentCallback(struct ffxCallbackDescFrameGenerationPresent* params, void* pUserCtx) { // pre-presentation work, e.g. UI return FFX_API_RETURN_OK; } ``` -------------------------------- ### Dispatch Upscaling (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the upscaling pass using the FSR 3.1 FFX API in C++. ```cpp ffx::DispatchDescFsrUpscale params{}; // fill params ... ffx::Dispatch(fsrContext, params); ``` -------------------------------- ### PipelineObject Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pPipelineObj private member, a pointer to a cauldron::PipelineObject object. ```cpp cauldron::PipelineObject * m_pPipelineObj = = nullptr ``` -------------------------------- ### FidelityFX API Memory Allocation Callbacks (C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/ffx-api Define custom memory allocation and deallocation functions for FidelityFX. These callbacks allow control over memory management during API operations. Ensure the deallocation function is compatible with the allocation function used. ```c typedef void* (*ffxAlloc)(void* pUserData, uint64_t size); typedef void (*ffxDealloc)(void* pUserData, void* pMem); typedef struct ffxAllocationCallbacks { void* pUserData; ffxAlloc alloc; ffxDealloc dealloc; } ffxAllocationCallbacks; ``` -------------------------------- ### Query Jitter Count and Offset (FSR 3.1 FFX API C++) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 When using FSR 3.1 with FFX API C++, employ `ffx::Query` with appropriate descriptors to retrieve jitter phase count and offset. ```cpp int32_t jitterCount; ffx::QueryDescFsrGetJitterPhaseCount queryDesc1{}; queryDesc1.renderWidth = renderWidth; queryDesc1.displayWidth = displayWidth; queryDesc1.pOutPhaseCount = &jitterCount; ffx::Query(fsrContext, queryDesc1); // --> float jitterX, jitterY; ffxQueryDescFsrGetJitterOffset queryDesc2{}; queryDesc2.index = jitterIndex; queryDesc2.phaseCount = jitterCount; queryDesc2.pOutX = &jitterX; queryDesc2.pOutY = &jitterY; ffx::Query(fsrContext, queryDesc2); ``` -------------------------------- ### Destroy Context (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Destroys the FSR 3.0 context and frees backend interface scratch buffers. ```c ffxFsr3ContextDestroy(&fsr3Context); // for each backend interface: free(backendInterface.scratchBuffer); ``` -------------------------------- ### DepthTarget Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pDepthTarget private member, a pointer to a constant cauldron::Texture object representing the depth target. ```cpp const cauldron::Texture * m_pDepthTarget = = nullptr ``` -------------------------------- ### AnimatedTexturesRenderModule Constructor Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module The inline constructor for the AnimatedTexturesRenderModule class. ```cpp inline AnimatedTexturesRenderModule() ``` -------------------------------- ### Dispatch Upscaling (FSR 3.0) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the upscaling pass using the FSR 3.0 API. Requires a context created with the UPSCALING_ONLY flag. ```c // (context created with UPSCALING_ONLY flag) FfxFsr3DispatchUpscaleDescription params = {0}; // fill params ... ffxFsr3ContextDispatchUpscale(&fsr3Context, ¶ms); ``` -------------------------------- ### FlipTimer Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_flipTimer private member, a float representing a timer for flipping, initialized to 0.0f. ```cpp float m_flipTimer = = 0.0f ``` -------------------------------- ### Dispatch Upscaling (FSR 3.1 FFX API C) Source: https://gpuopen.com/manuals/fidelityfx_sdk/getting-started/migrating-to-fsr-3-1 Dispatches the upscaling pass using the FSR 3.1 FFX API in C. Ensure the correct dispatch descriptor type is set. ```c struct ffxDispatchDescFsrUpscale params = {0}; params.header.type = FFX_API_DISPATCH_DESC_TYPE_FSR_UPSCALE; // fill params ... ffxDispatch(&fsrContext, ¶ms); ``` -------------------------------- ### RenderTarget Member Initialization Source: https://gpuopen.com/manuals/fidelityfx_sdk/reference_documentation/classes/animated_textures_render_module Declaration and initialization of the m_pRenderTarget private member, a pointer to a constant cauldron::Texture object representing the render target. ```cpp const cauldron::Texture * m_pRenderTarget = = nullptr ```