Convert Figma logo to code with AI

GPUOpen-LibrariesAndSDKs logoFidelityFX-SDK

The main repository for the FidelityFX SDK.

1,068
106
1,068
101

Top Related Projects

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs

This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

Unity Graphics - Including Scriptable Render Pipeline

One stop solution for all Vulkan samples

Quick Overview

The FidelityFX-SDK is an open-source graphics development kit provided by AMD. It offers a collection of optimized visual technologies and effects for game developers to enhance image quality and performance in their projects. The SDK includes various techniques such as upscaling, super resolution, and ambient occlusion.

Pros

  • Provides high-quality, optimized graphics effects for game development
  • Open-source and freely available for developers
  • Cross-platform support for multiple graphics APIs (DirectX 12, Vulkan)
  • Regularly updated with new features and improvements

Cons

  • Primarily optimized for AMD GPUs, may not perform as well on other hardware
  • Requires some graphics programming knowledge to implement effectively
  • Documentation could be more comprehensive for some features
  • May have compatibility issues with certain game engines or rendering pipelines

Code Examples

  1. Initializing FidelityFX Super Resolution (FSR):
FfxFsr2Context context;
FfxFsr2ContextDescription contextDescription = {};
contextDescription.flags = FFX_FSR2_ENABLE_HIGH_DYNAMIC_RANGE;
contextDescription.maxRenderSize.width = 1920;
contextDescription.maxRenderSize.height = 1080;
contextDescription.displaySize.width = 3840;
contextDescription.displaySize.height = 2160;
ffxFsr2ContextCreate(&context, &contextDescription);
  1. Applying FidelityFX Contrast Adaptive Sharpening (CAS):
FfxCasContext context;
FfxCasContextDescription contextDescription = {};
contextDescription.flags = FFX_CAS_SHARPEN_ONLY;
contextDescription.inputWidth = 1920;
contextDescription.inputHeight = 1080;
ffxCasContextCreate(&context, &contextDescription);

FfxCasDispatchDescription dispatchDescription = {};
dispatchDescription.commandList = commandList;
dispatchDescription.inputTexture = inputResource;
dispatchDescription.outputTexture = outputResource;
dispatchDescription.sharpness = 0.5f;
ffxCasContextDispatch(&context, &dispatchDescription);
  1. Using FidelityFX Single Pass Downsampler (SPD):
FfxSpdContext context;
FfxSpdContextDescription contextDescription = {};
contextDescription.flags = FFX_SPD_WAVE_INTEROP_WAVE32;
contextDescription.windowSize = 5;
ffxSpdContextCreate(&context, &contextDescription);

FfxSpdDispatchDescription dispatchDescription = {};
dispatchDescription.commandList = commandList;
dispatchDescription.resource = inputResource;
dispatchDescription.resourceSize = {1920, 1080};
ffxSpdContextDispatch(&context, &dispatchDescription);

Getting Started

  1. Clone the FidelityFX-SDK repository:

    git clone https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK.git
    
  2. Include the necessary headers in your project:

    #include "ffx_fsr2.h"
    #include "ffx_cas.h"
    #include "ffx_spd.h"
    
  3. Link against the FidelityFX library in your build system.

  4. Initialize the desired FidelityFX effects in your rendering pipeline using the provided context creation and dispatch functions.

  5. Integrate the effects into your render loop, passing the appropriate resources and parameters.

Competitor Comparisons

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs

Pros of Compressonator

  • Compressonator provides a comprehensive set of tools for texture compression, including support for various compression formats like DXT, ETC, and ASTC.
  • The project offers a GUI-based application, making it easier for users to interact with the compression tools.
  • Compressonator includes a command-line interface, allowing for automated compression workflows and integration with other tools.

Cons of Compressonator

  • The FidelityFX SDK offers a more focused set of tools and libraries specifically designed for game development, while Compressonator covers a broader range of texture compression tasks.
  • The FidelityFX SDK may have better integration and compatibility with game engines and other game development tools compared to the more general-purpose Compressonator.
  • The documentation and community support for the FidelityFX SDK may be more extensive, as it is a dedicated game development-focused project.

Code Comparison

FidelityFX-SDK (sample from the FidelityFX-CAS module):

float FidelityFX_CAS(float3 color, float sharpness)
{
    float3 luma = float3(0.2126, 0.7152, 0.0722);
    float3 weights = float3(1.0, 1.0, 1.0) - abs(dot(color, luma) - color) * sharpness;
    return dot(color, weights) / dot(weights, float3(1.0, 1.0, 1.0));
}

Compressonator (sample from the CompressonatorCLI module):

void CompressTexture(
    CMP_Texture* pSourceTexture,
    CMP_Texture* pDestTexture,
    CMP_CompressOptions* pOptions,
    CMP_Feedback_Proc pFeedbackProc = NULL)
{
    CMP_ERROR result = CMP_Compress(pSourceTexture, pDestTexture, pOptions, pFeedbackProc);
    if (result != CMP_OK)
        throw std::runtime_error("Texture compression failed.");
}

This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

Pros of DirectX-Graphics-Samples

  • Comprehensive coverage of DirectX features and techniques
  • Official Microsoft samples, ensuring compatibility and best practices
  • Regular updates aligned with DirectX API changes

Cons of DirectX-Graphics-Samples

  • Focused solely on DirectX, limiting cross-platform applicability
  • May have a steeper learning curve for beginners compared to FidelityFX-SDK
  • Less emphasis on specific optimization techniques for different GPU architectures

Code Comparison

FidelityFX-SDK (HLSL shader example):

FFX_GROUPSHARED FfxFloat32x3 g_ffxSharedColor[16][16];
FFX_ATTRIBUTES void ComputeShader(FfxUInt32x3 LocalThreadId : SV_GroupThreadID)
{
    // FidelityFX-specific optimizations and computations
}

DirectX-Graphics-Samples (HLSL shader example):

groupshared float3 g_sharedColor[16][16];
[numthreads(16, 16, 1)]
void CSMain(uint3 DTid : SV_DispatchThreadID)
{
    // Standard DirectX computations
}

The FidelityFX-SDK code uses custom types and macros for potential cross-platform compatibility and optimizations, while DirectX-Graphics-Samples focuses on standard DirectX syntax and practices.

Unity Graphics - Including Scriptable Render Pipeline

Pros of Graphics

  • Integrated with Unity engine, providing seamless compatibility for Unity developers
  • Extensive documentation and community support through Unity's ecosystem
  • Covers a wide range of graphics features beyond just post-processing effects

Cons of Graphics

  • Primarily focused on Unity-specific implementations, limiting cross-platform flexibility
  • May have a steeper learning curve for developers not familiar with Unity's architecture
  • Potentially heavier resource footprint due to integration with the larger Unity framework

Code Comparison

FidelityFX-SDK:

FFX_CACAO_DispatchDescription dispatch = {};
dispatch.commandList = commandList;
dispatch.screenSize = { width, height };
FFX_CACAO_Dispatch(context, &dispatch);

Graphics:

[ImageEffectOpaque]
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    Graphics.Blit(source, destination, material);
}

The FidelityFX-SDK code shows a lower-level API for dispatching CACAO (Combined Adaptive Compute Ambient Occlusion) effects, while the Graphics example demonstrates Unity's high-level approach to post-processing using the built-in rendering pipeline.

One stop solution for all Vulkan samples

Pros of Vulkan-Samples

  • Comprehensive collection of Vulkan samples covering various aspects of the API
  • Regularly updated with new features and best practices
  • Cross-platform support for Windows, Linux, Android, and macOS (MoltenVK)

Cons of Vulkan-Samples

  • Focused solely on Vulkan, lacking support for other graphics APIs
  • May be overwhelming for beginners due to its extensive coverage

Code Comparison

Vulkan-Samples (Initialization):

VkInstanceCreateInfo instance_info = {};
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_info.pApplicationInfo = &app_info;
vkCreateInstance(&instance_info, nullptr, &instance);

FidelityFX-SDK (Effect Setup):

FfxFsr2ContextDescription contextDescription = {};
contextDescription.flags = FFX_FSR2_ENABLE_HIGH_DYNAMIC_RANGE;
contextDescription.maxRenderSize.width = backBufferWidth;
contextDescription.maxRenderSize.height = backBufferHeight;
ffxFsr2ContextCreate(&context, &contextDescription);

The Vulkan-Samples code focuses on low-level Vulkan setup, while FidelityFX-SDK provides higher-level abstractions for specific graphics effects. Vulkan-Samples is more suitable for learning Vulkan internals, whereas FidelityFX-SDK offers ready-to-use optimized graphics features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Welcome to the AMD FidelityFX™ SDK 1.1.3

alt text

The FidelityFX SDK is a collection of heavily optimized, open source technologies (shader and runtime code) that can be used by developers to improve their DirectX® 12 or Vulkan® applications.

The FidelityFX SDK includes:

FidelityFX SDK TechniqueSamplesGPUOpen pageDescription
Combined Adaptive Compute Ambient Occlusion (CACAO) 1.4CACAO sampleFidelityFX Ambient OcclusionUses intelligent and adaptive sampling techniques to produce excellent quality ambient occlusion at high performance.
Contrast Adaptive Sharpening (CAS) 1.2CAS sampleFidelityFX Contrast Adaptive SharpeningImplements a sharpening kernel that reclaims that high-frequency detail lost during rendering.
Denoiser 1.3n/aFidelityFX DenoiserProvides a set of denoising compute shaders which remove artifacts from reflection and shadow rendering. Useful for both raytraced or rasterized content.
Classifier 1.3n/an/aProvides a set of tile classification compute shaders which prepare tile metadata to drive indirect workload generation. It's useful for guided and load-balanced ray tracing applications, letting you leverage ray tracing in an efficient manner.
Luminance Preserving Mapper 1.4LPM sampleFidelityFX HDR MapperOffers a tone mapping and gamut mapping solution for HDR and wide gamut content.
Parallel Sort 1.3Parallel Sort sampleFidelityFX Parallel SortImplements GPU-accelerated parallel sorting techniques. The sorts are stable useful for sorting particles or other GPU-side data sets.
Single Pass Downsampler 2.2SPD sampleFidelityFX DownsamplerAllows you to downsample surfaces - and optionally generate a MIPmap chain - in a single compute dispatch.
Stochastic Screen-Space Reflections 1.5SSSR sampleFidelityFX Screen Space ReflectionsProvides high-fidelity screen-spaced reflections in your scene, without a hefty performance price tag.
Super Resolution (Spatial) 1.2Super Resolution sampleFidelityFX Super ResolutionOffers a spatial single-frame solution for producing higher resolution frames from lower resolution inputs.
Super Resolution (Temporal) 2.3.2Super Resolution sampleFidelityFX Super Resolution 2Offers both spatial single-frame and temporal multi-frame solutions for producing high resolution frames from lower resolution inputs.
Super Resolution 3 3.1.3Super Resolution sampleFidelityFX Super Resolution 3Offers generation of interpolated frames in combination with our temporal multi-frame solution for producing high resolution frames from lower resolution inputs.
Super Resolution (Upscaler) 3.1.3Super Resolution sampleFidelityFX Super Resolution 3Offers temporal multi-frame solutions for producing high resolution frames from lower resolution inputs.
Frame Interpolation 1.1.2Super Resolution sampleFidelityFX Super Resolution 3Offers generation of interpolated frames from multiple real input frames, and multiple sources of motion vector data.
Frame Interpolation SwapChain 1.1.2Super Resolution sampleFidelityFX Super Resolution 3A replacement DXGI Swapchain implementation for DX12 which allows for additional frames to be presented along with real game frames, with relevant frame pacing.
Optical Flow 1.1.2Super Resolution sampleFidelityFX Super Resolution 3Offers a motion-estimation algorithm which is useful for generating block-based motion vectors from temporal image inputs.
Variable Shading 1.2Variable Shading sampleFidelityFX Variable ShadingHelps you to drive Variable Rate Shading hardware introduced in RDNA2-based and contemporary GPUs, by analyzing the luminance of pixels in a tile to determine where the shading rate can be lowered to increase performance.
Blur 1.1Blur sampleFidelityFX BlurA library of highly optimized functions which perform common blurring operations such as Gaussian blur, radial blurs, and others.
Depth-of-Field 1.1DoF sampleFidelityFX Depth of FieldImplements a high-quality DOF filter complete with bokeh.
Lens 1.1Lens sampleFidelityFX LensImplements a library of optimized lens effects including chromatic aberration, film grain, and vignetting.
Classifier (Shadows) 1.3 Denoiser (Shadows) 1.2Hybrid Shadows sample 1.1FidelityFX Hybrid ShadowsAn implementation of an example shadowing technique which shows you how you could combine rasterized shadow maps and hardware ray tracing to deliver high quality soft shadows at a reasonable performance cost.
Classifier (Reflections) 1.3 Denoiser (Reflections) 1.2Hybrid Reflections sample 1.1FidelityFX Hybrid ReflectionsAn implementation of an an example reflections technique which shows you how you could mix FidelityFX SSSR with ray traced reflections, delivering higher quality reflections than SSSR alone at reasonable performance cost.
Breadcrumbs library 1.0Breadcrumbs sampleFidelityFX Breadcrumbs LibraryLibrary aiding with post-mortem GPU crash analysis.
Brixelizer 1.0Brixelizer GI sampleFidelityFX Brixelizer GIA compute-based, highly-optimized sparse distance fields technique.
Brixelizer GI 1.0Brixelizer GI sampleFidelityFX Brixelizer GIA compute-based, highly-optimized global illumination technique, built with Brixelizer.

Further information

Known issues

AMD FidelityFX SDK SampleAPI / ConfigurationProblem Description
FidelityFX CAS / FidelityFX SSSRDX12 / Release configurationWhen unchecking vsync option and losing window focus, some flickering can be observed on some GPUs.
FidelityFX CACAOVK / Release configuration"Unable to create swapchain" message can occur on select GPU manufacturers.
FidelityFX FSR APIVK / Release configurationUI flickering/disappearing may occur on some Intel Arc GPUs. Occasional hangs may also occur (change and regain Window focus to continue)
FidelityFX LensVulkan / All configurationsEnabling FP16 version on select Arc GPUs will cause device loss.
FidelityFX LPMVulkan / All configurationsWhen rapidly pressing alt-enter to go to full screen mode and back, the HDR display handle can occasionally become lost leading to a dim screen until another full screen toggle is applied again.
FidelityFX Hybrid Shadows / FidelityFX FSRVulkan / All configurationsDue to resource view handling in the native Vulkan backend, the ability to change the number of cascades on a directional light in Vulkan samples has been disabled to prevent sample instability.
FidelityFX DOFAll APIs / All ConfigsSome artifacts may occur on some Intel Arc GPUs.
All FidelityFX SDK SamplesAll APIs / All ConfigsThere is a resource leak in the UploadContext used to load glTF content.
All FidelityFX SDK SamplesAll APIs / All ConfigsWindows path length restrictions may cause compile issues. It is recommended to place the SDK close to the root of a drive or use subst or a mklink to shorten the path.
All FidelityFX SDK SamplesAll APIs / All ConfigsThere is a build error when using CMake 3.31 or newer

Open source

AMD FidelityFX SDK is open source, and available under the MIT license.

For more information on the license terms please refer to license.

Disclaimer

The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale.

AMD, the AMD Arrow logo, Radeon, Ryzen, CrossFire, RDNA and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.

DirectX is a registered trademark of Microsoft Corporation in the US and other jurisdictions.

Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.

OpenCL is a trademark of Apple Inc. used by permission by Khronos Group, Inc.

Microsoft is a registered trademark of Microsoft Corporation in the US and other jurisdictions.

Windows is a registered trademark of Microsoft Corporation in the US and other jurisdictions.

© 2022-2024 Advanced Micro Devices, Inc. All rights reserved.