feat(vk): FSR 3.1 on the chain keeps the game's native HDR highlights #2614
Open
unixman69 wants to merge 4 commits from
unixman69/feat/fsr3-chain-hdr into main
pull from: unixman69/feat/fsr3-chain-hdr
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2614
Loading…
Reference in a new issue
No description provided.
Delete branch "unixman69/feat/fsr3-chain-hdr"
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?
With HDR on Native, the temporal chain gives DLSS (#2243) and FSR 4 (#2342) the game's colour as linear light, past 1.
FSR 3.1 on the chain (#2305) still got it clamped at 1, so with FSR 3.1 every highlight stopped at the paper white. This
gives FSR 3.1 the same HDR colour. Its passes are already built for HDR colour (
FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT)and work out their own exposure, so no pass or shader changes: only the chain engine says it takes HDR.
What changed
vk_fsr3.cpp, the chain engine:chain_preparedecides HDR each frame frompresent_native_pq, as DLSS and FSR 4 do: what the game presents, notthe option.
RX_VK_FSR3_HDR=0keeps the clamped colour, for comparisons.chain_hdrtells the chain (TemporalEngine::hdr), so the chain's existing HDR prep/out pair runs for it: linearlight in (
kSquare, ceiling 16384), its picture taken back linear.reset), since the history kept was in the otherencoding. DLSS and FSR 4 get the same by making their feature or context again.
vk: fsr3 on the chain: HDR colour, linear (the game's native HDR)when it turns on.docs/development.md(RX_VK_FSR3_HDR=0), and a row indocs/tested-configurations.md.test_hdr_encode.pygetscheck_fsr3, besidecheck_dlssandcheck_fsr4: HDR decided frompresent_native_pq(notopts.hdr), the switch, the history reset, the engine's.hdr, and the passes built for HDRcolour. Removing the reset or the engine's
.hdreach fails it.Not changed:
chain_hdris false there, so the chain runs the same LDR passes as on main.RX_VK_FSR3_CHAIN=0) stays LDR.Testing
python -I -B tests/run_all.py: 449 passed, 2 failed, 21 skipped (Linux). The two failures fail on main too:test_env_on(HOS_FPS_LOGinhost/oot_high_fps.c) andtest_linux_saves_move.(HDR Native, paper white 110 nits = PQ code 132, peak 400). Host v2.1.0-main-local; renderer main
ef81aee7plus thisbranch. "Off" is
RX_VK_FSR3_HDR=0, which is what main does.Every HDR run logged
vk: fsr3 on the chain: HDR colour, linear (the game's native HDR)once, then drew FSR 3.1 onevery frame (600 of 600 per log line), with no device lost and no validation messages. The only fallback to the
network was one frame at the teleport (
no scene camera this frame), in every FSR 3.1 run, with or without this.Castle Town market at noon, the still frames' PQ codes (0-255 of the HDR10 window's 8-bit shot):
Off, every run stops at the same code, 147. With the change, the sunlit highlights go past it, towards the game's
own. The rest of the picture is the same: mean code 63.5 in both, and no colour shift side by side.
Kokiri Forest showed no difference: nearly all the pixels there above the paper white are Navi's, as bright with the
change as without it.
The Quality and off rows were measured on an earlier revision of this branch that also made FSR 3.1's luma history
RGBA16F (see below); with the history as it is here, 100% gave the same highlights (163, 162 against 163, 162).
Left out, a possible follow-up: FSR 3.1's luma history (
rw_luma_history, the luma instability pass) is RGBA8,because AMD's GLSL callbacks declare it
rgba8, so it holds luma up to 1 only. I tried an RGBA16F history (a patched copyof the callbacks header for
scripts/fsr3_shaders.py). It made no measurable difference to highlights or flicker in HDR,nor to flicker in SDR (5 alternated pairs, within run-to-run noise), so it isn't in this PR. If someone sees highlights
flicker with FSR 3.1 in HDR, that's where to look.
Not tested:
🤖 Generated with Claude Code
I merged this into current main by hand. The two conflicts are trivial. In docs/tested-configurations.md, rows were added at the top. In tests/test_hdr_encode.py, main already loosened the DLSS engine check to the "hdr" substring, so main's version can be kept and the regex dropped. With that, test_hdr_encode, test_fsr3_math, test_fsr3_shader_options, test_temporal_history and test_temporal_jitter all pass on Linux.
The change itself looks right. chain_prepare decides HDR from present_native_pq the same way DLSS and FSR 4 do, chain_hdr hands the chain its HDR prep/out pair, and a change of encoding resets the history (ai.reset = f.reset || c.hdr_changed). SDR and expanded-SDR HDR keep the LDR passes because chain_hdr is false there. The passes were already built with HDR_COLOR_INPUT=1, so no shader changes are needed. The PQ-code numbers from the Castle Town market are the measurement this needs.
Please rebase. Once it's rebased, I'd merge it.