DX12 Backend

FidelityFX SDK native backend implementation for DirectX 12.

Modules

Functions

Return type

Description

FFX_API size_t

ffxGetScratchMemorySizeDX12 (size_t maxContexts)
Query how much memory is required for the DirectX 12 backend’s scratch buffer.

FFX_API FfxDevice

ffxGetDeviceDX12 (ID3D12Device* device)
Create a “FfxDevice“ from a “ID3D12Device“.

FFX_API FfxErrorCode

ffxGetInterfaceDX12 ( FfxInterface * backendInterface, FfxDevice device, void* scratchBuffer, size_t scratchBufferSize, size_t maxContexts )
Populate an interface with pointers for the DX12 backend.

FFX_API FfxCommandList

ffxGetCommandListDX12 (ID3D12CommandList* cmdList)
Create a “FfxCommandList“ from a “ID3D12CommandList“.

FFX_API FfxPipeline

ffxGetPipelineDX12 (ID3D12PipelineState* pipelineState)
Create a “FfxPipeline“ from a “ID3D12PipelineState“.

FFX_API FfxResource

ffxGetResourceDX12 ( const ID3D12Resource* dx12Resource, FfxResourceDescription ffxResDescription, const wchar_t* ffxResName, FfxResourceStates state = FFX_RESOURCE_STATE_COMPUTE_READ )
Fetch a “FfxResource“ from a “GPUResource“.

FFX_API FfxErrorCode

ffxLoadPixDll (const wchar_t* pixDllPath)
Loads PIX runtime dll to allow SDK calls to show up in Microsoft PIX.

FFX_API FfxSurfaceFormat

ffxGetSurfaceFormatDX12 (DXGI_FORMAT format)
Fetch a “FfxSurfaceFormat“ from a DXGI_FORMAT.

FFX_API DXGI_FORMAT

ffxGetDX12FormatFromSurfaceFormat (FfxSurfaceFormat surfaceFormat)
Fetch a DXGI_FORMAT from a “FfxSurfaceFormat“.

FFX_API FfxResourceDescription

ffxGetResourceDescriptionDX12 ( const ID3D12Resource* pResource, FfxResourceUsage additionalUsages = FFX_RESOURCE_USAGE_READ_ONLY )
Fetch a “FfxResourceDescription“ from an existing ID3D12Resource.

FFX_API FfxCommandQueue

ffxGetCommandQueueDX12 (ID3D12CommandQueue* pCommandQueue)
Fetch a “FfxCommandQueue“ from an existing ID3D12CommandQueue.

FFX_API FfxSwapchain

ffxGetSwapchainDX12 (IDXGISwapChain4* pSwapchain)
Fetch a “FfxSwapchain“ from an existing IDXGISwapChain4.

FFX_API IDXGISwapChain4*

ffxGetDX12SwapchainPtr (FfxSwapchain ffxSwapchain)
Fetch a IDXGISwapChain4 from an existing “FfxSwapchain“.

Detailed description

FidelityFX SDK native backend implementation for DirectX 12.

Global functions

ffxGetScratchMemorySizeDX12

Copied!

FFX_API  size_t ffxGetScratchMemorySizeDX12 (size_t maxContexts)

Query how much memory is required for the DirectX 12 backend’s scratch buffer.

Parameters:

maxContexts

The maximum number of simultaneous effect contexts that will share the backend. (Note that some effects contain internal contexts which count towards this maximum)

Returns:

The size (in bytes) of the required scratch memory buffer for the DX12 backend.


ffxGetDeviceDX12

Copied!

FFX_API  FfxDevice  ffxGetDeviceDX12 (ID3D12Device* device)

Create a FfxDevice from a ID3D12Device.

Parameters:

device

A pointer to the DirectX12 device.

Returns:

An abstract FidelityFX device.


ffxGetInterfaceDX12

Copied!

FFX_API  FfxErrorCode  ffxGetInterfaceDX12 (
    FfxInterface * backendInterface,
    FfxDevice  device,
    void* scratchBuffer,
    size_t scratchBufferSize,
    size_t maxContexts
)

Populate an interface with pointers for the DX12 backend.

Parameters:

backendInterface

A pointer to a FfxInterface structure to populate with pointers.

device

A pointer to the DirectX12 device.

scratchBuffer

A pointer to a buffer of memory which can be used by the DirectX(R)12 backend.

scratchBufferSize

The size (in bytes) of the buffer pointed to by scratchBuffer.

maxContexts

The maximum number of simultaneous effect contexts that will share the backend. (Note that some effects contain internal contexts which count towards this maximum)

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_CODE_INVALID_POINTER

The interface pointer was NULL.


ffxGetCommandListDX12

Copied!

FFX_API  FfxCommandList  ffxGetCommandListDX12 (ID3D12CommandList* cmdList)

Create a FfxCommandList from a ID3D12CommandList.

Parameters:

cmdList

A pointer to the DirectX12 command list.

Returns:

An abstract FidelityFX command list.


ffxGetPipelineDX12

Copied!

FFX_API  FfxPipeline  ffxGetPipelineDX12 (ID3D12PipelineState* pipelineState)

Create a FfxPipeline from a ID3D12PipelineState.

Parameters:

pipelineState

A pointer to the DirectX12 pipeline state.

Returns:

An abstract FidelityFX pipeline.


ffxGetResourceDX12

Copied!

FFX_API  FfxResource  ffxGetResourceDX12 (
    const ID3D12Resource* dx12Resource,
    FfxResourceDescription  ffxResDescription,
    const wchar_t* ffxResName,
    FfxResourceStates  state = FFX_RESOURCE_STATE_COMPUTE_READ
)

Fetch a FfxResource from a GPUResource.

Parameters:

dx12Resource

A pointer to the DX12 resource.

ffxResDescription

An FfxResourceDescription for the resource representation.

ffxResName

(optional) A name string to identify the resource in debug mode.

state

The state the resource is currently in.

Returns:

An abstract FidelityFX resources.


ffxLoadPixDll

Copied!

FFX_API  FfxErrorCode  ffxLoadPixDll (const wchar_t* pixDllPath)

Loads PIX runtime dll to allow SDK calls to show up in Microsoft PIX.

Parameters:

pixDllPath

The path to the DLL to load.

Return values:

FFX_OK

The operation completed successfully.

FFX_ERROR_INVALID_PATH

Could not load the DLL using the provided path.

FFX_ERROR_BACKEND_API_ERROR

Could not get proc addresses for PIXBeginEvent and/or PIXEndEvent


ffxGetSurfaceFormatDX12

Copied!

FFX_API  FfxSurfaceFormat  ffxGetSurfaceFormatDX12 (DXGI_FORMAT format)

Fetch a FfxSurfaceFormat from a DXGI_FORMAT.

Parameters:

format

The DXGI_FORMAT to convert to FfxSurfaceFormat.

Returns:

An FfxSurfaceFormat.


ffxGetDX12FormatFromSurfaceFormat

Copied!

FFX_API  DXGI_FORMAT ffxGetDX12FormatFromSurfaceFormat (FfxSurfaceFormat  surfaceFormat)

Fetch a DXGI_FORMAT from a FfxSurfaceFormat.

Parameters:

surfaceFormat

The FfxSurfaceFormat to convert to DXGI_FORMAT.

Returns:

An DXGI_FORMAT.


ffxGetResourceDescriptionDX12

Copied!

FFX_API  FfxResourceDescription  ffxGetResourceDescriptionDX12 (
    const ID3D12Resource* pResource,
    FfxResourceUsage  additionalUsages = FFX_RESOURCE_USAGE_READ_ONLY
)

Fetch a FfxResourceDescription from an existing ID3D12Resource.

Parameters:

pResource

The ID3D12Resource resource to create a FfxResourceDescription for.

additionalUsages

Optional FfxResourceUsage flags needed for select resource mapping.

Returns:

An FfxResourceDescription.


ffxGetCommandQueueDX12

Copied!

FFX_API  FfxCommandQueue ffxGetCommandQueueDX12 (ID3D12CommandQueue* pCommandQueue)

Fetch a FfxCommandQueue from an existing ID3D12CommandQueue.

Parameters:

pCommandQueue

The ID3D12CommandQueue to create a FfxCommandQueue from.

Returns:

An FfxCommandQueue.


ffxGetSwapchainDX12

Copied!

FFX_API  FfxSwapchain ffxGetSwapchainDX12 (IDXGISwapChain4* pSwapchain)

Fetch a FfxSwapchain from an existing IDXGISwapChain4.

Parameters:

pSwapchain

The IDXGISwapChain4 to create a FfxSwapchain from.

Returns:

An FfxSwapchain.


ffxGetDX12SwapchainPtr

Copied!

FFX_API  IDXGISwapChain4* ffxGetDX12SwapchainPtr (FfxSwapchain ffxSwapchain)

Fetch a IDXGISwapChain4 from an existing FfxSwapchain.

Parameters:

ffxSwapchain

The FfxSwapchain to fetch an IDXGISwapChain4 from.

Returns:

An IDXGISwapChain4 object.