From ae48e4d7a67d6215bf9afc02d59852bbf4aaded5 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 9 Mar 2026 05:00:51 -0700 Subject: [PATCH] Make FSR3 SDK integration Kits-only and align CI/docs --- .github/workflows/build.yml | 27 +++-------- CMakeLists.txt | 55 ++++++----------------- README.md | 2 +- docs/AMD_FSR2_INTEGRATION.md | 10 ++--- src/rendering/amd_fsr3_framegen_probe.cpp | 11 ----- src/rendering/amd_fsr3_runtime.cpp | 39 ---------------- 6 files changed, 26 insertions(+), 118 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65a56751..6893f717 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,30 +82,15 @@ jobs: echo "WoWee CMake will bootstrap vendored headers." fi - - name: Check FidelityFX-SDK Vulkan framegen files + - name: Check FidelityFX-SDK Kits framegen headers run: | set -euo pipefail - SDK_DIR="$PWD/extern/FidelityFX-SDK/sdk" KITS_DIR="$PWD/extern/FidelityFX-SDK/Kits/FidelityFX" - LEGACY_OK=0 - KITS_OK=0 - if [ -f "$SDK_DIR/include/FidelityFX/host/ffx_frameinterpolation.h" ]; then - LEGACY_OK=1 - fi - if [ -f "$KITS_DIR/framegeneration/include/ffx_framegeneration.h" ]; then - KITS_OK=1 - fi - - if [ "$LEGACY_OK" -eq 1 ] && [ -f "$SDK_DIR/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" ] \ - && [ -f "$SDK_DIR/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_glsl.h" ] \ - && [ -f "$SDK_DIR/src/backends/vk/CMakeShadersFrameinterpolation.txt" ] \ - && [ -f "$SDK_DIR/src/backends/vk/CMakeShadersOpticalflow.txt" ]; then - echo "FidelityFX-SDK legacy Vulkan framegen files detected." - elif [ "$KITS_OK" -eq 1 ]; then - echo "FidelityFX-SDK Kits layout detected (DX12-focused framegeneration APIs available)." - else - echo "FidelityFX-SDK Vulkan framegen files are missing in this checkout; build continues." - fi + test -f "$KITS_DIR/upscalers/fsr3/include/ffx_fsr3upscaler.h" + test -f "$KITS_DIR/framegeneration/fsr3/include/ffx_frameinterpolation.h" + test -f "$KITS_DIR/framegeneration/fsr3/include/ffx_opticalflow.h" + test -f "$KITS_DIR/backend/vk/ffx_vk.h" + echo "FidelityFX-SDK Kits framegen headers detected." - name: Configure (AMD ON) run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWOWEE_ENABLE_AMD_FSR2=ON diff --git a/CMakeLists.txt b/CMakeLists.txt index f9024689..718d657f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,22 +95,9 @@ else() endif() # AMD FidelityFX SDK (FSR3 frame generation interfaces) detection under extern/FidelityFX-SDK -set(WOWEE_AMD_FFX_SDK_DIR ${CMAKE_SOURCE_DIR}/extern/FidelityFX-SDK/sdk) set(WOWEE_AMD_FFX_SDK_KITS_DIR ${CMAKE_SOURCE_DIR}/extern/FidelityFX-SDK/Kits/FidelityFX) -set(WOWEE_AMD_FFX_SDK_FI_HEADER ${WOWEE_AMD_FFX_SDK_DIR}/include/FidelityFX/host/ffx_frameinterpolation.h) -set(WOWEE_AMD_FFX_SDK_OF_HEADER ${WOWEE_AMD_FFX_SDK_DIR}/include/FidelityFX/host/ffx_opticalflow.h) -set(WOWEE_AMD_FFX_SDK_FSR3_HEADER ${WOWEE_AMD_FFX_SDK_DIR}/include/FidelityFX/host/ffx_fsr3upscaler.h) -set(WOWEE_AMD_FFX_SDK_VK_HEADER ${WOWEE_AMD_FFX_SDK_DIR}/include/FidelityFX/host/backends/vk/ffx_vk.h) set(WOWEE_AMD_FFX_SDK_KITS_FG_HEADER ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/include/ffx_framegeneration.h) -set(WOWEE_AMD_FFX_SDK_LEGACY_READY FALSE) -if(EXISTS ${WOWEE_AMD_FFX_SDK_FI_HEADER} - AND EXISTS ${WOWEE_AMD_FFX_SDK_OF_HEADER} - AND EXISTS ${WOWEE_AMD_FFX_SDK_FSR3_HEADER} - AND EXISTS ${WOWEE_AMD_FFX_SDK_VK_HEADER}) - set(WOWEE_AMD_FFX_SDK_LEGACY_READY TRUE) -endif() - set(WOWEE_AMD_FFX_SDK_KITS_READY FALSE) if(EXISTS ${WOWEE_AMD_FFX_SDK_KITS_DIR}/upscalers/fsr3/include/ffx_fsr3upscaler.h AND EXISTS ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/fsr3/include/ffx_frameinterpolation.h @@ -119,14 +106,9 @@ if(EXISTS ${WOWEE_AMD_FFX_SDK_KITS_DIR}/upscalers/fsr3/include/ffx_fsr3upscaler. set(WOWEE_AMD_FFX_SDK_KITS_READY TRUE) endif() -if(WOWEE_ENABLE_AMD_FSR3_FRAMEGEN AND (WOWEE_AMD_FFX_SDK_LEGACY_READY OR WOWEE_AMD_FFX_SDK_KITS_READY)) - if(WOWEE_AMD_FFX_SDK_LEGACY_READY) - message(STATUS "AMD FidelityFX-SDK framegen headers detected at ${WOWEE_AMD_FFX_SDK_DIR} (legacy layout)") - add_compile_definitions(WOWEE_AMD_FFX_SDK_KITS=0) - else() - message(STATUS "AMD FidelityFX-SDK framegen headers detected at ${WOWEE_AMD_FFX_SDK_KITS_DIR} (Kits layout)") - add_compile_definitions(WOWEE_AMD_FFX_SDK_KITS=1) - endif() +if(WOWEE_ENABLE_AMD_FSR3_FRAMEGEN AND WOWEE_AMD_FFX_SDK_KITS_READY) + message(STATUS "AMD FidelityFX-SDK framegen headers detected at ${WOWEE_AMD_FFX_SDK_KITS_DIR} (Kits layout)") + add_compile_definitions(WOWEE_AMD_FFX_SDK_KITS=1) add_compile_definitions(WOWEE_HAS_AMD_FSR3_FRAMEGEN=1) add_library(wowee_fsr3_framegen_amd_vk_probe STATIC src/rendering/amd_fsr3_framegen_probe.cpp @@ -135,23 +117,17 @@ if(WOWEE_ENABLE_AMD_FSR3_FRAMEGEN AND (WOWEE_AMD_FFX_SDK_LEGACY_READY OR WOWEE_A CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON ) - if(WOWEE_AMD_FFX_SDK_LEGACY_READY) - target_include_directories(wowee_fsr3_framegen_amd_vk_probe PUBLIC - ${WOWEE_AMD_FFX_SDK_DIR}/include - ) - else() - target_include_directories(wowee_fsr3_framegen_amd_vk_probe PUBLIC - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/upscalers/fsr3/include - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/fsr3/include - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/include - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/backend/vk - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/api/internal - ${WOWEE_AMD_FFX_SDK_KITS_DIR}/api/include - ) - endif() + target_include_directories(wowee_fsr3_framegen_amd_vk_probe PUBLIC + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/upscalers/fsr3/include + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/fsr3/include + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/framegeneration/include + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/backend/vk + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/api/internal + ${WOWEE_AMD_FFX_SDK_KITS_DIR}/api/include + ) target_link_libraries(wowee_fsr3_framegen_amd_vk_probe PUBLIC Vulkan::Vulkan) - if(WOWEE_BUILD_AMD_FSR3_RUNTIME AND WOWEE_AMD_FFX_SDK_KITS_READY) + if(WOWEE_BUILD_AMD_FSR3_RUNTIME) message(STATUS "AMD FSR3 Path A runtime target enabled: build with target 'wowee_fsr3_official_runtime_copy'") set(WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR ${CMAKE_BINARY_DIR}/ffx_sdk_runtime_build) if(WIN32) @@ -211,12 +187,9 @@ else() add_compile_definitions(WOWEE_AMD_FFX_SDK_KITS=0) if(WOWEE_ENABLE_AMD_FSR3_FRAMEGEN) if(EXISTS ${WOWEE_AMD_FFX_SDK_KITS_FG_HEADER}) - message(STATUS "FidelityFX-SDK Kits layout detected at ${WOWEE_AMD_FFX_SDK_KITS_DIR}, " - "but legacy sdk/include headers required by WoWee FSR3 probe/runtime are not present. " - "FSR3 framegen interface probe disabled.") + message(STATUS "FidelityFX-SDK Kits layout detected at ${WOWEE_AMD_FFX_SDK_KITS_DIR}, but required FSR3 headers are incomplete. FSR3 framegen interface probe disabled.") else() - message(WARNING "AMD FidelityFX-SDK framegen headers not found at ${WOWEE_AMD_FFX_SDK_DIR}; " - "FSR3 framegen interface probe disabled.") + message(WARNING "AMD FidelityFX-SDK Kits headers not found at ${WOWEE_AMD_FFX_SDK_KITS_DIR}; FSR3 framegen interface probe disabled.") endif() endif() endif() diff --git a/README.md b/README.md index ab2ba60a..b1b1b300 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,7 @@ make -j$(nproc) - GitHub Actions builds on every push: Linux (x86-64, ARM64), Windows (x86-64, ARM64 via MSYS2), macOS (ARM64) - All build jobs are AMD-FSR2-only (`WOWEE_ENABLE_AMD_FSR2=ON`) and explicitly build `wowee_fsr2_amd_vk` - Each job clones AMD's FSR2 SDK and FidelityFX-SDK (`Kelsidavis/FidelityFX-SDK`, `main` by default) -- Linux CI checks FidelityFX-SDK framegen files and supports both legacy (`sdk/...`) and Kits layouts +- Linux CI validates FidelityFX-SDK Kits framegen headers - CI builds `wowee_fsr3_framegen_amd_vk_probe` when that target is generated for the detected SDK layout - If FSR2 generated Vulkan permutation headers are absent upstream, WoWee bootstraps them from `third_party/fsr2_vk_permutations` - Container build via `container/build-in-container.sh` (Podman) diff --git a/docs/AMD_FSR2_INTEGRATION.md b/docs/AMD_FSR2_INTEGRATION.md index 9f37ef9c..bc7bffe8 100644 --- a/docs/AMD_FSR2_INTEGRATION.md +++ b/docs/AMD_FSR2_INTEGRATION.md @@ -71,11 +71,11 @@ Runtime note: - All build jobs clone: - `GPUOpen-Effects/FidelityFX-FSR2` (`master`) - `Kelsidavis/FidelityFX-SDK` (`main`) by default -- Linux CI additionally checks FidelityFX-SDK framegen files (legacy `sdk/...` and Kits layouts): - - `ffx_frameinterpolation_callbacks_glsl.h` - - `ffx_opticalflow_callbacks_glsl.h` - - `CMakeShadersFrameinterpolation.txt` - - `CMakeShadersOpticalflow.txt` +- Linux CI validates FidelityFX-SDK Kits framegen headers: + - `upscalers/fsr3/include/ffx_fsr3upscaler.h` + - `framegeneration/fsr3/include/ffx_frameinterpolation.h` + - `framegeneration/fsr3/include/ffx_opticalflow.h` + - `backend/vk/ffx_vk.h` - CI builds `wowee_fsr3_framegen_amd_vk_probe` when that target is generated by CMake for the detected SDK layout. - Some upstream SDK checkouts do not include generated Vulkan permutation headers. - WoWee bootstraps those headers from the vendored snapshot so AMD backend builds remain cross-platform and deterministic. diff --git a/src/rendering/amd_fsr3_framegen_probe.cpp b/src/rendering/amd_fsr3_framegen_probe.cpp index 9441cf5d..dde7ebe5 100644 --- a/src/rendering/amd_fsr3_framegen_probe.cpp +++ b/src/rendering/amd_fsr3_framegen_probe.cpp @@ -1,15 +1,8 @@ #include -#if WOWEE_AMD_FFX_SDK_KITS #include #include #include #include -#else -#include -#include -#include -#include -#endif namespace wowee::rendering { @@ -21,11 +14,7 @@ bool amdFsr3FramegenCompileProbe() { FfxFrameInterpolationContext fiContext{}; FfxOpticalflowContext ofContext{}; FfxInterface backend{}; -#if WOWEE_AMD_FFX_SDK_KITS FfxApiDimensions2D renderSize{}; -#else - FfxDimensions2D renderSize{}; -#endif static_assert(FFX_FSR3UPSCALER_VERSION_MAJOR >= 3, "Expected FSR3 upscaler v3+"); static_assert(FFX_FRAMEINTERPOLATION_VERSION_MAJOR >= 1, "Expected frame interpolation v1+"); diff --git a/src/rendering/amd_fsr3_runtime.cpp b/src/rendering/amd_fsr3_runtime.cpp index dd2499ca..773935b8 100644 --- a/src/rendering/amd_fsr3_runtime.cpp +++ b/src/rendering/amd_fsr3_runtime.cpp @@ -16,13 +16,8 @@ #endif #if WOWEE_HAS_AMD_FSR3_FRAMEGEN -#if WOWEE_AMD_FFX_SDK_KITS #include "third_party/ffx_fsr3_legacy_compat.h" #include -#else -#include -#include -#endif #endif namespace wowee::rendering { @@ -238,11 +233,7 @@ bool AmdFsr3Runtime::initialize(const AmdFsr3RuntimeInitDesc& desc) { return false; } -#if WOWEE_AMD_FFX_SDK_KITS scratchBufferSize_ = fns_->getScratchMemorySizeVK(FFX_FSR3_CONTEXT_COUNT); -#else - scratchBufferSize_ = fns_->getScratchMemorySizeVK(desc.physicalDevice, FFX_FSR3_CONTEXT_COUNT); -#endif if (scratchBufferSize_ == 0) { LOG_WARNING("FSR3 runtime: scratch buffer size query returned 0."); lastError_ = "scratch buffer size query returned 0"; @@ -258,24 +249,11 @@ bool AmdFsr3Runtime::initialize(const AmdFsr3RuntimeInitDesc& desc) { return false; } -#if WOWEE_AMD_FFX_SDK_KITS FfxDevice ffxDevice = fns_->getDeviceVK(desc.device); -#else - VkDeviceContext vkDevCtx{}; - vkDevCtx.vkDevice = desc.device; - vkDevCtx.vkPhysicalDevice = desc.physicalDevice; - vkDevCtx.vkDeviceProcAddr = desc.getDeviceProcAddr; - FfxDevice ffxDevice = fns_->getDeviceVK(&vkDevCtx); -#endif FfxInterface backendShared{}; -#if WOWEE_AMD_FFX_SDK_KITS FfxErrorCode ifaceErr = fns_->getInterfaceVK( &backendShared, ffxDevice, desc.physicalDevice, scratchBuffer_, scratchBufferSize_, FFX_FSR3_CONTEXT_COUNT); -#else - FfxErrorCode ifaceErr = fns_->getInterfaceVK( - &backendShared, ffxDevice, scratchBuffer_, scratchBufferSize_, FFX_FSR3_CONTEXT_COUNT); -#endif if (ifaceErr != FFX_OK) { LOG_WARNING("FSR3 runtime: ffxGetInterfaceVK failed (", static_cast(ifaceErr), ")."); lastError_ = "ffxGetInterfaceVK failed"; @@ -386,23 +364,13 @@ bool AmdFsr3Runtime::dispatchUpscale(const AmdFsr3RuntimeDispatchDesc& desc) { static wchar_t kDepthName[] = L"FSR3_Depth"; static wchar_t kMotionName[] = L"FSR3_MotionVectors"; static wchar_t kOutputName[] = L"FSR3_Output"; -#if WOWEE_AMD_FFX_SDK_KITS dispatch.color = fns_->getResourceVK(desc.colorImage, colorDesc, kColorName, FFX_RESOURCE_STATE_COMPUTE_READ); dispatch.depth = fns_->getResourceVK(desc.depthImage, depthDesc, kDepthName, FFX_RESOURCE_STATE_COMPUTE_READ); dispatch.motionVectors = fns_->getResourceVK(desc.motionVectorImage, mvDesc, kMotionName, FFX_RESOURCE_STATE_COMPUTE_READ); -#else - dispatch.color = fns_->getResourceVK(reinterpret_cast(desc.colorImage), colorDesc, kColorName, FFX_RESOURCE_STATE_COMPUTE_READ); - dispatch.depth = fns_->getResourceVK(reinterpret_cast(desc.depthImage), depthDesc, kDepthName, FFX_RESOURCE_STATE_COMPUTE_READ); - dispatch.motionVectors = fns_->getResourceVK(reinterpret_cast(desc.motionVectorImage), mvDesc, kMotionName, FFX_RESOURCE_STATE_COMPUTE_READ); -#endif dispatch.exposure = FfxResource{}; dispatch.reactive = FfxResource{}; dispatch.transparencyAndComposition = FfxResource{}; -#if WOWEE_AMD_FFX_SDK_KITS dispatch.upscaleOutput = fns_->getResourceVK(desc.outputImage, outDesc, kOutputName, FFX_RESOURCE_STATE_UNORDERED_ACCESS); -#else - dispatch.upscaleOutput = fns_->getResourceVK(reinterpret_cast(desc.outputImage), outDesc, kOutputName, FFX_RESOURCE_STATE_UNORDERED_ACCESS); -#endif dispatch.jitterOffset.x = desc.jitterX; dispatch.jitterOffset.y = desc.jitterY; dispatch.motionVectorScale.x = desc.motionScaleX; @@ -459,17 +427,10 @@ bool AmdFsr3Runtime::dispatchFrameGeneration(const AmdFsr3RuntimeDispatchDesc& d static wchar_t kInterpolatedName[] = L"FSR3_InterpolatedOutput"; FfxFrameGenerationDispatchDescription fgDispatch{}; fgDispatch.commandList = fns_->getCommandListVK(desc.commandBuffer); -#if WOWEE_AMD_FFX_SDK_KITS fgDispatch.presentColor = fns_->getResourceVK( desc.outputImage, presentDesc, kPresentName, FFX_RESOURCE_STATE_COMPUTE_READ); fgDispatch.outputs[0] = fns_->getResourceVK( desc.frameGenOutputImage, fgOutDesc, kInterpolatedName, FFX_RESOURCE_STATE_UNORDERED_ACCESS); -#else - fgDispatch.presentColor = fns_->getResourceVK( - reinterpret_cast(desc.outputImage), presentDesc, kPresentName, FFX_RESOURCE_STATE_COMPUTE_READ); - fgDispatch.outputs[0] = fns_->getResourceVK( - reinterpret_cast(desc.frameGenOutputImage), fgOutDesc, kInterpolatedName, FFX_RESOURCE_STATE_UNORDERED_ACCESS); -#endif fgDispatch.numInterpolatedFrames = 1; fgDispatch.reset = desc.reset; fgDispatch.backBufferTransferFunction = FFX_BACKBUFFER_TRANSFER_FUNCTION_SRGB;