WIP: fix(vk): say why HDR stays SDR when Windows has HDR on #424
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!424
Loading…
Reference in a new issue
No description provided.
Delete branch "Jiro113/Longshot:fix/correctif-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?
Why
With HDR on in the menu and no HDR picture, the log asks "is HDR on in the display settings?" even when Windows has HDR on, which sends the player to a setting that is already right. That happened on an RTX 4090: Windows was in HDR, but NVIDIA's Vulkan driver listed no HDR10 surface until the same driver was reinstalled clean.
What changed
create_swapchainingpu/vk/vk_main.cppstill takes an HDR10 surface when one is listed and the SDR one otherwise; what changes is the word on why it is SDR. It setsdev.hdr_sdr_why(HdrSdrWhyingpu/vk/vk_internal.h): noVK_EXT_swapchain_colorspace, HDR off in Windows, HDR on in Windows but none from the driver, or not known. Thevk: HDR:line names the display asked about and is said again when the reason or the display changes, or after the menu's HDR was turned off and on.system_hdr_oningpu/vk/vk_main.cppasks Windows whether HDR is on for the window's display (QueryDisplayConfig, then advanced colour info 2 of Windows 11 24H2, else the older one). It is called only when the menu's HDR is on and no HDR10 surface is listed. On Linux it answers "not known", which keeps the old question.hn_hdringpu/vk/vk_menu.cppadds the same reason, and what to do, under the HDR row's help when the picture stays SDR.docs/common-issues.md("Windows: HDR is on, but the game stays SDR") and a row in the README's troubleshooting table.tests/test_hdr_sdr_why.pycuts the HDR block ofcreate_swapchain,hn_hdrandsystem_hdr_onout of the source. It checks each reason's line and hint, holds the renderer's own copy of the 24H2 structure against the Windows SDK's, and prints what Windows answers for the desktop's display and the time a call takes.docs/tested/.Flags and settings
No new switch, option or ini key. One menu row changes:
Measurements
main:
5e072fc8(2026-11-14)this PR: fix/correctif-hdr @
c949795eHardware: RTX 4090 24 GB, NVIDIA 621.24 (clean install), Core i9-13900K, 64 GB, Windows 11 Home (26300); a Samsung Odyssey G93SC, 5120x1440 at 120 Hz over HDMI
Scene: the intro (the logos), a 2560x720 window, HDR Off then Expanded, paper white 200 nits, peak 1000 nits
Method: a fix, so its measurement is the new game-free test on main's source and on this PR's, and the
vk: HDR:lines of two runs in the game (one with HDR on in Windows, one with it off). No fps is claimed; the test prints the time onesystem_hdr_oncall takes.How to reproduce:
python -I -B tests/test_hdr_sdr_why.pyon each side. In the game:python -I scripts/longshot_ctl.py launch <game folder>, thenoption set hdr 1andwait present --frames 120, and read thevk: HDR:lines of the run'slog.txt.5e072fc8c949795etests/test_hdr_sdr_why.py(this PR's test, on each side's source)(is HDR on in the display settings?)(read from the source)though Windows has HDR on for this display: the graphics driver offers the game none (a clean reinstall of the driver, then a restart: longshot.magicbean.dev/help)(the test; not seen in the game)system_hdr_on)vk: HDR: an HDR10 surface (format 64), said again after Off and Expandedvk: HDR: an HDR10 surface (format 64): the driver lists HDR10 all the same, so no SDR linetests/run_all.py --jobs 12The two runs in the game were made with the fix commit,
0b042eb3, before its rebase: the same patch on main0caf0618, as a renderer pack over a base at0caf0618. The rebase onto5e072fc8broughtgpu/vk/vk_temporal.cpp,gpu/vk/dlss_actor.h, the scene tone map pass and their tests, none of them a file this PR touches, so the lines still hold. After the rebase the renderer was built again from 0b042eb3's sources (adev_packs.pypack over a base at5e072fc8, 0 failed) and the checks run again; the two later commits add only the run records. The game was not run again.The 10 failures of this PR all fail on main @
5e072fc8too on this PC (some for a Python module it lacks, such aszstandard):test_bake_portability,test_bug_report,test_fpx_sticky,test_framegen_resources,test_lift_cache,test_module_ids,test_oot_state_tap,test_pad_layout,test_spawn_emit,test_tested_configurations. main was run from agit archivecopy, which adds two failures of its own that need a git checkout (the byte-compile of tracked files andtest_dev_packs).Testing
Tested: on the PC above.
gpu/vk/vk_internal.h,gpu/vk/vk_main.cppandgpu/vk/vk_menu.cpppass unchanged: none needed an update.c949795e.docs/tested/. run01, HDR on in Windows: the HDR10 line,HDR10 swapchain no: SDRwith the menu's HDR Off, and the HDR10 line said again with Expanded. run02, HDR off in Windows: the driver still lists an HDR10 surface and the game takes it.system_hdr_onon the real Windows in both states, through the test: 1 with HDR on, 0 with it off, the display named "Odyssey G93SC".Not tested:
system_hdr_onis(void)display; return -1;.Needs other testers:
vk: HDR: the display (<the monitor>) lists no HDR10 surface (HDR is off for this display in Windows' display settings): SDRin the log, the same reason under the HDR row's help (a screenshot), and the HDR10 line once Use HDR is on. A driver that lists HDR10 anyway, as NVIDIA's does here, is a result too (T-EWTV; a maintainer has to addtesting wantedbefore it can be claimed)python -I -B tests/run_all.py hdr_sdr_why, expecting it to pass (T-A3SJ; it waits for the same label)Screenshots
None yet. The change shows on screen only as the HDR row's help line when the picture stays SDR, which this PC cannot reach (Testing); T-EWTV asks for the screenshot.
Risk and rollback
Which surface the swapchain takes is unchanged, so the picture is the same as on main. What could go wrong is the word: a Windows that answers wrongly would give the wrong reason in the log and under the HDR row.
system_hdr_onruns only while the menu's HDR is on and no HDR10 surface is listed, at each swapchain (0.02 to 0.03 ms measured). There is no switch: reverting the commit is enough.Reviewer notes
create_swapchainandsystem_hdr_oningpu/vk/vk_main.cpp, thenhn_hdringpu/vk/vk_menu.cpp.AdvancedColorInfo2is the renderer's own copy of the Windows SDK'sDISPLAYCONFIG_GET_ADVANCED_COLOR_INFO_2(the toolchain's headers keep it behindNTDDI_VERSION): a layout and two numbers, held against the SDK's by static_asserts in the test.dev.hdr_sdr_whyis written bycreate_swapchainand read by the menu on the presenting thread both, asdev.hdris.Issues
None.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md; no appended row or assembled view).mainand passing here.🤖 Generated with Claude Code
Test request T-EWTV is open for the SDR lines and the HDR row's hint on a Windows PC with an AMD or Intel GPU and an HDR display: this PC's NVIDIA driver lists HDR10 whether HDR is on or off in Windows, so neither reason shows here. It needs the testing wanted label from a maintainer before it can be claimed.
Test request T-A3SJ is open for Linux: the build, and python -I -B tests/run_all.py hdr_sdr_why. The description names it and the Testing box is ticked now that both requests are open. Both T-EWTV and T-A3SJ wait for a maintainer to add the testing wanted label.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.