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 |
---|---|
fpGetSDKVersion
A callback function to query the SDK version.
|
|
fpGetEffectGpuMemoryUsage
A callback function to query effect Gpu memory usage.
|
|
fpCreateBackendContext
A callback function to create and initialize the backend context.
|
|
fpGetDeviceCapabilities
A callback function to query device capabilites.
|
|
fpDestroyBackendContext
A callback function to destroy the backendcontext. This also dereferences the device.
|
|
fpCreateResource
A callback function to create a resource.
|
|
fpRegisterResource
A callback function to register an external resource.
|
|
fpGetResource
A callback function to convert an internal resource to external resource type.
|
|
fpUnregisterResources
A callback function to unregister external resource.
|
|
fpRegisterStaticResource
A callback function to register a static resource.
|
|
fpGetResourceDescription
A callback function to retrieve a resource description.
|
|
fpDestroyResource
A callback function to destroy a resource.
|
|
fpMapResource
A callback function to map a resource.
|
|
fpUnmapResource
A callback function to unmap a resource.
|
|
fpStageConstantBufferDataFunc
A callback function to copy constant buffer data into staging memory.
|
|
fpCreatePipeline
A callback function to create a render or compute pipeline.
|
|
fpDestroyPipeline
A callback function to destroy a render or compute pipeline.
|
|
fpScheduleGpuJob
A callback function to schedule a render job.
|
|
fpExecuteGpuJobs
A callback function to execute all queued render jobs.
|
|
fpBreadcrumbsAllocBlock
A callback function to allocate block of memory for AMD FidelityFX Breadcrumbs Library buffer.
|
|
fpBreadcrumbsFreeBlock
A callback function to free AMD FidelityFX Breadcrumbs Library buffer.
|
|
fpBreadcrumbsWrite
A callback function to write marker into AMD FidelityFX Breadcrumbs Library.
|
|
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.
|
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“.
|
device
A backend specific device.
|