WIP: Add frame generation GPU timings to the menu footer #1218

Draft
PEQHUB wants to merge 1 commit from PEQHUB/feature/fg-gpu-timings into master
PEQHUB commented 2026-10-13 22:45:32 +00:00 (Migrated from github.com)

Adds an FG GPU milliseconds counter beside the upscaler cost in the menu footer. Hovering the counter shows its backend, measured scope, average, sample count and age. Disabled or paused FG shows Off; missing or stale measurements show N/A.

The patch measures OptiScaler FSR-FG on DX12/Vulkan, DX12 reprojection, NGX-to-FFX evaluations, and Nukem's already-recording DX12 path. Combo's FSR middle-frame component is marked FG* because it is partial. Native NVIDIA DLSS-G/MFG uses fresh real-driver aiFrameTimeUs reports, with no multiplier division. Substituted NGX routes are excluded from that driver fallback.

The collectors bind timestamps to observed submission queues and completion, retain query resources through recording/allocator retirement, and use bounded history/resources. Readback adds no CPU wait for GPU completion or queue dependency waits. Collection remains independent of whether an upscaler is active.

XeFG's private profiling exports have no documented ABI, so XeFG and other opaque/unproven routes remain N/A. docs/FG-Timings.md documents stage boundaries, partial scopes, supported producer contracts and remaining limitations.

Validation:

  • Standalone CPU tests passed for invalid values, duplicate/out-of-order samples, reset epochs, stale data, bounded averages and Vulkan timestamp conversion.
  • Local x64 Release DLL build passed with VS 2022 Build Tools.
  • Modified/new C++ files pass clang-format 22 and git diff --check.
  • Independent source review addressed allocator retirement, late hook installation, Vulkan teardown, scope labeling and native/substituted route separation.
  • No GPU/game runtime validation has been performed. Async/MFG, resize/alt-tab, third-party hook chains, timing attribution and collection overhead still require PIX/Nsight/Inspector and game testing.

A read-only-permissions GitHub Actions workflow builds an unsigned x64 Release package and uploads the DLL, dependencies, route documentation, source commit and DLL SHA-256. It does not publish a release.

GitHub verification: FG Timing DLL build passed CPU tests, Release compilation, provenance generation and artifact upload. The formatting check also passed.

Download the GitHub-built package for source commit cabe240f87352f67922d5e7f1f48f8f6dcf37bed. Its downloaded DLL matches the provenance SHA-256: F50BE8BA8833015289AA4718053CD031D424E97083BEFB0604EFC22B3F7E23A1.

Adds an FG GPU milliseconds counter beside the upscaler cost in the menu footer. Hovering the counter shows its backend, measured scope, average, sample count and age. Disabled or paused FG shows Off; missing or stale measurements show N/A. The patch measures OptiScaler FSR-FG on DX12/Vulkan, DX12 reprojection, NGX-to-FFX evaluations, and Nukem's already-recording DX12 path. Combo's FSR middle-frame component is marked FG* because it is partial. Native NVIDIA DLSS-G/MFG uses fresh real-driver aiFrameTimeUs reports, with no multiplier division. Substituted NGX routes are excluded from that driver fallback. The collectors bind timestamps to observed submission queues and completion, retain query resources through recording/allocator retirement, and use bounded history/resources. Readback adds no CPU wait for GPU completion or queue dependency waits. Collection remains independent of whether an upscaler is active. XeFG's private profiling exports have no documented ABI, so XeFG and other opaque/unproven routes remain N/A. docs/FG-Timings.md documents stage boundaries, partial scopes, supported producer contracts and remaining limitations. Validation: - Standalone CPU tests passed for invalid values, duplicate/out-of-order samples, reset epochs, stale data, bounded averages and Vulkan timestamp conversion. - Local x64 Release DLL build passed with VS 2022 Build Tools. - Modified/new C++ files pass clang-format 22 and git diff --check. - Independent source review addressed allocator retirement, late hook installation, Vulkan teardown, scope labeling and native/substituted route separation. - No GPU/game runtime validation has been performed. Async/MFG, resize/alt-tab, third-party hook chains, timing attribution and collection overhead still require PIX/Nsight/Inspector and game testing. A read-only-permissions GitHub Actions workflow builds an unsigned x64 Release package and uploads the DLL, dependencies, route documentation, source commit and DLL SHA-256. It does not publish a release. GitHub verification: [FG Timing DLL build](https://github.com/PEQHUB/OptiScaler/actions/runs/38479892435) passed CPU tests, Release compilation, provenance generation and artifact upload. The [formatting check](https://github.com/PEQHUB/OptiScaler/actions/runs/38479892357) also passed. [Download the GitHub-built package](https://github.com/PEQHUB/OptiScaler/actions/runs/38479892435/artifacts/11856383375) for source commit `cabe240f87352f67922d5e7f1f48f8f6dcf37bed`. Its downloaded DLL matches the provenance SHA-256: `F50BE8BA8833015289AA4718053CD031D424E97083BEFB0604EFC22B3F7E23A1`.
This pull request has changes conflicting with the target branch.
  • OptiScaler/framegen/ffx/FSRFG_Dx12.cpp
  • OptiScaler/framegen/ffx/FSRFG_Vk.cpp
  • OptiScaler/framegen/reprojection/Reprojection_Dx12.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin PEQHUB/feature/fg-gpu-timings:PEQHUB/feature/fg-gpu-timings
git switch PEQHUB/feature/fg-gpu-timings

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff PEQHUB/feature/fg-gpu-timings
git switch PEQHUB/feature/fg-gpu-timings
git rebase master
git switch master
git merge --ff-only PEQHUB/feature/fg-gpu-timings
git switch PEQHUB/feature/fg-gpu-timings
git rebase master
git switch master
git merge --no-ff PEQHUB/feature/fg-gpu-timings
git switch master
git merge --squash PEQHUB/feature/fg-gpu-timings
git switch master
git merge --ff-only PEQHUB/feature/fg-gpu-timings
git switch master
git merge PEQHUB/feature/fg-gpu-timings
git push origin master
Sign in to join this conversation.
No description provided.