fix(vk): preserve Native HDR HUD colors in FSR frame generation #2169
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2169
Loading…
Reference in a new issue
No description provided.
Delete branch "futondestroyer/Longshot:codex/fsr-native-hdr-hud"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
TL;DR
Preserve the HUD’s displayed colors in Native HDR with FSR 3.1 frame generation. The game-free regression fails before the fix and passes after it. Both matched Windows RTX 4070 comparisons passed, including the tested main and PR pins. The original RX 9070 XT and FSR 4 setup still needs confirmation.
Summary
In the Market, enable Native HDR, FSR 4 Native AA and FSR 3.1 frame generation. In the reported run, the minimap, hearts and item icons alternated between their ordinary colors and saturated red or dark colors while the scene was in motion. The generated-frame HUD path combined a linear game capture with the PQ-encoded picture presented to the display.
When a HUD copy is available, Native HDR now supplies already-presented PQ pixels to the existing FSR HUD mask. Marked pixels keep their displayed color, and the generated picture supplies the unmarked pixels. SDR and Expanded HDR keep their existing learned HUD layer. The first fitting pass after leaving Native HDR starts from a fresh capture pair. Start in
gpu/vk/vk_framegen.cppandtests/test_fsr3fi_hud_mask.py.See #1896.
Testing
Tested:
334b6b52on maincce3ded1and passes at0faee414. It covers opaque and translucent marked pixels, hidden and unmarked pixels, and the first learned fit after returning to sRGB. HUD capture and frame-generation resource checks also pass. The Windows candidate renderer linked and passed its export check.cce3ded1and this PR at0faee414with the same hashed Windows API 44 host. The candidate pack replaced only the Vulkan renderer. Both runs used the child Market checkpoint at 1280×720, FSR 3.1 Quality upscaling and 2× FSR 3.1 frame generation. Native HDR10 at 300-nit paper white and 1000-nit peak was followed by Expanded HDR. The counts below are from the last 600 settled presents in each phase. Both runs exited cleanly.96caf2f2, build source stampe78e3645) with that same host and the equivalent fix in its API 41 renderer (64a8e6b7). Ran the child Market checkpoint at 1280×720 with FSR 3.1 Quality upscaling and 2× FSR 3.1 frame generation, Native HDR10 at 300-nit paper white and 1000-nit peak, then switched to Expanded HDR. Each build made 600 FSR frames with the HUD marked in the sampled Native window. Stock used the learned HUD layer on all 600. The fixed renderer skipped it on all 600, then used it on all 600 in the settled Expanded window after the SDK reset its input history to sRGB. Both runs exited cleanly. This comparison exercises the shared frame-generation path on a linear RGBA16F capture. Its upscaler and GPU differ from those in the original report.glslangValidator, which is unavailable on this PC.test_hdr_encode.pyandtest_psychov35_fsr3_fg.pyhave the same failures on both pins. Full suite coverage remains open.dd5ffe6aafter this comparison started. Git merged the tested change cleanly with that revision. The intervening changes update FSR 4 shader preparation, the startup screen, crash-report privacy, and VI diagnostic logging. The gameplay results below retain theircce3ded1and0faee414pins.Still to test:
Measurements
Verdict: The marked-pixel regression passes with the fix. Both runs generated the same number of FSR and HUD-marked frames in settled samples. Native HDR dropped the linear learned layer and Expanded HDR resumed it after the color-history reset.
Setup: Windows 11, RTX 4070, NVIDIA 621.01 and LLVM-MinGW. The game counters come from the matched API 44 Market runs above. The test-only commit
334b6b52runs the regression on main’s production code. It exercises the source routing, the HUD mask expression and the patched FSR static-pixel rule.cce3ded10faee414Risks
Native HDR keeps the fully composited source pixel at a marked translucent edge. In motion, that can retain part of the source frame’s background. SDR and Expanded HDR still use the existing transparency fit. The change requires no save, options, or cache migration.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.mainand here, for a change that shows on screen.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows 11, RTX 4070 (NVIDIA 621.01), Market_Child, 1280×720 HDR10, FSR 3.1 Quality and 2× FSR 3.1 frame generation. Verified main
cce3ded1vs this head0faee414with the same API 44 host, and stock Nightly 69596caf2f2vs the equivalent API 41 renderer 64a8e6b7 on the same Nightly host. In both comparisons the candidate kept 600 FSR-generated and HUD-marked frames in the settled Native sample, with 0 learned HUD layers versus 600 on stock. Expanded HDR reset FSR history to sRGB and used 600 learned layers on both sides. All four runs exited cleanly. The RX 9070 XT and FSR 4 Native AA setup in #1896 remains to test.@review
Recommendation: Approve. The code is ready: only testing is left. The Native HDR path has a game-free regression test, but its visual result on the reported AMD setup remains unproven. The change also leaves the HUD-handling reference and switch description inaccurate. Recommend approval; not approved on the forge.
Native HDR frame generation uses the presented PQ pixels at HUD marks instead of compositing a learned layer from linear captures. This avoids mixing color encodings, at the cost of retaining the real frame’s background at translucent HUD pixels.
@fixwill do (2)gpu/vk/vk_framegen.cpp:1397: Native HDR now ignores the HUD-less and learned-layer switches, but gpu/vk/switches.def and docs/dev/reference/upscalers.md still say the HUD-less copy and learned layer are used by default without that exception. (more on the line)tests/test_fsr3fi_hud_mask.py:395: The new pixel fixture reads the shader and shader patches from ROOT even when --source selects another checkout for the production C++ code. (more on the line)Before merging: testing (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_framegen.cpp:1492: The reported RX 9070 XT, FSR 4 Native AA and HDR setup has not been checked visually. (more on the line)gpu/vk/vk_framegen.cpp:1555: The changed frame-generation path has not been checked in gameplay on Linux NVIDIA, AMD RADV or an HDR-capable Steam Deck. (more on the line)Checks: Failing on this head, which is behind its base, where they pass:
Guide screenshots / Guide images and local UI source review (pull_request),CI / Website build and checks (pull_request).@rebase(or@fix) brings it up to date and runs them again; not held against it.More: does it help, other systems, switches, what was read
Does it help: Unproven in the reported setup. The source-backed test fails on main and passes on the PR; matched RTX 4070 runs report 600 generated and HUD-marked presents on each side, with learned-layer use changing from 600 to 0 in Native HDR. Those counts do not establish that the visible color flicker is gone or assess translucent edges.
Other systems: The routing affects FSR 3.1 frame generation in Native HDR on all supported GPUs and operating systems. SDR and Expanded HDR retain the learned path, but transitions back to it need coverage. Windows RTX 4070 counters and the fixture cover part of this; AMD, Linux and Steam Deck gameplay remain unverified.
Switches: RX_VK_FSR_FG_HUDLESS remains on by default but is now bypassed in Native HDR; its switch-table description and the upscaler reference do not describe that exception. RX_VK_FSR_FG_HUD_LAYER also no longer applies in Native HDR. The default’s visual result remains to be verified.
Reviewed:
0faee4149dagainstcce3ded1a3: Read the diff, both changed files and the relevant HUD capture, mask, layer, shader-patch and FSR input paths; read AGENTS.md, CONTRIBUTING.md, the PR template and the applicable standards. Skimmed related references and tests. No recorded runs or generated files were changed. The adjacent Tooling AGENTS.md and docs/review-checklist.md were absent.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no builds, scripts or tests were run. The PR reports a Windows renderer build and fixture runs, while Linux build and visual coverage remain open.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -1395,0 +1394,4 @@bool hudless_wanted(bool native_pq) {// The game captures the HUD's linear target before its HDR encode. Treating that colour as PQ// corrupts both the HUD-less input and the learned layer. Use the mask with the game's PQ present.if (native_pq) return false;L1: Native HDR now ignores the HUD-less and learned-layer switches, but gpu/vk/switches.def and docs/dev/reference/upscalers.md still say the HUD-less copy and learned layer are used by default without that exception. Update both descriptions so developers can correctly interpret an A/B run.
@ -1489,3 +1492,1 @@hud.layered = hud_layer(cmd, x0, y0, w, h);// (this frame's pictures are the next one's frame before; the next copies go into the other pair)hud.prev = true;hud.layered = hudless_wanted(pq) && hud_layer(cmd, x0, y0, w, h);L3 (minor): The reported RX 9070 XT, FSR 4 Native AA and HDR setup has not been checked visually. Compare main and this head during Market motion, including translucent edges and HUD visibility, to establish that the reported color flicker is fixed and assess the retained background.
@ -1550,3 +1553,3 @@in.color = fg.frames[cur].view;in.color_image = fg.frames[cur].image;const bool hudless = hudless_wanted();const bool hudless = hudless_wanted(native_pq);L4 (minor): The changed frame-generation path has not been checked in gameplay on Linux NVIDIA, AMD RADV or an HDR-capable Steam Deck. Exercise Native HDR where available, SDR HUD visibility, and the transition back to Expanded HDR or SDR; compare the visible HUD and translucent edges.
@ -335,0 +392,4 @@def pixel_fixture():# Use the actual mask expression and the patched FSR shader that consumes it.shader = (ROOT / "gpu/vk/shaders/fg_hud.comp").read_text(encoding="utf-8")alpha = re.search(r"imageStore\(dst, g, vec4\(shown, (.*?)\)\);", shader)[1]L2 (minor): The new pixel fixture reads the shader and shader patches from ROOT even when --source selects another checkout for the production C++ code. Comparing a different source tree can therefore pass using this checkout’s mask and FSR rules rather than those being tested. Pass the selected source directory into pixel_fixture and read both files from it.
@fix
0faee4149dda3928c97bRecommendation: Approve. The code is ready: only testing is left. The regression fixture and Windows runs support the routing change, but the reported AMD setup and affected Linux systems still need visual gameplay checks. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
da3928c97b. I rebased it ontomain(dd5ffe6a29). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
Native HDR frame generation uses presented PQ pixels for marked HUD pixels instead of fitting a layer from linear captures. This avoids mixing color encodings, at the cost of retaining some source-frame background at translucent HUD edges.
Before merging: testing (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_framegen.cpp:1492: The reported RX 9070 XT, FSR 4 Native AA and HDR setup has not been checked visually. Compare main and this head during Market motion, including translucent edges and HUD visibility, to establish that the reported color flicker is fixed and assess the retained background.gpu/vk/vk_framegen.cpp:1555: The changed frame-generation path has not been checked in gameplay on Linux NVIDIA, AMD RADV or an HDR-capable Steam Deck. Exercise Native HDR where available, SDR HUD visibility, and the transition back to Expanded HDR or SDR; compare the visible HUD and translucent edges.Checks: they run again on this head (
Guide screenshots / Guide images and local UI source review (pull_request),CI / Website build and checks (pull_request)failed on the last one); a failure shows on the pull request.Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven for the reported visual bug. The source-backed regression reportedly fails on main and passes on the PR; matched Windows RTX 4070 runs recorded 600 HUD-marked frames in each settled Native HDR sample, with learned-layer use falling from 600 to 0. The original RX 9070 XT and FSR 4 setup has not been checked visually.
Other systems: SDR and Expanded HDR retain the learned layer, and the Windows run reports 600 learned-layer presents after returning to Expanded HDR. Linux NVIDIA, AMD RADV and an HDR-capable Steam Deck still need gameplay coverage, including HUD visibility and transitions.
Switches: RX_VK_FSR_FG_HUDLESS and RX_VK_FSR_FG_HUD_LAYER remain on by default; Native HDR now bypasses their learned-layer behavior when a HUD copy is available. Their descriptions and the upscaler reference document the exception.
Reviewed:
da3928c97bagainstdd5ffe6a29: Read the repository rules and PR template, the HUD fixture and relevant frame-generation code, switch descriptions and upscaler reference. Skimmed the base-to-head diff and commits; the diff also includes intervening main-branch changes. Did not read every changed file in full. The referenced Tooling rules were not available in the checkout.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports the game-free regression and Windows renderer build passed; CI has not yet run on this head.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: fix(vk): preserve Native HDR HUD colors in FSR frame generationto fix(vk): preserve Native HDR HUD colors in FSR frame generation