fix(hdr): read the peak luminance by one rule in the title and the swap chain #427
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!427
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-427"
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?
@Luxuride on GitHub · 2026-12-04 02:21 UTC · original
Luxuride:fix/hdr-nits-peak→main· +15 −5 · 2 files · 1 commits · merged 2026-12-04 04:23 UTCWhat is wrong
VICTORY_HDR_NITSis parsed twice, by two different rules, and both results are used as if they were the same number.Title side,
crates/victory-hle/src/modules/display.rs:66-83:Swap chain side,
crates/victory-gpu/src/host.rs:7639-7646:hle's own doc says the host presents HDR10 "the same variable". Two divergences:VICTORY_HDR_NITS=0(one character from the shipped default of 1000): the title is told a 0-nit peak and tone-maps to black, while the swap chain publishesMaxMasteringLuminance: 1000.VICTORY_HDR_NITS=1e40parses tof32::INFINITY: the title'sis_finiterejects it and tells 1000, while the swap chain accepts it and the float→int casts saturate to4294967295/65535inDXGI_HDR_METADATA_HDR10.Neither side says anything.
The change
One rule for a peak (finite, above 0 — a display has no 0-nit peak), keeping the minimum's own rule, since 0 is a real minimum:
and the swap chain side adds
is_finiteto its filter, so the metadata conversion can never saturate.Validation
Both files are Windows-only against a real HDR device, which this host does not have. The three closures were compiled verbatim and run side by side (
rustc -O):Before the change the
0and1e40rows disagreed.cargo check -p victory-hle --target x86_64-pc-windows-msvc --libandcargo check -p victory-gpu --target x86_64-pc-windows-msvc --lib: no errors, no new warnings.Overlap
An open PR owns both files for its HDR10 swap-chain work, but its diff contains no
VICTORY_HDR_NITS/hdr_nitschange — it is a conflict risk in the same function, not a fix for this. No issue mentions the variable.@Kal0s-design on GitHub · 2026-12-04 03:14 UTC · original
Checked on Windows 11 (MSVC). victory-hle tests pass (display ones included), the victory-gpu lib suite fails the same tests as main on one NVIDIA desktop card, and clippy has nothing new in either crate.
The 0 and inf cases are fixed as described. Two small things though.
The description says the metadata conversion can never saturate, but the u16 fields still can. Any finite value above 65535, say
VICTORY_HDR_NITS=70000, passes both filters, the title is told 70000, andMaxContentLightLevelandMaxFrameAverageLightLevelend up at 65535 whileMaxMasteringLuminancegets 70000. Clamping the peak to 10000 (the PQ ceiling) on both sides would close that. Values under 1 also truncate to 0 in the metadata, if you want a lower bound too.The new doc comment in display.rs says victory_gpu reads the same two variables, but the host only reads
VICTORY_HDR_NITS, notVICTORY_HDR_FULL_NITS.AI-assisted: yes