From 8b1fc42b7a8b73d91fc6ee876003b3574bd516a5 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 9 Mar 2026 01:03:07 -0700 Subject: [PATCH] Fix AMD CI SDK layout check and tighten DX12 interop preflight --- .github/workflows/build.yml | 17 +++++++++--- src/rendering/amd_fsr3_wrapper_impl.cpp | 36 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8ebdc29..3dda4414 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,12 +86,23 @@ jobs: run: | set -euo pipefail SDK_DIR="$PWD/extern/FidelityFX-SDK/sdk" - test -f "$SDK_DIR/include/FidelityFX/host/ffx_frameinterpolation.h" - if [ -f "$SDK_DIR/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" ] \ + 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 Vulkan framegen files detected." + 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 diff --git a/src/rendering/amd_fsr3_wrapper_impl.cpp b/src/rendering/amd_fsr3_wrapper_impl.cpp index 76f12cad..5b045e5d 100644 --- a/src/rendering/amd_fsr3_wrapper_impl.cpp +++ b/src/rendering/amd_fsr3_wrapper_impl.cpp @@ -56,6 +56,39 @@ bool hasExtension(const std::vector& extensions, const ch } return false; } + +bool hasExternalImageInteropSupport(VkPhysicalDevice physicalDevice, VkFormat format) { + if (!physicalDevice || format == VK_FORMAT_UNDEFINED) return false; + + VkPhysicalDeviceExternalImageFormatInfo externalInfo{}; + externalInfo.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO; + externalInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + + VkPhysicalDeviceImageFormatInfo2 imageInfo{}; + imageInfo.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2; + imageInfo.format = format; + imageInfo.type = VK_IMAGE_TYPE_2D; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | + VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + imageInfo.flags = 0; + imageInfo.pNext = &externalInfo; + + VkExternalImageFormatProperties externalProps{}; + externalProps.sType = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES; + + VkImageFormatProperties2 imageProps{}; + imageProps.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2; + imageProps.pNext = &externalProps; + + const VkResult res = vkGetPhysicalDeviceImageFormatProperties2(physicalDevice, &imageInfo, &imageProps); + if (res != VK_SUCCESS) return false; + + const VkExternalMemoryFeatureFlags features = externalProps.externalMemoryProperties.externalMemoryFeatures; + const bool exportable = (features & VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT) != 0; + const bool importable = (features & VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT) != 0; + return exportable && importable; +} #endif enum class WrapperBackend { @@ -316,6 +349,9 @@ bool runDx12BridgePreflight(const WoweeFsr3WrapperInitDesc* initDesc, std::strin missing.emplace_back(extName); } } + if (!hasExternalImageInteropSupport(initDesc->physicalDevice, initDesc->colorFormat)) { + missing.emplace_back("external memory export/import support for swap/upscale format"); + } } } }