Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
feat(fsr): probe proves FSR Frame Generation 3.1.7 initialises on NVIDIA; 4.0.1 ML not advertised
Veyra Goal Agentef0fb50df706
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 7d4788dd..6ac5377d 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -476,6 +476,11 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avformadd_executable(veyra_repair_parameter_tests tests/integration/RepairParameterTests.cpp)add_executable(veyra_image_dimension_tests tests/integration/ImageDimensionTests.cpp)add_executable(veyra_capture_color_probe tools/capture_color_probe/main.cpp)+ add_executable(veyra_fsr_probe tools/fsr_probe/main.cpp)+ target_compile_features(veyra_fsr_probe PRIVATE cxx_std_20)+ target_compile_options(veyra_fsr_probe PRIVATE /utf-8 /WX-)+ target_compile_definitions(veyra_fsr_probe PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN UNICODE _UNICODE)+ target_link_libraries(veyra_fsr_probe PRIVATE d3d12 dxgi dxguid)add_executable(veyra_capture_color_tests tests/unit/CaptureColorContractTests.cpp)add_executable(veyra_presentation_worker_tests tests/unit/LiveGpuSchedulerTests.cpp)target_compile_features(veyra_presentation_worker_tests PRIVATE cxx_std_20)diff --git a/docs/AMD_FSR_SDK_2.3.0_LOCAL.md b/docs/AMD_FSR_SDK_2.3.0_LOCAL.mdindex ce9813fe..e4bc2613 100644--- a/docs/AMD_FSR_SDK_2.3.0_LOCAL.md+++ b/docs/AMD_FSR_SDK_2.3.0_LOCAL.md@@ -36,7 +36,26 @@## 3. 待办与边界-1. **构建路径勘察结论**:SDK 2.3.0 根目录没有 CMakeLists,官方构建方式是**每个效果一个 Visual Studio 解决方案**(`Samples/FidelityFX_<effect>/dx12/FidelityFX_<effect>_2022.sln`),依赖 vcpkg 与 Cauldron 框架——这是一套重量级样例构建,不适合直接搬进 Veyra。**但签名预编译 DLL 已随 SDK 提供**(见 §1 表格),所以下一步不是"重建 SDK",而是:读 `Kits/FidelityFX/api` 与 `Kits/FidelityFX/framegeneration/fsr3` 的 provider/host 源码,评估把少量 provider 胶水源码直接编进 Veyra(或经 `amd_fidelityfx_loader_dx12.dll` 加载)的可行性,再按 `CMakeLists.txt` 里 1.1.4 静态库那种方式接入。只用其 DLL 与头文件、不修改任何 AMD 二进制。+### 3.0 本机探针实测(2026-09-16,`tools/fsr_probe`)++新增诊断工具 `tools/fsr_probe`(CMake 目标 `veyra_fsr_probe`):加载上述签名 loader DLL、枚举 provider 版本、并用真实 D3D12 设备 + 隐藏窗口尝试创建 FX 帧生成的代理交换链。**在本机 NVIDIA RTX 5070(vendor 0x10DE)** 实测:++```text+loader 加载成功,FSR API 入口解析成功+framegen-swapchain-forhwnd versionsQuery=OK count=1 -> 3.1.7+framegen versionsQuery=OK count=1 -> 3.1.6+(带真实 device 查询 version 变体,同样只返回 3.1.7 / 3.1.6)+CreateContext(framegen swapchain for hwnd) result=OK context=非空 swapchain=非空+DestroyContext result=OK+```++结论(与计划的分档一致,且首次有本机证据):++1. **FSR 帧生成 3.1.x 在 NVIDIA 上可以初始化**:3.1.7 swapchain provider 在 RTX 5070 上 `CreateContext` 成功并返回代理交换链。→ 这就是"N 卡回退 3.1.x"的可行性证明,可以直接做后端。+2. **4.0.1(ML)在本机没有被 provider 枚举出来**(同一 desc 类型与真实 device 都只返回 3.1.x)。与"4.x 面向 AMD 支持列表"一致;4.0.x 是否可用需要在 AMD 卡上复测,不能凭 NVIDIA 结果推断。+3. **loader 的 provider 发现依赖 DLL 所在目录**:只有把工作目录切到 `signedbin` 时才会枚举到 provider;仅用 `LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR` 加载 loader 不够。正式集成时必须显式把 AMD DLL 目录加入加载搜索路径(`AddDllDirectory`/`SetDllDirectory` 或等价手段),否则会出现 `NO_PROVIDER` / `ERROR_UNKNOWN_DESCTYPE`。++1. **构建路径勘察结论**:SDK 2.3.0 根目录没有 CMakeLists,官方构建方式是**每个效果一个 Visual Studio 解决方案**(`Samples/FidelityFX_<effect>/dx12/FidelityFX_<effect>_2022.sln`),依赖 vcpkg 与 Cauldron 框架——这是一套重量级样例构建,不适合直接搬进 Veyra。**但签名预编译 DLL 已随 SDK 提供**(见 §1 表格),且探针已证明**不编译 SDK、直接经 loader DLL 调用就能用**(3.1.7 帧生成已在本机创建成功)。下一步是把这条路径接入播放器。2. **能力查询优先**:先在真实显卡上查询 FSR Frame Generation / Upscaling 4.x 是否可用(AMD 的支持列表按 GPU/驱动区分;NVIDIA 上大概率不可用),据此决定界面分档:AMD 卡开放 4.1/4.0.x,N 卡只给 FSR 2 / 3.1。3. **发布范围**:把 `amd_fidelityfx_*_dx12.dll` 放进 Release 属于范围变更,需要用户单独授权,并在 `release-runtime-manifest.json` 与 `THIRD_PARTY_NOTICES.md` 中逐项登记(名称、版本、大小、SHA-256、来源、许可)。4. **不改二进制**:所有 AMD DLL 原样使用,不做补丁、不重签名。diff --git a/tools/fsr_probe/main.cpp b/tools/fsr_probe/main.cppnew file mode 100644index 00000000..05480b87--- /dev/null+++ b/tools/fsr_probe/main.cpp@@ -0,0 +1,180 @@+// AMD FSR frame-generation probe (diagnostic only, never shipped in the player).+//+// Loads the vendored AMD FidelityFX loader DLL, enumerates the frame-generation+// and upscaling providers and then tries to create the DX12 frame-generation+// proxy swapchain context on the local GPU. The result tells us, with evidence,+// whether the ML frame generation of FSR SDK 2.3.0 can initialise on the host+// adapter (NVIDIA in this project's test machine) or is gated to AMD hardware.+//+// Usage: veyra_fsr_probe [path-to-amd_fidelityfx_loader_dx12.dll]+#include <windows.h>++#include <d3d12.h>+#include <dxgi1_6.h>+#include <wrl/client.h>++#include <cstdio>+#include <filesystem>+#include <string>+#include <vector>++#include "../../third_party_local/amd/FidelityFX-SDK-2.3.0/Kits/FidelityFX/api/include/ffx_api_loader.h"+#include "../../third_party_local/amd/FidelityFX-SDK-2.3.0/Kits/FidelityFX/framegeneration/include/ffx_framegeneration.h"+#include "../../third_party_local/amd/FidelityFX-SDK-2.3.0/Kits/FidelityFX/framegeneration/include/dx12/ffx_api_framegeneration_dx12.h"++using Microsoft::WRL::ComPtr;++namespace {++const char* resultName(ffxReturnCode_t code) {+ switch (code) {+ case FFX_API_RETURN_OK: return "OK";+ case FFX_API_RETURN_ERROR: return "ERROR";+ case FFX_API_RETURN_ERROR_UNKNOWN_DESCTYPE: return "ERROR_UNKNOWN_DESCTYPE";+ case FFX_API_RETURN_ERROR_RUNTIME_ERROR: return "ERROR_RUNTIME_ERROR";+ case FFX_API_RETURN_NO_PROVIDER: return "NO_PROVIDER";+ case FFX_API_RETURN_ERROR_MEMORY: return "ERROR_MEMORY";+ case FFX_API_RETURN_ERROR_PARAMETER: return "ERROR_PARAMETER";+ case FFX_API_RETURN_PROVIDER_NO_SUPPORT_NEW_DESCTYPE: return "PROVIDER_NO_SUPPORT_NEW_DESCTYPE";+ default: return "OTHER";+ }+}++LRESULT CALLBACK probeProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {+ return DefWindowProcW(hwnd, msg, wp, lp);+}++void reportVersions(const ffxFunctions& functions, uint64_t createDescType, const char* label, void* device) {+ uint64_t count = 0;+ ffxQueryDescGetVersions query{};+ query.header.type = FFX_API_QUERY_DESC_TYPE_GET_VERSIONS;+ query.createDescType = createDescType;+ query.device = device;+ query.outputCount = &count;+ query.versionIds = nullptr;+ query.versionNames = nullptr;+ const auto countResult = functions.Query(nullptr, &query.header);+ std::printf("[fsr-probe] %s versionsQuery=%s count=%llu\n", label, resultName(countResult),+ static_cast<unsigned long long>(count));+ if (countResult != FFX_API_RETURN_OK || count == 0 || count > 32) return;+ std::vector<uint64_t> ids(count, 0);+ std::vector<const char*> names(count, nullptr);+ uint64_t capacity = count;+ query.outputCount = &capacity;+ query.versionIds = ids.data();+ query.versionNames = names.data();+ const auto listResult = functions.Query(nullptr, &query.header);+ std::printf("[fsr-probe] %s versionsList=%s returned=%llu\n", label, resultName(listResult),+ static_cast<unsigned long long>(capacity));+ for (uint64_t i = 0; i < capacity && i < ids.size(); ++i) {+ std::printf("[fsr-probe] %s[%llu] id=%llu name=%s\n", label, static_cast<unsigned long long>(i),+ static_cast<unsigned long long>(ids[i]), names[i] ? names[i] : "(null)");+ }+}++} // namespace++int wmain(int argc, wchar_t** argv) {+ std::filesystem::path loaderPath;+ if (argc > 1) loaderPath = argv[1];+ else loaderPath = std::filesystem::current_path() /+ L"third_party_local/amd/FidelityFX-SDK-2.3.0/Kits/FidelityFX/signedbin/amd_fidelityfx_loader_dx12.dll";+ std::printf("[fsr-probe] loader=%s\n", loaderPath.string().c_str());++ HMODULE loader = LoadLibraryExW(loaderPath.wstring().c_str(), nullptr,+ LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);+ if (loader == nullptr) {+ std::printf("[fsr-probe] loader load failed win32=%lu\n", GetLastError());+ return 2;+ }++ ffxFunctions functions{};+ ffxLoadFunctions(&functions, loader);+ if (functions.CreateContext == nullptr || functions.Query == nullptr || functions.DestroyContext == nullptr) {+ std::printf("[fsr-probe] loader is missing the FSR API entry points\n");+ return 3;+ }+ std::printf("[fsr-probe] FSR API entry points resolved\n");++ // Minimal D3D12 host: default adapter, one queue, hidden window, flip-model+ // swapchain descriptor identical in shape to the player's present sink.+ ComPtr<IDXGIFactory6> factory;+ if (FAILED(CreateDXGIFactory2(0, IID_PPV_ARGS(&factory)))) {+ std::printf("[fsr-probe] CreateDXGIFactory2 failed\n");+ return 4;+ }+ ComPtr<IDXGIAdapter1> adapter;+ if (FAILED(factory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&adapter)))) {+ std::printf("[fsr-probe] no high-performance adapter\n");+ return 5;+ }+ DXGI_ADAPTER_DESC1 adapterDesc{};+ adapter->GetDesc1(&adapterDesc);+ std::wprintf(L"[fsr-probe] adapter=%s vendor=0x%04X\n", adapterDesc.Description, adapterDesc.VendorId);++ ComPtr<ID3D12Device> device;+ if (FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device)))) {+ std::printf("[fsr-probe] D3D12CreateDevice failed\n");+ return 6;+ }+ D3D12_COMMAND_QUEUE_DESC queueDesc{};+ queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;+ ComPtr<ID3D12CommandQueue> queue;+ if (FAILED(device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&queue)))) {+ std::printf("[fsr-probe] CreateCommandQueue failed\n");+ return 7;+ }++ // Provider/version inventory runs with the real device attached: some+ // providers only advertise the ML (4.0.x) family when a device is present.+ reportVersions(functions, FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_FOR_HWND_DX12, "framegen-swapchain-forhwnd", device.Get());+ reportVersions(functions, FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATION, "framegen", device.Get());+ reportVersions(functions, FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_VERSION_DX12, "framegen-swapchain-version", device.Get());+ reportVersions(functions, FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATION_VERSION, "framegen-version", device.Get());++ WNDCLASSW wc{};+ wc.lpfnWndProc = probeProc;+ wc.hInstance = GetModuleHandleW(nullptr);+ wc.lpszClassName = L"VeyraFsrProbe";+ RegisterClassW(&wc);+ HWND hwnd = CreateWindowExW(0, wc.lpszClassName, L"FSR probe", WS_OVERLAPPEDWINDOW,+ CW_USEDEFAULT, CW_USEDEFAULT, 1280, 720, nullptr, nullptr, wc.hInstance, nullptr);+ if (hwnd == nullptr) {+ std::printf("[fsr-probe] CreateWindow failed\n");+ return 8;+ }++ DXGI_SWAP_CHAIN_DESC1 scd{};+ scd.Width = 1280;+ scd.Height = 720;+ scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;+ scd.SampleDesc.Count = 1;+ scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;+ scd.BufferCount = 3;+ scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;+ scd.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;+ scd.Scaling = DXGI_SCALING_STRETCH;++ ComPtr<IDXGISwapChain4> swapchain;+ ffxCreateContextDescFrameGenerationSwapChainForHwndDX12 desc{};+ desc.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATIONSWAPCHAIN_FOR_HWND_DX12;+ desc.swapchain = swapchain.GetAddressOf();+ desc.hwnd = hwnd;+ desc.desc = &scd;+ desc.fullscreenDesc = nullptr;+ desc.dxgiFactory = factory.Get();+ desc.gameQueue = queue.Get();++ ffxContext context = nullptr;+ const auto createResult = functions.CreateContext(&context, &desc.header, nullptr);+ std::printf("[fsr-probe] CreateContext(framegen swapchain for hwnd) result=%s (0x%llX) context=%p swapchain=%p\n",+ resultName(createResult), static_cast<unsigned long long>(createResult),+ static_cast<void*>(context), static_cast<void*>(swapchain.Get()));+ if (context != nullptr) {+ const auto destroyResult = functions.DestroyContext(&context, nullptr);+ std::printf("[fsr-probe] DestroyContext result=%s\n", resultName(destroyResult));+ }+ DestroyWindow(hwnd);+ FreeLibrary(loader);+ return createResult == FFX_API_RETURN_OK ? 0 : 1;+}