FfxInterface

A structure encapsulating the interface between the core implementation of the FfxInterface and any graphics API that it should ultimately call.

File location: sdk/include/FidelityFX/host/ffx_interface.h

Detailed description

A structure encapsulating the interface between the core implementation of the FfxInterface and any graphics API that it should ultimately call.

This set of functions serves as an abstraction layer between FfxInterfae and the API used to implement it. While the FidelityFX SDK ships with backends for DirectX12 and Vulkan, it is possible to implement your own backend for other platforms which sit on top of your engine’s own abstraction layer. For details on the expectations of what each function should do you should refer the description of the following function pointer types:

  • FfxCreateDeviceFunc

  • FfxGetDeviceCapabilitiesFunc

  • FfxDestroyDeviceFunc

  • FfxCreateResourceFunc

  • FfxRegisterResourceFunc

  • FfxGetResourceFunc

  • FfxUnregisterResourcesFunc

  • FfxGetResourceDescriptionFunc

  • FfxDestroyResourceFunc

  • FfxCreatePipelineFunc

  • FfxDestroyPipelineFunc

  • FfxScheduleGpuJobFunc

  • FfxExecuteGpuJobsFunc

  • FfxBeginMarkerFunc

  • FfxEndMarkerFunc

  • FfxRegisterConstantBufferAllocatorFunc

Depending on the graphics API that is abstracted by the backend, it may be required that the backend is to some extent stateful. To ensure that applications retain full control to manage the memory used by the FidelityFX SDK, the scratchBuffer and scratchBufferSize fields are provided. A backend should provide a means of specifying how much scratch memory is required for its internal implementation (e.g: via a function or constant value). The application is then responsible for allocating that memory and providing it when setting up the SDK backend. Backends provided with the FidelityFX SDK do not perform dynamic memory allocations, and instead sub-allocate all memory from the scratch buffers provided.

The scratchBuffer and scratchBufferSize fields should be populated according to the requirements of each backend. For example, if using the DirectX 12 backend you should call the ffxGetScratchMemorySizeDX12 function. It is not required that custom backend implementations use a scratch buffer.

Any functional addition to this interface mandates a version bump to ensure full functionality across effects and backends.

Data fields

Type

Description

FfxGetSDKVersionFunc

fpGetSDKVersion
A callback function to query the SDK version.

FfxGetEffectGpuMemoryUsageFunc

fpGetEffectGpuMemoryUsage
A callback function to query effect Gpu memory usage.

FfxCreateBackendContextFunc

fpCreateBackendContext
A callback function to create and initialize the backend context.

FfxGetDeviceCapabilitiesFunc

fpGetDeviceCapabilities
A callback function to query device capabilites.

FfxDestroyBackendContextFunc

fpDestroyBackendContext
A callback function to destroy the backendcontext. This also dereferences the device.

FfxCreateResourceFunc

fpCreateResource
A callback function to create a resource.

FfxRegisterResourceFunc

fpRegisterResource
A callback function to register an external resource.

FfxGetResourceFunc

fpGetResource
A callback function to convert an internal resource to external resource type.

FfxUnregisterResourcesFunc

fpUnregisterResources
A callback function to unregister external resource.

FfxRegisterStaticResourceFunc

fpRegisterStaticResource
A callback function to register a static resource.

FfxGetResourceDescriptionFunc

fpGetResourceDescription
A callback function to retrieve a resource description.

FfxDestroyResourceFunc

fpDestroyResource
A callback function to destroy a resource.

FfxMapResourceFunc

fpMapResource
A callback function to map a resource.

FfxUnmapResourceFunc

fpUnmapResource
A callback function to unmap a resource.

FfxStageConstantBufferDataFunc

fpStageConstantBufferDataFunc
A callback function to copy constant buffer data into staging memory.

FfxCreatePipelineFunc

fpCreatePipeline
A callback function to create a render or compute pipeline.

FfxDestroyPipelineFunc

fpDestroyPipeline
A callback function to destroy a render or compute pipeline.

FfxScheduleGpuJobFunc

fpScheduleGpuJob
A callback function to schedule a render job.

FfxExecuteGpuJobsFunc

fpExecuteGpuJobs
A callback function to execute all queued render jobs.

FfxBreadcrumbsAllocBlockFunc

fpBreadcrumbsAllocBlock
A callback function to allocate block of memory for AMD FidelityFX Breadcrumbs Library buffer.

FfxBreadcrumbsFreeBlockFunc

fpBreadcrumbsFreeBlock
A callback function to free AMD FidelityFX Breadcrumbs Library buffer.

FfxBreadcrumbsWriteFunc

fpBreadcrumbsWrite
A callback function to write marker into AMD FidelityFX Breadcrumbs Library.

FfxBreadcrumbsPrintDeviceInfoFunc

fpBreadcrumbsPrintDeviceInfo
A callback function to print active GPU info for AMD FidelityFX Breadcrumbs Library log.

FfxSwapChainConfigureFrameGenerationFunc

fpSwapChainConfigureFrameGeneration
A callback function to configure swap chain present callback.

FfxRegisterConstantBufferAllocatorFunc

fpRegisterConstantBufferAllocator
A callback function to register a custom **Thread Safe* constant buffer allocator.*

void*

scratchBuffer
A preallocated buffer for memory utilized internally by the backend.

size_t

scratchBufferSize
Size of the buffer pointed to by “scratchBuffer“.

FfxDevice

device
A backend specific device.

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!