feat(dlss): DLSS for the game's native HDR, given linear light #2243
Closed
j64esatxzdrhfg wants to merge 3 commits from
j64esatxzdrhfg/feat/dlss-native-hdr into main
pull from: j64esatxzdrhfg/feat/dlss-native-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!2243
Loading…
Reference in a new issue
No description provided.
Delete branch "j64esatxzdrhfg/feat/dlss-native-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 and DLSS as the upscaler, every highlight is cut at the paper white: DLSS's feature is made for LDR colour and the chain's inputs pass clamps the scene to 1 before DLSS sees it. The hole of light in the Deku Tree turns into a flat disc.
What changed
vk_dlss.cpp,vk_temporal.cpp/.h: whilepresent_native_pqsays the game presents its own PQ picture, DLSS's feature is made withIsHDR | AutoExposureand made again when that changes. The gate is the presented picture, not the option and an HDR10 swapchain; with Native picked and an SDR picture shown, the scene is LDR. The engine reports it throughTemporalEngine::hdr; FSR 4 has none and keeps the LDR pair.present_native_pqmoves out ofvk_replay.cpp's anonymous namespace for that.dlss_prep.comp'skSquare(constant 1) squares the square-root encoded scene into linear light, which NVIDIA documents forIsHDRand from whichAutoExposureworks out its exposure.kColorMax(constant 0) is 16384 in place of 1, well inside the colour image's RGBA16F.dlss_out.comp'skSquare(constant 0) is off for it: the network's picture is linear already and is written as it is, at the same output scale as the LDR pair.shaders/dlss_prep_comp_spv.h,dlss_out_comp_spv.h: glslang 16.6.0,--target-env vulkan1.3(the commandtests/test_dlss_actor.pychecks them with).RX_VK_DLSS_HDR=0keeps the LDR feature and the clamped colour with Native too, for comparisons (docs/development.md).test_hdr_encode.pychecks the two constants in each shader, the HDR pipelines and their specialization data, thattemporal_upscalebinds the HDR pair for an engine whosehdr()says so, and thatpreparekeys the feature onpresent_native_pq(and the switch), not on the option.Testing
d7a7306) with #1941, #1942 and this PR. Same spot, the Deku Tree's light shaft:RX_VK_DLSS_HDR=0, as on main, the brightest light was 328 nits, which is the paper white. The 99.9th percentile was 328.HDR colour, linear (the game's native HDR)when the feature is made.vk_dlss.cppcompiles with and without NGX; the touched files compile with the build's clang.tests/run_all.pywithhdr_encode,dlss_actor,dlss_checks,upscale_independent,framegen_resources,present_,temporal_history,status_lineandmenupass, exceptrecorder_syncandpresent_semaphores, which fail the same way on main (this PC's toolchain).Not tested: other NVIDIA generations, DLAA with Native, displays with another peak.
Screenshots (Native at 100%, DLSS Balanced; HDR10 captures tone-mapped to SDR for this page, paper white to white, highlights rolled off up to 800 nits)
RX_VK_DLSS_HDR=0, as on main): 328 nits at mostThe hole of light at full size, before and after:
🤖 Generated with Claude Code
I think this one is already merged, by another route. #2342 (FSR 4 for the game's native HDR) was stacked on this PR, and its squash merge,
a0dfd28bon main (11 Nov), carried the whole stack: #1941, #1942 and this commit. I checked at this PR's head against main:dlss_prep,dlss_out,hdr_encode,fg_scale, the newfg_scale_pq_comp_spv.h) andvk_temporal.hare byte-identical on main;vk_dlss.cpp,vk_temporal.cpp,vk_replay.cppandvk_framegen.cppare exactly the onesa0dfd28bmade;tests/test_hdr_encode.pydiffers only by #2342's owncheck_fsr4additions;RX_VK_DLSS_HDR=0and thepresent_native_pqgate inprepareare on main (gpu/vk/vk_dlss.cpp:308-310).That is also why GitHub shows conflicts in
vk_replay.cpp,docs/development.mdandtests/test_hdr_encode.py: main has the same lines plus what came after. Unless there is something in this branch I missed that isn't ina0dfd28b, this PR can be closed as merged through #2342, and #1941 and #1942 probably too (worth a quick check of each before closing). If a follow-up is still needed, a fresh branch from main is easier than rebasing this stack.One note for the changelog: the release notes take their line from the squash title, so the DLSS part shipped under
feat(fsr4): .... If DLSS for native HDR should appear in the release notes, it needs a line added there by hand.This looks already merged: #2342's squash (
a0dfd28b) shipped it. All nine shader and SPIR-V header files andvk_temporal.hare identical to main, and a test merge leaves no difference in the files that merged cleanly. I think this can be closed. Since it went out under afeat(fsr4)title, DLSS with native HDR probably needs a hand-written line in the next release notes.This now conflicts with main in
docs/development.md,gpu/vk/shaders/dlss_prep.comp,gpu/vk/shaders/dlss_prep_comp_spv.h,gpu/vk/vk_menu.cpp,gpu/vk/vk_menu.h,gpu/vk/vk_replay.cpp,gpu/vk/vk_temporal.cpp,gpu/vk/vk_temporal.h,tests/test_hdr_encode.py. Could you merge main into the branch (or rebase) when you get a chance? I'll take another look once it's up to date.Closing as landed: #2342's squash merge (
a0dfd28) carried this commit,RX_VK_DLSS_HDRincluded. Thanks @Joey-Magnus for checking. Agreed on the release notes: since it went out under afeat(fsr4)title, "DLSS with Native HDR gets the game's HDR colour as linear light (highlights no longer clipped at the paper white)" deserves its own line.