Advance native Windows RR integration, kernel tooling and local packaging
Implement native NGX feature-13 RR through a LUID-matched D3D12/Vulkan shared-memory and timeline-fence bridge. Add owned parameter snapshots, GPU resource lifetime handling, inherited/enhanced barriers, optional guides, sampled input formats and depth-plane support with stencil preservation. Separate RR initialization from the SR CUDA runtime and expose explicit backend/model selection through player configuration. Add synthetic bridge, snapshot and NGX lifecycle harnesses covering camera/history/reset, parameter mutation, delayed submission, early release, capability gating and unsupported-input rejection. Add exact gfx11 D/E model generation, verified caches, versioned local deployment with configuration backups, and isolated portable model tools with pinned Python, NumPy and glslang dependencies. Extend Windows K benchmarking and private native-cache selection. Fix LLVM 22 emitter/helper compatibility and preserve exact-output validation for local output-kernel optimization. Add native FSR RR provider diagnostics, local development package refresh tooling, installer/checker updates, FidelityFX headers and Windows parity documentation. Keep NVIDIA binaries, derived models and private optimized kernels out of distributable packages. Native RR evidence remains synthetic; game validation, FSR RR dispatch, installer integration and Linux performance parity remain incomplete.
This commit is contained in:
1 parent
3345fffcd3
commit
247fe1092d
60 files changed
+7168
-66
No files matched your search
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
These headers are copied unmodified from the AMD FidelityFX SDK
|
||||
(https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK), commit
|
||||
60f4ea81909200d8542eca14dccb2628b763a9a3 (SDK 2.3.0, FSR Ray Regeneration 1.2.0):
|
||||
|
||||
api/include/ffx_api.h
|
||||
api/include/ffx_api_types.h
|
||||
denoisers/include/ffx_denoiser.h
|
||||
|
||||
The SDK license (Kits/FidelityFX/docs/license.md) lists these files as exceptions
|
||||
that are subject to the following MIT license. The AMD runtime DLLs
|
||||
(amd_fidelityfx_*_dx12.dll) are NOT part of this repository and are governed by
|
||||
AMD's binary-only terms.
|
||||
|
||||
Copyright (C) Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (C) 2026 Advanced Micro Devices, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files(the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions :
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
#define FFX_API_ENTRY __declspec(dllexport)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum FfxApiReturnCodes
|
||||
{
|
||||
FFX_API_RETURN_OK = 0, ///< The oparation was successful.
|
||||
FFX_API_RETURN_ERROR = 1, ///< An error occurred that is not further specified.
|
||||
FFX_API_RETURN_ERROR_UNKNOWN_DESCTYPE = 2, ///< The structure type given was not recognized for the function or context with which it was used. This is likely a programming error.
|
||||
FFX_API_RETURN_ERROR_RUNTIME_ERROR = 3, ///< The underlying runtime (e.g. D3D12, Vulkan) or effect returned an error code.
|
||||
FFX_API_RETURN_NO_PROVIDER = 4, ///< No provider was found for the given structure type. This is likely a programming error.
|
||||
FFX_API_RETURN_ERROR_MEMORY = 5, ///< A memory allocation failed.
|
||||
FFX_API_RETURN_ERROR_PARAMETER = 6, ///< A parameter was invalid, e.g. a null pointer, empty resource or out-of-bounds enum value.
|
||||
FFX_API_RETURN_PROVIDER_NO_SUPPORT_NEW_DESCTYPE = 7, ///< The structure type given is new and not supported in the old provider. This is likely fixed with driver upgrade or effect DLL upgrade.
|
||||
};
|
||||
|
||||
typedef void* ffxContext;
|
||||
typedef uint32_t ffxReturnCode_t;
|
||||
|
||||
#define FFX_API_EFFECT_MASK 0x00ff0000u
|
||||
#define FFX_API_BACKEND_MASK 0xff000000u
|
||||
#define FFX_API_EFFECT_ID_GENERAL 0x00000000u
|
||||
|
||||
// Base Descriptor types
|
||||
typedef uint64_t ffxStructType_t;
|
||||
typedef struct ffxApiHeader
|
||||
{
|
||||
ffxStructType_t type; ///< The structure type. Must always be set to the corresponding value for any structure (found nearby with a similar name).
|
||||
struct ffxApiHeader* pNext; ///< Pointer to next structure, used for optional parameters and extensions. Can be null.
|
||||
} ffxApiHeader;
|
||||
|
||||
typedef ffxApiHeader ffxCreateContextDescHeader;
|
||||
typedef ffxApiHeader ffxConfigureDescHeader;
|
||||
typedef ffxApiHeader ffxQueryDescHeader;
|
||||
typedef ffxApiHeader ffxDispatchDescHeader;
|
||||
|
||||
// Extensions for global debug
|
||||
#define FFX_API_CONFIGURE_GLOBALDEBUG_LEVEL_SILENCE 0x0000000u
|
||||
#define FFX_API_CONFIGURE_GLOBALDEBUG_LEVEL_ERRORS 0x0000001u
|
||||
#define FFX_API_CONFIGURE_GLOBALDEBUG_LEVEL_WARNINGS 0x0000002u
|
||||
#define FFX_API_CONFIGURE_GLOBALDEBUG_LEVEL_VERBOSE 0xfffffffu
|
||||
|
||||
enum FfxApiMsgType
|
||||
{
|
||||
FFX_API_MESSAGE_TYPE_ERROR = 0,
|
||||
FFX_API_MESSAGE_TYPE_WARNING = 1,
|
||||
FFX_API_MESSAGE_TYPE_COUNT
|
||||
};
|
||||
|
||||
typedef void (*ffxApiMessage)(uint32_t type, const wchar_t* message);
|
||||
|
||||
#define FFX_API_CONFIGURE_DESC_TYPE_GLOBALDEBUG1 0x0000001u
|
||||
struct ffxConfigureDescGlobalDebug1
|
||||
{
|
||||
ffxConfigureDescHeader header;
|
||||
ffxApiMessage fpMessage;
|
||||
uint32_t debugLevel;
|
||||
};
|
||||
|
||||
#define FFX_API_CONFIGURE_DESC_TYPE_GLOBALDEBUG 7u
|
||||
struct ffxConfigureDescGlobalDebug
|
||||
{
|
||||
ffxConfigureDescHeader header;
|
||||
uint64_t effectId;
|
||||
ffxApiMessage fpMessage; ///< A pointer to a function that can receive messages from the runtime. May be null.
|
||||
uint32_t debugLevel;
|
||||
};
|
||||
|
||||
#define FFX_API_QUERY_DESC_TYPE_GET_VERSIONS 4u
|
||||
struct ffxQueryDescGetVersions
|
||||
{
|
||||
ffxQueryDescHeader header;
|
||||
uint64_t createDescType; ///< Create description for the effect whose versions should be enumerated.
|
||||
void* device; ///< For DX12: pointer to ID3D12Device.
|
||||
uint64_t *outputCount; ///< Input capacity of id and name arrays. Output number of returned versions. If initially zero, output is number of available versions.
|
||||
uint64_t *versionIds; ///< Output array of version ids to be used as version overrides. If null, only names and count are returned.
|
||||
const char** versionNames; ///< Output array of version names for display. If null, only ids and count are returned. If both this and versionIds are null, only count is returned.
|
||||
};
|
||||
|
||||
#define FFX_API_DESC_TYPE_OVERRIDE_VERSION 5u
|
||||
struct ffxOverrideVersion
|
||||
{
|
||||
ffxApiHeader header;
|
||||
uint64_t versionId; ///< Id of version to use. Must be a value returned from a query in ffxQueryDescGetVersions.versionIds array.
|
||||
};
|
||||
|
||||
#define FFX_API_QUERY_DESC_TYPE_GET_PROVIDER_VERSION 6u
|
||||
struct ffxQueryGetProviderVersion
|
||||
{
|
||||
ffxQueryDescHeader header;
|
||||
uint64_t versionId; ///< Id of provider being used for queried context. 0 if invalid.
|
||||
const char* versionName; ///< Version name for display. If nullptr, the query was invalid.
|
||||
};
|
||||
|
||||
// Memory allocation function. Must return a valid pointer to at least size bytes of memory aligned to hold any type.
|
||||
// May return null to indicate failure. Standard library malloc fulfills this requirement.
|
||||
typedef void* (*ffxAlloc)(void* pUserData, uint64_t size);
|
||||
|
||||
// Memory deallocation function. May be called with null pointer as second argument.
|
||||
typedef void (*ffxDealloc)(void* pUserData, void* pMem);
|
||||
|
||||
typedef struct ffxAllocationCallbacks
|
||||
{
|
||||
void* pUserData;
|
||||
ffxAlloc alloc;
|
||||
ffxDealloc dealloc;
|
||||
} ffxAllocationCallbacks;
|
||||
|
||||
// Creates a FFX object context.
|
||||
// Depending on the desc structures provided to this function, the context will be created with the desired version and attributes.
|
||||
// Non-zero return indicates error code.
|
||||
// Pointers passed in desc must remain live until ffxDestroyContext is called on the context.
|
||||
// MemCb may be null; the system allocator (malloc/free) will be used in this case.
|
||||
FFX_API_ENTRY ffxReturnCode_t ffxCreateContext(ffxContext* context, ffxCreateContextDescHeader* desc, const ffxAllocationCallbacks* memCb);
|
||||
typedef ffxReturnCode_t (*PfnFfxCreateContext)(ffxContext* context, ffxCreateContextDescHeader* desc, const ffxAllocationCallbacks* memCb);
|
||||
|
||||
// Destroys an FFX object context.
|
||||
// Non-zero return indicates error code.
|
||||
// MemCb must be compatible with the callbacks passed into ffxCreateContext.
|
||||
FFX_API_ENTRY ffxReturnCode_t ffxDestroyContext(ffxContext* context, const ffxAllocationCallbacks* memCb);
|
||||
typedef ffxReturnCode_t (*PfnFfxDestroyContext)(ffxContext* context, const ffxAllocationCallbacks* memCb);
|
||||
|
||||
// Configures the provided FFX object context.
|
||||
// If context is null, configure operates on any global state.
|
||||
// Non-zero return indicates error code.
|
||||
FFX_API_ENTRY ffxReturnCode_t ffxConfigure(ffxContext* context, const ffxConfigureDescHeader* desc);
|
||||
typedef ffxReturnCode_t (*PfnFfxConfigure)(ffxContext* context, const ffxConfigureDescHeader* desc);
|
||||
|
||||
// Queries the provided FFX object context.
|
||||
// If context is null, query operates on any global state.
|
||||
// Non-zero return indicates error code.
|
||||
FFX_API_ENTRY ffxReturnCode_t ffxQuery(ffxContext* context, ffxQueryDescHeader* desc);
|
||||
typedef ffxReturnCode_t (*PfnFfxQuery)(ffxContext* context, ffxQueryDescHeader* desc);
|
||||
|
||||
// Dispatches work on the given FFX object context defined by the dispatch descriptor.
|
||||
// Non-zero return indicates error code.
|
||||
FFX_API_ENTRY ffxReturnCode_t ffxDispatch(ffxContext* context, const ffxDispatchDescHeader* desc);
|
||||
typedef ffxReturnCode_t (*PfnFfxDispatch)(ffxContext* context, const ffxDispatchDescHeader* desc);
|
||||
|
||||
// FFX_API_EFFECT_IDs
|
||||
#define FFX_API_EFFECT_ID_UPSCALE 0x00010000u
|
||||
#define FFX_API_EFFECT_ID_FRAMEGENERATION 0x00020000u
|
||||
#define FFX_API_EFFECT_ID_FRAMEGENERATIONSWAPCHAIN 0x00030000u
|
||||
// Need to keep this ID around for the deprecated VK frame gen swapchain
|
||||
#define FFX_API_EFFECT_ID_FRAMEGENERATIONSWAPCHAIN_VK 0x00040000u
|
||||
// Need to keep this ID around for the deprecated VK frame gen swapchain
|
||||
#define FFX_API_EFFECT_ID_DENOISER 0x00050000u
|
||||
#define FFX_API_EFFECT_ID_RADIANCECACHE 0x00060000u
|
||||
|
||||
#define FFX_API_MAKE_EFFECT_SUB_ID(effectId, subversion) ((effectId & FFX_API_EFFECT_MASK) | (subversion & ~FFX_API_EFFECT_MASK))
|
||||
|
||||
// FFX_APID_BACKEND_IDs
|
||||
#define FFX_API_BACKEND_ID_DX12 0x00000000u
|
||||
#define FFX_API_BACKEND_ID_XBOX 0x01000000u
|
||||
#define FFX_API_BACKEND_ID_VK 0x02000000u // For new effects going forward, please use this backend ID for vulkan specifics
|
||||
|
||||
#define FFX_API_MAKE_BACKEND_SUB_ID(backendId, subversion) ((backendId & FFX_API_BACKEND_MASK) | (subversion & ~FFX_API_BACKEND_MASK))
|
||||
|
||||
// Combiner for BACKEND-specific EFFECT sub-Ids
|
||||
#define FFX_API_MAKE_BACKEND_EFFECT_SUB_ID(backendId, effectId, subversion) ((subversion & ~FFX_API_EFFECT_MASK) | (effectId & FFX_API_EFFECT_MASK) | (backendId & FFX_API_BACKEND_MASK) | (subversion & ~(FFX_API_BACKEND_MASK | FFX_API_EFFECT_MASK)))
|
||||
|
||||
// Pragma macros for controlling warnings so that deprecations take affect externally but can be suppressed internally.
|
||||
// This is so we can maintain the API/ABI until we are ready to make the breaking change.
|
||||
// These are sadly compiler specific.
|
||||
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
#define FFX_PRAGMA_WARNING_PUSH warning( push )
|
||||
#define FFX_PRAGMA_WARNING_POP warning( pop )
|
||||
#define FFX_PRAGMA_WARNING_DISABLE_DEPRECATIONS warning( disable: 4996 )
|
||||
#define FFX_PRAGMA_WARNING_WARN_DEPRECATIONS warning( default: 4996 )
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
#define FFX_PRAGMA_WARNING_PUSH GCC diagnostic push
|
||||
#define FFX_PRAGMA_WARNING_POP GCC diagnostic pop
|
||||
#define FFX_PRAGMA_WARNING_DISABLE_DEPRECATIONS GCC diagnostic ignored "-Wdeprecated"
|
||||
#define FFX_PRAGMA_WARNING_WARN_DEPRECATIONS GCC diagnostic warning "-Wdeprecated"
|
||||
#else
|
||||
#define FFX_PRAGMA_WARNING_PUSH
|
||||
#define FFX_PRAGMA_WARNING_POP
|
||||
#define FFX_PRAGMA_WARNING_DISABLE_DEPRECATIONS
|
||||
#endif
|
||||
|
||||
#define FFX_DEPRECATION(message) [[deprecated(message)]]
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (C) 2026 Advanced Micro Devices, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files(the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions :
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/// An enumeration of surface formats. Needs to match enum FfxApiSurfaceFormat
|
||||
enum FfxApiSurfaceFormat
|
||||
{
|
||||
FFX_API_SURFACE_FORMAT_UNKNOWN, ///< Unknown format
|
||||
FFX_API_SURFACE_FORMAT_R32G32B32A32_TYPELESS, ///< 32 bit per channel, 4 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R32G32B32A32_UINT, ///< 32 bit per channel, 4 channel uint format
|
||||
FFX_API_SURFACE_FORMAT_R32G32B32A32_FLOAT, ///< 32 bit per channel, 4 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R16G16B16A16_FLOAT, ///< 16 bit per channel, 4 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R32G32B32_FLOAT, ///< 32 bit per channel, 3 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R32G32_FLOAT, ///< 32 bit per channel, 2 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R8_UINT, ///< 8 bit per channel, 1 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R32_UINT, ///< 32 bit per channel, 1 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R8G8B8A8_TYPELESS, ///< 8 bit per channel, 4 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R8G8B8A8_UNORM, ///< 8 bit per channel, 4 channel unsigned normalized format
|
||||
FFX_API_SURFACE_FORMAT_R8G8B8A8_SNORM, ///< 8 bit per channel, 4 channel signed normalized format
|
||||
FFX_API_SURFACE_FORMAT_R8G8B8A8_SRGB, ///< 8 bit per channel, 4 channel srgb normalized
|
||||
FFX_API_SURFACE_FORMAT_B8G8R8A8_TYPELESS, ///< 8 bit per channel, 4 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_B8G8R8A8_UNORM, ///< 8 bit per channel, 4 channel unsigned normalized format
|
||||
FFX_API_SURFACE_FORMAT_B8G8R8A8_SRGB, ///< 8 bit per channel, 4 channel srgb normalized
|
||||
FFX_API_SURFACE_FORMAT_R11G11B10_FLOAT, ///< 32 bit 3 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R10G10B10A2_UNORM, ///< 10 bit per 3 channel, 2 bit for 1 channel normalized format
|
||||
FFX_API_SURFACE_FORMAT_R16G16_FLOAT, ///< 16 bit per channel, 2 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R16G16_UINT, ///< 16 bit per channel, 2 channel unsigned int format
|
||||
FFX_API_SURFACE_FORMAT_R16G16_SINT, ///< 16 bit per channel, 2 channel signed int format
|
||||
FFX_API_SURFACE_FORMAT_R16_FLOAT, ///< 16 bit per channel, 1 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R16_UINT, ///< 16 bit per channel, 1 channel unsigned int format
|
||||
FFX_API_SURFACE_FORMAT_R16_UNORM, ///< 16 bit per channel, 1 channel unsigned normalized format
|
||||
FFX_API_SURFACE_FORMAT_R16_SNORM, ///< 16 bit per channel, 1 channel signed normalized format
|
||||
FFX_API_SURFACE_FORMAT_R8_UNORM, ///< 8 bit per channel, 1 channel unsigned normalized format
|
||||
FFX_API_SURFACE_FORMAT_R8G8_UNORM, ///< 8 bit per channel, 2 channel unsigned normalized format
|
||||
FFX_API_SURFACE_FORMAT_R8G8_UINT, ///< 8 bit per channel, 2 channel unsigned integer format
|
||||
FFX_API_SURFACE_FORMAT_R32_FLOAT, ///< 32 bit per channel, 1 channel float format
|
||||
FFX_API_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP, ///< 9 bit per channel, 5 bit exponent format
|
||||
|
||||
FFX_API_SURFACE_FORMAT_R16G16B16A16_TYPELESS, ///< 16 bit per channel, 4 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R32G32_TYPELESS, ///< 32 bit per channel, 2 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R10G10B10A2_TYPELESS, ///< 10 bit per 3 channel, 2 bit for 1 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R16G16_TYPELESS, ///< 16 bit per channel, 2 channel typless format
|
||||
FFX_API_SURFACE_FORMAT_R16_TYPELESS, ///< 16 bit per channel, 1 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R8_TYPELESS, ///< 8 bit per channel, 1 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R8G8_TYPELESS, ///< 8 bit per channel, 2 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R32_TYPELESS, ///< 32 bit per channel, 1 channel typeless format
|
||||
FFX_API_SURFACE_FORMAT_R32G32_UINT, ///< 32 bit per channel, 2 channel uint format
|
||||
|
||||
FFX_API_SURFACE_FORMAT_R8_SNORM, ///< 8 bit per channel, 1 channel signed normalized format
|
||||
};
|
||||
|
||||
/// An enumeration of resource usage.
|
||||
enum FfxApiResourceUsage
|
||||
{
|
||||
FFX_API_RESOURCE_USAGE_READ_ONLY = 0, ///< No usage flags indicate a resource is read only.
|
||||
FFX_API_RESOURCE_USAGE_RENDERTARGET = (1<<0), ///< Indicates a resource will be used as render target.
|
||||
FFX_API_RESOURCE_USAGE_UAV = (1<<1), ///< Indicates a resource will be used as UAV.
|
||||
FFX_API_RESOURCE_USAGE_DEPTHTARGET = (1<<2), ///< Indicates a resource will be used as depth target.
|
||||
FFX_API_RESOURCE_USAGE_INDIRECT = (1<<3), ///< Indicates a resource will be used as indirect argument buffer
|
||||
FFX_API_RESOURCE_USAGE_ARRAYVIEW = (1<<4), ///< Indicates a resource that will generate array views. Works on 2D and cubemap textures
|
||||
FFX_API_RESOURCE_USAGE_STENCILTARGET = (1<<5), ///< Indicates a resource will be used as stencil target.
|
||||
|
||||
FFX_API_RESOURCE_USAGE_DCC_RENDERTARGET = (1<<15), ///< Indicates a resource that should specify optimal render target memory access flags (for console use)
|
||||
};
|
||||
|
||||
|
||||
/// An enumeration of resource states.
|
||||
enum FfxApiResourceState
|
||||
{
|
||||
FFX_API_RESOURCE_STATE_COMMON = (1 << 0),
|
||||
FFX_API_RESOURCE_STATE_UNORDERED_ACCESS = (1 << 1), ///< Indicates a resource is in the state to be used as UAV.
|
||||
FFX_API_RESOURCE_STATE_COMPUTE_READ = (1 << 2), ///< Indicates a resource is in the state to be read by compute shaders.
|
||||
FFX_API_RESOURCE_STATE_PIXEL_READ = (1 << 3), ///< Indicates a resource is in the state to be read by pixel shaders.
|
||||
FFX_API_RESOURCE_STATE_PIXEL_COMPUTE_READ = (FFX_API_RESOURCE_STATE_PIXEL_READ | FFX_API_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in the state to be read by pixel or compute shaders.
|
||||
FFX_API_RESOURCE_STATE_COPY_SRC = (1 << 4), ///< Indicates a resource is in the state to be used as source in a copy command.
|
||||
FFX_API_RESOURCE_STATE_COPY_DEST = (1 << 5), ///< Indicates a resource is in the state to be used as destination in a copy command.
|
||||
FFX_API_RESOURCE_STATE_GENERIC_READ = (FFX_API_RESOURCE_STATE_COPY_SRC | FFX_API_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in generic (slow) read state.
|
||||
FFX_API_RESOURCE_STATE_INDIRECT_ARGUMENT = (1 << 6), ///< Indicates a resource is in the state to be used as an indirect command argument
|
||||
FFX_API_RESOURCE_STATE_PRESENT = (1 << 7), ///< Indicates a resource is in the state to be used to present to the swap chain
|
||||
FFX_API_RESOURCE_STATE_RENDER_TARGET = (1 << 8), ///< Indicates a resource is in the state to be used as render target
|
||||
FFX_API_RESOURCE_STATE_DEPTH_ATTACHMENT = (1 << 9), ///< Indicates a resource is in the state to be used as depth attachment
|
||||
};
|
||||
|
||||
/// An enumeration of surface dimensions.
|
||||
enum FfxApiResourceDimension
|
||||
{
|
||||
FFX_API_RESOURCE_DIMENSION_TEXTURE_1D, ///< A resource with a single dimension.
|
||||
FFX_API_RESOURCE_DIMENSION_TEXTURE_2D, ///< A resource with two dimensions.
|
||||
};
|
||||
|
||||
/// An enumeration of resource flags.
|
||||
enum FfxApiResourceFlags
|
||||
{
|
||||
FFX_API_RESOURCE_FLAGS_NONE = 0, ///< No flags.
|
||||
FFX_API_RESOURCE_FLAGS_ALIASABLE = (1 << 0), ///< A bit indicating a resource does not need to persist across frames.
|
||||
FFX_API_RESOURCE_FLAGS_UNDEFINED = (1 << 1), ///< Special case flag used internally when importing resources that require additional setup
|
||||
};
|
||||
|
||||
// An enumeration for different resource types
|
||||
enum FfxApiResourceType
|
||||
{
|
||||
FFX_API_RESOURCE_TYPE_BUFFER, ///< The resource is a buffer.
|
||||
FFX_API_RESOURCE_TYPE_TEXTURE1D, ///< The resource is a 1-dimensional texture.
|
||||
FFX_API_RESOURCE_TYPE_TEXTURE2D, ///< The resource is a 2-dimensional texture.
|
||||
FFX_API_RESOURCE_TYPE_TEXTURE_CUBE, ///< The resource is a cube map.
|
||||
FFX_API_RESOURCE_TYPE_TEXTURE3D, ///< The resource is a 3-dimensional texture.
|
||||
};
|
||||
|
||||
enum FfxApiBackbufferTransferFunction
|
||||
{
|
||||
FFX_API_BACKBUFFER_TRANSFER_FUNCTION_SRGB,
|
||||
FFX_API_BACKBUFFER_TRANSFER_FUNCTION_PQ,
|
||||
FFX_API_BACKBUFFER_TRANSFER_FUNCTION_SCRGB
|
||||
};
|
||||
|
||||
/// A structure encapsulating a 2-dimensional point, using 32bit unsigned integers.
|
||||
struct FfxApiDimensions2D
|
||||
{
|
||||
uint32_t width; ///< The width of a 2-dimensional range.
|
||||
uint32_t height; ///< The height of a 2-dimensional range.
|
||||
};
|
||||
|
||||
/// A structure encapsulating a 2-dimensional set of floating point coordinates.
|
||||
struct FfxApiFloatCoords2D
|
||||
{
|
||||
float x; ///< The x coordinate of a 2-dimensional point.
|
||||
float y; ///< The y coordinate of a 2-dimensional point.
|
||||
};
|
||||
|
||||
/// A structure encapsulating a 3-dimensional set of floating point coordinates.
|
||||
struct FfxApiFloatCoords3D
|
||||
{
|
||||
float x; ///< The x coordinate of a 3-dimensional point.
|
||||
float y; ///< The y coordinate of a 3-dimensional point.
|
||||
float z; ///< The z coordinate of a 3-dimensional point.
|
||||
};
|
||||
|
||||
/// A structure encapsulating a 2-dimensional rect.
|
||||
struct FfxApiRect2D
|
||||
{
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
};
|
||||
|
||||
/// A structure describing a resource.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
struct FfxApiResourceDescription
|
||||
{
|
||||
uint32_t type; ///< The type of the resource.
|
||||
uint32_t format; ///< The surface format.
|
||||
union {
|
||||
uint32_t width; ///< The width of the texture resource.
|
||||
uint32_t size; ///< The size of the buffer resource.
|
||||
};
|
||||
|
||||
union {
|
||||
uint32_t height; ///< The height of the texture resource.
|
||||
uint32_t stride; ///< The stride of the buffer resource.
|
||||
};
|
||||
|
||||
union {
|
||||
uint32_t depth; ///< The depth of the texture resource.
|
||||
uint32_t alignment; ///< The alignment of the buffer resource.
|
||||
};
|
||||
|
||||
uint32_t mipCount; ///< Number of mips (or 0 for full mipchain).
|
||||
uint32_t flags; ///< A set of resource flags.
|
||||
uint32_t usage; ///< Resource usage flags.
|
||||
};
|
||||
|
||||
#define FFX_RESOURCE_NAME_SIZE 64
|
||||
|
||||
struct FfxApiResource
|
||||
{
|
||||
void* resource;
|
||||
struct FfxApiResourceDescription description;
|
||||
uint32_t state;
|
||||
};
|
||||
|
||||
//struct definition matches FfxApiEffectMemoryUsage
|
||||
typedef struct FfxApiEffectMemoryUsage
|
||||
{
|
||||
uint64_t totalUsageInBytes;
|
||||
uint64_t aliasableUsageInBytes;
|
||||
} FfxApiEffectMemoryUsage;
|
||||
|
||||
/// A structure describing a constant buffer allocation.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxApiConstantBufferAllocation
|
||||
{
|
||||
struct FfxApiResource resource; ///< The resource representing the constant buffer resource.
|
||||
uint64_t handle; ///< The binding handle for the constant buffer
|
||||
|
||||
} FfxApiConstantBufferAllocation;
|
||||
|
||||
/// A function definition for a constant buffer allocation callback
|
||||
/// Used to provide a constant buffer allocator to the calling backend
|
||||
///
|
||||
/// @param [in] data The constant buffer data.
|
||||
/// @param [in] dataSize The size of the constant buffer data.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef FfxApiConstantBufferAllocation(*FfxApiConstantBufferAllocator)(void* data, const uint64_t dataSize);
|
||||
|
||||
/// A 4-component floating point vector
|
||||
typedef struct FfxApiFloat4
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} FfxApiFloat4;
|
||||
|
||||
/// A 4x4 matrix in row-major layout with row-vector convention.
|
||||
/// This is the canonical format expected by FFX APIs.
|
||||
///
|
||||
/// Memory layout: rows[row_index][column_index]
|
||||
/// Mathematical convention: v * M (row vector multiplied by matrix)
|
||||
typedef struct FfxApiMatrix4x4
|
||||
{
|
||||
FfxApiFloat4 rows[4]; ///< Four rows of the matrix. Access as rows[row].x, rows[row].y etc.
|
||||
} FfxApiMatrix4x4;
|
||||
|
||||
/// An inclusive floating-point interval [min, max].
|
||||
/// Valid instances must satisfy min <= max.
|
||||
typedef struct FfxApiFloatBounds
|
||||
{
|
||||
float min; ///< Lower bound of the interval.
|
||||
float max; ///< Upper bound of the interval.
|
||||
} FfxApiFloatBounds;
|
||||
@@ -0,0 +1,584 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (C) 2026 Advanced Micro Devices, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files(the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions :
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Includes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// FFX_API_EFFECT_ID_DENOISER
|
||||
// FFX_API_MAKE_EFFECT_SUB_ID
|
||||
// ffxConfigureDescHeader
|
||||
// ffxCreateContextDescHeader
|
||||
// ffxDispatchDescHeader
|
||||
// ffxQueryDescHeader
|
||||
#include "../../api/include/ffx_api.h"
|
||||
// FfxApiDimensions2D
|
||||
// FfxApiFloatBounds
|
||||
// FfxApiFloatCoords2D
|
||||
// FfxApiFloatCoords3D
|
||||
// FfxApiMatrix4x4
|
||||
// FfxApiResource
|
||||
#include "../../api/include/ffx_api_types.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// External Includes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// uint32_t
|
||||
// uint64_t
|
||||
#include <stdint.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// Denoiser major version number
|
||||
#define FFX_DENOISER_VERSION_MAJOR 1
|
||||
/// Denoiser minor version number
|
||||
#define FFX_DENOISER_VERSION_MINOR 2
|
||||
/// Denoiser pinor version number
|
||||
#define FFX_DENOISER_VERSION_PATCH 0
|
||||
|
||||
#define FFX_DENOISER_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch))
|
||||
/// Denoiser combined version number
|
||||
#define FFX_DENOISER_VERSION FFX_DENOISER_MAKE_VERSION(FFX_DENOISER_VERSION_MAJOR, FFX_DENOISER_VERSION_MINOR, FFX_DENOISER_VERSION_PATCH)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Declarations
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Descriptions: Create Context
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FFX_API_CREATE_CONTEXT_DESC_TYPE_DENOISER FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x01)
|
||||
/// Denoiser description for context creation.
|
||||
typedef struct ffxCreateContextDescDenoiser
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_CREATE_CONTEXT_DESC_TYPE_DENOISER
|
||||
ffxCreateContextDescHeader header;
|
||||
|
||||
/// The version of the API the application was built against.
|
||||
/// Must be set to @c FFX_DENOISER_VERSION.
|
||||
uint32_t version;
|
||||
|
||||
/// Maximum size that rendering will be performed at.
|
||||
struct FfxApiDimensions2D maxRenderSize;
|
||||
|
||||
/// Signal flags corresponding to a combination of values from @c FfxApiDenoiserSignalFlags.
|
||||
uint32_t signalFlags;
|
||||
|
||||
/// Signal flags corresponding to a combination of values from @c FfxApiDenoiserSignalFlags
|
||||
/// for signals that use checkerboard reconstruction.
|
||||
/// Must be a subset of @c signalFlags.
|
||||
uint32_t checkerboardSignalFlags;
|
||||
|
||||
/// Create flags corresponding to zero or a combination of values from @c FfxApiCreateContextDenoiserFlags.
|
||||
uint32_t flags;
|
||||
} ffxCreateContextDescDenoiser;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Descriptions: Configure
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FFX_API_CONFIGURE_DESC_TYPE_DENOISER_KEYVALUE FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x21)
|
||||
/// Denoiser description for configuring.
|
||||
/// @pre Required to be passed to @c ffxConfigure with a non-nullptr denoiser @c FfxContext*.
|
||||
typedef struct ffxConfigureDescDenoiserKeyValue
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_CONFIGURE_DESC_TYPE_DENOISER_KEYVALUE
|
||||
ffxConfigureDescHeader header;
|
||||
|
||||
/// Configuration key corresponding to an entry of @c FfxApiConfigureDenoiserKey.
|
||||
uint64_t key;
|
||||
|
||||
/// The number of elements to configure.
|
||||
uint64_t count;
|
||||
|
||||
/// Pointer to an array with the configuration values for the elements to configure.
|
||||
const void* data;
|
||||
} ffxConfigureDescDenoiserKeyValue;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Descriptions: Dispatch
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct FfxApiDenoiserSignal
|
||||
{
|
||||
/// Input signal to be denoised.
|
||||
struct FfxApiResource input;
|
||||
|
||||
/// Resulting denoised signal.
|
||||
struct FfxApiResource output;
|
||||
|
||||
/// @brief The X-coordinate of the first traced pixel at Y=0 in a checkerboard pattern.
|
||||
///
|
||||
/// In a checkerboard pattern, only half the pixels are traced per frame, alternating as follows:
|
||||
///
|
||||
/// @code
|
||||
/// x=0 x=1 x=2 x=3
|
||||
/// y=0: 0 1 0 1
|
||||
/// y=1: 1 0 1 0
|
||||
/// y=2: 0 1 0 1
|
||||
/// @endcode
|
||||
///
|
||||
/// * @c 0: pixel (0, 0) was traced.
|
||||
/// * @c 1: pixel (1, 0) was traced.
|
||||
///
|
||||
/// @code checkerboardOrigin = frameIndex & 1 @endcode
|
||||
///
|
||||
/// @pre Must be zero-initialized if this signal is not set in @c checkerboardSignalFlags.
|
||||
/// @pre Only meaningful if this signal is set in @c checkerboardSignalFlags.
|
||||
uint32_t checkerboardOrigin;
|
||||
} FfxApiDenoiserSignal;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x41)
|
||||
/// Denoiser description for dispatching.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Always required to be passed to @c ffxDispatch.
|
||||
typedef struct ffxDispatchDescDenoiser
|
||||
{
|
||||
/// Header description
|
||||
///
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// A pointer to the command list.
|
||||
///
|
||||
/// * DX12: pointer to ID3D12GraphicsCommandList.
|
||||
void* commandList;
|
||||
|
||||
/// @brief The signed linear depth.
|
||||
///
|
||||
/// Channels:
|
||||
/// * R: Signed linear depth values for the current frame. @code CurrentLinearDepth @endcode
|
||||
struct FfxApiResource linearDepth;
|
||||
|
||||
/// @brief The motion vectors.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RG: 2D motion vectors. @code PreviousUV - CurrentUV @endcode
|
||||
/// * B: Signed linear depth delta. @code PreviousLinearDepth - CurrentLinearDepth @endcode
|
||||
struct FfxApiResource motionVectors;
|
||||
|
||||
/// @brief The normals, roughness and material type.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RG: Octahedrally encoded normals
|
||||
/// * B: Linear Roughness
|
||||
/// * A: Material Type - See docs for more info,
|
||||
struct FfxApiResource normals;
|
||||
|
||||
/// @brief The specular albedo.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RGB: Specular albedo - sqrt encoding assumed unless @c FFX_DENOISER_DISPATCH_NON_GAMMA_ALBEDO is provided. @code sqrt(SpecularAlbedo) @endcode
|
||||
/// @pre Can be zero-initialized if and only if @c FFX_DENOISER_SIGNAL_DIRECT_SPECULAR, @c FFX_DENOISER_SIGNAL_INDIRECT_SPECULAR, and @c FFX_DENOISER_SIGNAL_DOMINANT_LIGHT_VISIBILITY are not set in the context creation signal flags.
|
||||
struct FfxApiResource specularAlbedo;
|
||||
|
||||
/// @brief The diffuse albedo.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RGB: Diffuse albedo (e.g., @code BaseColor * (1 - Metalness)) @endcode - sqrt encoding assumed unless @c FFX_DENOISER_DISPATCH_NON_GAMMA_ALBEDO is provided. @code sqrt(DiffuseAlbedo) @endcode
|
||||
/// @pre Can be zero-initialized if and only if @c FFX_DENOISER_SIGNAL_DIRECT_DIFFUSE, @c FFX_DENOISER_SIGNAL_INDIRECT_DIFFUSE, and @c FFX_DENOISER_SIGNAL_DOMINANT_LIGHT_VISIBILITY are not set in the context creation signal flags.
|
||||
struct FfxApiResource diffuseAlbedo;
|
||||
|
||||
/// @brief The motion vector scale factor.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RG: The scale factor for transforming the 2D motion vectors into UV space
|
||||
/// * For 2D motion vectors computed as @code PreviousUV - CurrentUV @endcode, use @code { .x = +1.0f, .y = +1.0f } @endcode.
|
||||
/// * For 2D motion vectors computed as @code PreviousNDC - CurrentNDC @endcode, use @code { .x = +0.5f, .y = -0.5f } @endcode.
|
||||
/// * B: The scale factor for transforming the signed linear depth delta
|
||||
/// * For linear depth deltas computed as @code PreviousLinearDepth - CurrentLinearDepth @endcode, use @code { .z = +1.0f } @endcode.
|
||||
struct FfxApiFloatCoords3D motionVectorScale;
|
||||
|
||||
/// The subpixel jitter offset applied to the camera projection. (Expressed in screen pixels)
|
||||
struct FfxApiFloatCoords2D jitterOffsets;
|
||||
|
||||
/// The position delta of the camera since last frame. @code PreviousPosition - CurrentPosition @endcode (Expressed in world space)
|
||||
struct FfxApiFloatCoords3D cameraPositionDelta;
|
||||
|
||||
/// @brief The world-to-view transformation matrix for the current frame.
|
||||
///
|
||||
/// Matrix convention:
|
||||
/// * Storage: row-major (rows stored contiguously in memory)
|
||||
/// * Multiplication: row vectors @code v' = vM @endcode
|
||||
///
|
||||
/// Compatibility:
|
||||
/// * Column-major with column vectors (e.g., OpenGL, Cauldron):
|
||||
/// direct copy (memcpy) - no transpose needed
|
||||
/// * Column-major with row vectors:
|
||||
/// requires transpose
|
||||
/// * Row-major with row vectors (e.g., DirectXMath):
|
||||
/// direct copy (memcpy)
|
||||
/// * Row-major with column vectors:
|
||||
/// requires transpose
|
||||
///
|
||||
/// Memory Layout Example (translation by (Tx, Ty, Tz)):
|
||||
/// [m00 m01 m02 m03] [1 0 0 0]
|
||||
/// [m10 m11 m12 m13] = [0 1 0 0]
|
||||
/// [m20 m21 m22 m23] [0 0 1 0]
|
||||
/// [m30 m31 m32 m33] [Tx Ty Tz 1]
|
||||
FfxApiMatrix4x4 view;
|
||||
|
||||
/// @brief The (unjittered) view-to-projection transformation matrix for the current frame.
|
||||
///
|
||||
/// Matrix convention:
|
||||
/// * Storage: row-major (rows stored contiguously in memory)
|
||||
/// * Multiplication: row vectors @code v' = vM @endcode
|
||||
///
|
||||
/// Compatibility:
|
||||
/// * Column-major with column vectors (e.g., OpenGL, Cauldron):
|
||||
/// direct copy (memcpy) - no transpose needed
|
||||
/// * Column-major with row vectors:
|
||||
/// requires transpose
|
||||
/// * Row-major with row vectors (e.g., DirectXMath):
|
||||
/// direct copy (memcpy)
|
||||
/// * Row-major with column vectors:
|
||||
/// requires transpose
|
||||
FfxApiMatrix4x4 projection;
|
||||
|
||||
/// @brief The absolute linear depth bounds considered for denoising.
|
||||
/// @post Passthrough is enabled for signal texels where the corresponding absolute linear depth values are outside [linearDepthBounds.min,linearDepthBounds.max].
|
||||
FfxApiFloatBounds linearDepthBounds;
|
||||
|
||||
/// The resolution that was used for rendering the input resources.
|
||||
struct FfxApiDimensions2D renderSize;
|
||||
|
||||
/// The index of the current frame.
|
||||
uint32_t frameIndex;
|
||||
|
||||
/// Dispatch flags corresponding to zero or a combination of values from @c FfxApiDispatchDenoiserFlags.
|
||||
uint32_t flags;
|
||||
} ffxDispatchDescDenoiser;
|
||||
|
||||
/// The maximum number of viewports that can be visualized.
|
||||
#define FFX_API_DENOISER_DEBUG_VIEW_MAX_VIEWPORTS 12
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_DEBUG_VIEW FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x42)
|
||||
/// Denoiser description for dispatching debug views.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Can be passed to @c ffxDispatch if and only if @c FFX_DENOISER_ENABLE_DEBUGGING is set in the context creation flags.
|
||||
typedef struct ffxDispatchDescDenoiserDebugView
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_DEBUG_VIEW
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// @brief The target output resource for debug visualization.
|
||||
///
|
||||
/// Channels:
|
||||
/// * RGB: Color information to display.
|
||||
/// * A: Indicates which pixels have been written to.
|
||||
struct FfxApiResource output;
|
||||
|
||||
/// The resolution of the debug visualization.
|
||||
struct FfxApiDimensions2D outputSize;
|
||||
|
||||
/// The debug view mode corresponding to an entry of @c FfxApiDenoiserDebugViewMode.
|
||||
uint32_t mode;
|
||||
|
||||
/// The index of the viewport to visualize when @c FFX_API_DENOISER_DEBUG_VIEW_MODE_FULLSCREEN_VIEWPORT mode is active.
|
||||
/// Clamped between 0 and @c FFX_API_DENOISER_DEBUG_VIEW_MAX_VIEWPORTS - 1.
|
||||
uint32_t viewportIndex;
|
||||
} ffxDispatchDescDenoiserDebugView;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_AMBIENT_OCCLUSION FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x43)
|
||||
/// Denoiser description for dispatching ambient occlusion signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_AMBIENT_OCCLUSION is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserAmbientOcclusion
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_AMBIENT_OCCLUSION
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * R:
|
||||
/// * @c input: Ambient occlusion (in [0,1] where 0 is fully occluded and 1 is fully exposed) to denoise
|
||||
/// * @c output: Denoised ambient occlusion (in [0,1] where 0 is fully occluded and 1 is fully exposed) (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserAmbientOcclusion;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_DIRECT_DIFFUSE FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x44)
|
||||
/// Denoiser description for dispatching direct diffuse signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_DIRECT_DIFFUSE is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserDirectDiffuse
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_DIRECT_DIFFUSE
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * RGB:
|
||||
/// * @c input: Direct diffuse radiance to denoise
|
||||
/// * @c output: Denoised direct diffuse radiance (or input if passthrough)
|
||||
/// * A:
|
||||
/// * @c input: Undefined
|
||||
/// * @c output: Preserved (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserDirectDiffuse;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_DIRECT_SPECULAR FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x45)
|
||||
/// Denoiser description for dispatching direct specular signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_DIRECT_SPECULAR is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserDirectSpecular
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_DIRECT_SPECULAR
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * RGB:
|
||||
/// * @c input: Direct specular radiance to denoise
|
||||
/// * @c output: Denoised direct specular radiance (or input if passthrough)
|
||||
/// * A:
|
||||
/// * @c input: Undefined
|
||||
/// * @c output: Preserved (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserDirectSpecular;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_DOMINANT_LIGHT FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x46)
|
||||
/// Denoiser description for dispatching dominant light visibility signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_DOMINANT_LIGHT_VISIBILITY is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserDominantLight
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_DOMINANT_LIGHT
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * R:
|
||||
/// * @c input: Dominant light visibility (ray hit distance [0,FP16_MAX] where FP16_MAX is fully exposed) to denoise
|
||||
/// * @c output: Denoised dominant light visibility (in [0,1] where 0 is fully occluded and 1 is fully exposed) (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
|
||||
/// Dominant light direction. (from light source to target)
|
||||
struct FfxApiFloatCoords3D direction;
|
||||
|
||||
/// Dominant light emission. (i.e. @c LightColor * LightIntensity)
|
||||
struct FfxApiFloatCoords3D emission;
|
||||
|
||||
/// Dominant light angular radius. (Expressed in radians)
|
||||
float angularRadius;
|
||||
} ffxDispatchDescDenoiserDominantLight;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_INDIRECT_DIFFUSE FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x47)
|
||||
/// Denoiser description for dispatching indirect diffuse signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_INDIRECT_DIFFUSE is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserIndirectDiffuse
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_INDIRECT_DIFFUSE
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * RGB:
|
||||
/// * @c input: Indirect diffuse radiance to denoise
|
||||
/// * @c output: Denoised indirect diffuse radiance (or input if passthrough)
|
||||
/// * A:
|
||||
/// * @c input: Indirect diffuse ray hit distance
|
||||
/// * @c output: Preserved (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserIndirectDiffuse;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_INDIRECT_SPECULAR FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x48)
|
||||
/// Denoiser description for dispatching of indirect specular signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_SIGNAL_INDIRECT_SPECULAR is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserIndirectSpecular
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_INDIRECT_SPECULAR
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * RGB:
|
||||
/// * @c input: Indirect specular radiance to denoise
|
||||
/// * @c output: Denoised indirect specular radiance (or input if passthrough)
|
||||
/// * A:
|
||||
/// * @c input: Indirect specular ray hit distance
|
||||
/// * @c output: Preserved (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserIndirectSpecular;
|
||||
|
||||
#define FFX_API_DISPATCH_DESC_TYPE_DENOISER_SPECULAR_OCCLUSION FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x49)
|
||||
/// Denoiser description for dispatching specular occlusion signals.
|
||||
/// @pre Required to be passed to @c ffxDispatch with a non-nullptr denoiser @c FfxContext*.
|
||||
/// @pre Required to be passed to @c ffxDispatch if and only if @c FFX_DENOISER_ENABLE_SPECULAR_OCCLUSION is set in the context creation signal flags.
|
||||
typedef struct ffxDispatchDescDenoiserSpecularOcclusion
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_DISPATCH_DESC_TYPE_DENOISER_SPECULAR_OCCLUSION
|
||||
ffxDispatchDescHeader header;
|
||||
|
||||
/// Channels:
|
||||
/// * R:
|
||||
/// * @c input: Specular occlusion (in [0,1], where 0 is fully occluded and 1 is fully exposed) to denoise
|
||||
/// * @c output: Denoised specular occlusion (in [0,1], where 0 is fully occluded and 1 is fully exposed) (or input if passthrough)
|
||||
struct FfxApiDenoiserSignal signal;
|
||||
} ffxDispatchDescDenoiserSpecularOcclusion;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Descriptions: Query
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FFX_API_QUERY_DESC_TYPE_DENOISER_GET_DEFAULT_KEYVALUE FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x81)
|
||||
/// Denoiser description for querying default configuration values.
|
||||
/// @pre Required to be passed to @c ffxQuery with a non-nullptr denoiser @c FfxContext*.
|
||||
typedef struct ffxQueryDescDenoiserGetDefaultKeyValue
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_QUERY_DESC_TYPE_DENOISER_GET_DEFAULT_KEYVALUE
|
||||
ffxQueryDescHeader header;
|
||||
|
||||
/// Configuration key corresponding to an entry of @c FfxApiConfigureDenoiserKey.
|
||||
uint64_t key;
|
||||
|
||||
/// The number of elements to query.
|
||||
uint64_t count;
|
||||
|
||||
/// Pointer to an array for storing the queried elements.
|
||||
void* data;
|
||||
} ffxQueryDescDenoiserGetDefaultKeyValue;
|
||||
|
||||
#define FFX_API_QUERY_DESC_TYPE_DENOISER_GPU_MEMORY_USAGE FFX_API_MAKE_EFFECT_SUB_ID(FFX_API_EFFECT_ID_DENOISER, 0x82)
|
||||
/// Denoiser description for querying GPU memory usage.
|
||||
/// @pre Can be passed to @c ffxQuery with a non-nullptr denoiser @c FfxContext* to retrieve the actual memory usage.
|
||||
/// @pre Can be passed to @c ffxQuery with a nullptr @c FfxContext* to retrieve the expected memory usage.
|
||||
typedef struct ffxQueryDescDenoiserGetGPUMemoryUsage
|
||||
{
|
||||
/// Header description
|
||||
/// * @c type: FFX_API_QUERY_DESC_TYPE_DENOISER_GPU_MEMORY_USAGE
|
||||
ffxQueryDescHeader header;
|
||||
|
||||
/// A pointer to the device.
|
||||
/// * DX12: pointer to ID3D12Device.
|
||||
void* device;
|
||||
|
||||
/// Maximum size that rendering will be performed at.
|
||||
struct FfxApiDimensions2D maxRenderSize;
|
||||
|
||||
/// Signal flags corresponding to a combination of values from @c FfxApiDenoiserSignalFlags.
|
||||
uint32_t signalFlags;
|
||||
|
||||
/// Signal flags corresponding to a combination of values from @c FfxApiDenoiserSignalFlags
|
||||
/// for signals that use checkerboard reconstruction.
|
||||
/// Must be a subset of @c signalFlags.
|
||||
uint32_t checkerboardSignalFlags;
|
||||
|
||||
/// Create flags corresponding to zero or a combination of values from @c FfxApiCreateContextDenoiserFlags.
|
||||
uint32_t flags;
|
||||
|
||||
/// A pointer to a @c FfxApiEffectMemoryUsage structure that will hold the GPU memory usage.
|
||||
struct FfxApiEffectMemoryUsage* gpuMemoryUsage;
|
||||
} ffxQueryDescDenoiserGetGPUMemoryUsage;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FFX Denoiser Enums
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef enum FfxApiCreateContextDenoiserFlags
|
||||
{
|
||||
/// Flag indicating that debug features may be enabled. Memory usage may increase.
|
||||
FFX_DENOISER_ENABLE_DEBUGGING = (1 << 0),
|
||||
/// Flag indicating that exhaustive validation should be enabled. Performance may decrease.
|
||||
FFX_DENOISER_ENABLE_VALIDATION = (1 << 1),
|
||||
} FfxApiCreateContextDenoiserFlags;
|
||||
|
||||
typedef enum FfxApiConfigureDenoiserKey
|
||||
{
|
||||
/// Override the strength of the cross bilateral normal term.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_CROSS_BILATERAL_NORMAL_STRENGTH = 1,
|
||||
/// Override the bias of the temporal accumulation to be more stable but less responsive.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_STABILITY_BIAS = 2,
|
||||
/// Override the maximum radiance value. A single float scalar.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_MAX_RADIANCE = 3,
|
||||
/// Override the standard deviation K value used for radiance clipping.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_RADIANCE_CLIP_STD_K = 4,
|
||||
/// Override the Gaussian kernel relaxation factor.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_GAUSSIAN_KERNEL_RELAXATION = 5,
|
||||
/// Override the discocclusion threshold used for depth comparisons during temporal reprojection.
|
||||
/// * Format: A single @c float.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_DISOCCLUSION_THRESHOLD = 6,
|
||||
/// Override the absolute linear depth bounds used for normalizing the absolute linear depth debug view.
|
||||
/// * Format: A single @c FfxApiFloatBounds.
|
||||
FFX_API_CONFIGURE_DENOISER_KEY_DEBUG_VIEW_LINEAR_DEPTH_BOUNDS = 7,
|
||||
} FfxApiConfigureDenoiserKey;
|
||||
|
||||
typedef enum FfxApiDenoiserDebugViewMode
|
||||
{
|
||||
/// Overview debug view mode.
|
||||
FFX_API_DENOISER_DEBUG_VIEW_MODE_OVERVIEW = 0,
|
||||
/// Fullscreen viewport debug view mode.
|
||||
FFX_API_DENOISER_DEBUG_VIEW_MODE_FULLSCREEN_VIEWPORT = 1,
|
||||
} FfxApiDenoiserDebugViewMode;
|
||||
|
||||
typedef enum FfxApiDenoiserSignalFlags
|
||||
{
|
||||
FFX_DENOISER_SIGNAL_NONE = 0,
|
||||
/// Flag indicating that ambient occlusion needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_AMBIENT_OCCLUSION = (1 << 0),
|
||||
/// Flag indicating that direct diffuse needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_DIRECT_DIFFUSE = (1 << 1),
|
||||
/// Flag indicating that direct specular needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_DIRECT_SPECULAR = (1 << 2),
|
||||
/// Flag indicating that dominant light visibility needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_DOMINANT_LIGHT_VISIBILITY = (1 << 3),
|
||||
/// Flag indicating that indirect diffuse needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_INDIRECT_DIFFUSE = (1 << 4),
|
||||
/// Flag indicating that indirect specular needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_INDIRECT_SPECULAR = (1 << 5),
|
||||
/// Flag indicating that specular occlusion needs to be denoised.
|
||||
FFX_DENOISER_SIGNAL_SPECULAR_OCCLUSION = (1 << 6),
|
||||
} FfxApiDenoiserSignalFlags;
|
||||
|
||||
typedef enum FfxApiDispatchDenoiserFlags
|
||||
{
|
||||
/// Flag indicating that the history accumulation needs to be reset.
|
||||
FFX_DENOISER_DISPATCH_RESET = (1 << 0),
|
||||
/// Flag indicating that the (diffuse and specular) albedo textures are not gamma encoded.
|
||||
FFX_DENOISER_DISPATCH_NON_GAMMA_ALBEDO = (1 << 1),
|
||||
} FfxApiDispatchDenoiserFlags;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
Reference in new issue
Block a user