fix(hdr): Sharpness with HDR, and DLSS for the game's native HDR #1940
Closed
j64esatxzdrhfg wants to merge 1 commit from
fix/hdr-menu-sharpness-native into main
pull from: fix/hdr-menu-sharpness-native
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
1 participant
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!1940
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/hdr-menu-sharpness-native"
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, the picture goes black as soon as Sharpness, the Window scaling filter or ultrawide's menu sides are used, and with HDR on Native, DLSS clips every highlight at the paper white.
What changed
vk_framegen.cpp:framegen_scale's image is created withSAMPLEDusage. The HDR pass samples it throughframegen_scaled_view; without the flag it read black. (#1831 carries the same one-line fix as part of its series; whichever lands first, the other drops it.)vk_dlss.cpp,vk_temporal.cpp/.h: with Native HDR on an HDR10 swapchain, DLSS's feature is created withIsHDR | AutoExposureand recreated when that changes (TemporalEngine::hdr). The chain then runsdlss_prep.compwith its colour ceiling, the new specialization constantkColorMax(1 by default), at 16384. FSR 4 has nohdr()and keeps the clamped colour.shaders/dlss_prep_comp_spv.h: regenerated with glslang 16.6.0 (the version CI pins).vk_replay.cpp: one log line when the presented format or the HDR path changes, for HDR reports.test_hdr_encode.pychecks theSAMPLEDusage and the native-HDR DLSS path;upscale_independent_test.cppexpects the new usage.Testing
8c92fe3) with this series; earlier on v2.0.13.tests/run_all.py: the checks touching this pass. The ones failing here fail the same on untouched main (local toolchain:present_aspect_vulkan,fpx_sticky).Not tested: AMD/Intel GPUs, FSR 4 with Native HDR, Linux.
A question for review: DLSS gets the chain's existing (square-root encoded) colour with
IsHDR, not linear light. It looked right in game, but you may prefer linear input.Screenshots (HDR Expanded, Sharpness 100%; before the fix this picture was black)
HDR10 captures, tone-mapped to SDR for this page (paper white to white, highlights rolled off up to 800 nits).
🤖 Generated with Claude Code
Confirming the
scale.scaledpart of this on an RTX 5090, with the validation layer naming it.Setup: v2.0.14 release (source 3a9998c3), Windows 11 Pro 26200, RTX 5090 at driver 621.14, a single 3840x2160 HDR10 display, DLSS Quality.
Before: HDR Expanded gave a black picture and Native gave a flat one, with frame generation off or on, as in #1613. Run with
RX_VK_VALIDATION=1and the Khronos layer, the HDR pass reports:That's
scale.scaled(vk_framegen.cpp:518in v2.0.14), whichframegen_hdrsamples throughframegen_scaled_view(). With HDR on, the present always takes the scaled route.After: with only
VK_IMAGE_USAGE_SAMPLED_BITadded to thatmake_img(hookshot_vk.dllrebuilt from the v2.0.14 source), Expanded shows a correct picture, with frame generation off and at 3x. No other validation errors came from the present path. TheDenormFlushToZero/DenormPreserveones in the same log come from the translated game shaders.Native, as data for #1942 / #1941: I tried the same cause #1942 describes on v2.0.14 (Native also told by
vk_format(t->d.format), then the game's RGB10A2 picture copied bit for bit withvkCmdCopyImagewhen the sizes match). The log confirms that path is taken (format 0x3d, 3840x2160). The picture is right but looks almost the same as SDR. Changing HDR peak brightness from 1200 to 4000 nits made no visible difference, so the game's own grade seems to ignore the peak it gets fromQueryDisplayHdrStatus. Two notes on doing it that way:SetLayerNextHdr*Metadatacalls are still stubbed, so no content light levels reach the display.Thanks. The
SAMPLEDfix inframegen_scaleis correct and ready. It's the exact error @sling86 got from the validation layer on a 5090 (VUID-VkWriteDescriptorSet-descriptorType-00337onscale.scaled), and they saw the same one-flag change fix Expanded. The test changes cover it.The DLSS-for-Native half reads fine as code. The feature is made again when
feature_hdrflips. The seconddlss_preppipeline with the specialization constant is wired correctly (map entry 0/0/4, layout and push constants match).hdr()follows whatpreparemade in the same frame. FSR 4'skEnginestill compiles, sincehdrdefaults to null. I rebuiltdlss_prep_comp_spv.hwith glslang 16.6.0 (--target-env vulkan1.3) and it matches the PR byte for byte. Two things before I'd call that half done:IsHDRas linear radiance, andAutoExposureworks out its exposure from that signal. With the square-root encoding, DLSS's internal tonemap and auto exposure both see a compressed signal. That probably explains why it still looks fine, but it isn't what the network was trained on. In the HDR variant you could square indlss_prepand skip the square indlss_out(one more specialization constant on each), so DLSS gets linear light. That's not a blocker, but I'd lean towards linear. Details inline.Stacking: #1941 and #1942 carry this commit (
eea8875) as their first, so they'll rebase cleanly once this lands. #1831 carries the sameSAMPLEDline, as the description says. No CI ran on this branch (fork workflows not approved yet), so nothing is green or red here.The Sharpness fix alone could merge today. Whether the DLSS-Native part goes in as is, or waits for an in-game comparison, is @NotRexed's call.
@ -291,3 +296,4 @@else if (s.feature_hdr != hdr) snprintf(why, sizeof why, "the game's native HDR turned %s", hdr ? "on" : "off");else if (s.feature_ow != ow || s.feature_oh != oh)snprintf(why, sizeof why, "the output went from %ux%u to %ux%u", s.feature_ow, s.feature_oh, ow, oh);else if (s.feature_preset != preset)A small one: this gate is the option and the swapchain, not what the game actually presents. With Native picked but the game's picture not taking the PQ path (
present_native_pqfalse, the case #1942 is about), DLSS still gets anIsHDR | AutoExposurefeature fed LDR content. That's probably harmless, but it's a different network mode with its own exposure. Once #1942 settles how Native is detected, it may be worth keying this on the same test.On the linear-input question: with
IsHDR, NVIDIA expects linear scene colour, andAutoExposurereads exposure from it. This passes the square-root encoded value, so both see a compressed signal. AkSquareconstant indlss_prep(c*cfor the HDR pipeline) plus a matching one indlss_out(noc *= cafter) would hand DLSS linear light and give the same output scale. Not blocking.Closing this: the fix landed in main with #2038 (
0a28ff2), the sameSAMPLEDusage onscale.scaled. Thanks @sling86 for confirming it with the validation layer on the 5090, and @hckrman101 for the review.The DLSS-for-Native part will come as its own PR after an in-game comparison. As reviewed, it gives DLSS linear input and is gated on the format the game presents. #1941 and #1942 are rebased straight onto main without this commit.