HDR10 output on HDR displays (F1: HDR) #1727

Open
paales wants to merge 12 commits from upstream-pr/1727 into main
paales commented 2026-11-28 23:46:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by paales on 2026-11-28T23:46:10Z.


Written by 🤖:

What it changes

The title asks for HDR with XDisplayTryEnableHdrMode. On main the layer answers "disabled", and the title renders SDR.

With HDR on in Windows for the primary display (the F1 item HDR (NEEDS HDR IN WINDOWS) is ON by default; OFF or VICTORY_HDR=0 turns it off):

  • XDisplayTryEnableHdrMode returns enabled, with the minimum, peak and full-frame luminance of the display from IDXGIOutput6::GetDesc1.
  • The swap chain is R10G10B10A2_UNORM in DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020.
  • The composer reads the DXGI colour space of each plane from the PresentX plane parameters and writes HDR10. Frames with one plane also go through the composer.
  • In HDR the title presents its interface as the first plane (3840x2160 R8G8B8A8_UNORM, sRGB) and its scene as the second plane (2560x1440 R10G10B10A2_UNORM, HDR10). The composer puts the HDR10 plane at the bottom. The output takes the size of the HDR10 scene plane, the picture size that is set, and the composer scales the interface plane into it.
  • SDR planes, the F1 menu, the F3 panel and the notices are at paper white: VICTORY_HDR_PAPER_WHITE, else the SDR content brightness that Windows has for the primary display (DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL), else 203 nits. The layer reads it once at the start and logs where it came from.
  • A fallback in present_placed presents again only when it drops an interface plane. With HDR the composer draws frames with one plane too, so a second present without an interface plane would go to the composer again.
  • The F1 item is the first of the layer's switches, with its help lines, and it applies at once. A change makes the layer suspend and resume the title as the console does: at the resume the title asks for HDR again and gets the new answer. The title keeps the planes it chose at its start, so with HDR off after HDR the composer converts the HDR10 plane to SDR (luminance as it is up to 0.75 of paper white, rolled off above, written with the sRGB curve that Windows in HDR reads SDR swap chains with), and the swap chain goes back to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709. The title's own HDR or SDR picture follows at its next start.
  • With HDR10 output, DLSS and FSR 3 frame generation get the HDR10 scene plane as the colour without the interface (BUFFER_HUDLESS_COLOR): it has the back buffer's size and format. The interface and the layer's overlays stay in place in generated frames. With SDR output after HDR they get no interface tags.

With HDR off in Windows, or with VICTORY_HDR=0, the output does not change.

How it was tested

  • GPU and profile: RTX 5070 Ti, Windows 11, Series X, 2560x1440, DLSS Quality, DLSS frame generation 2X, ray tracing off. ASUS display with HDR on in Windows, 1250 nits peak.
  • Before: SDR. The log shows HDR mode: disabled (SDR presentation).
  • After: the picture is correct on the HDR display. The interface, the F1 menu and the FPS line are at paper white. DLSS frame generation shows its frames in HDR.
    HDR mode: enabled (HDR10 presentation) preference=0 min=0.0 max=1250.0 full_frame=1250.0
    HDR: the swap chain's colour space (12: HDR10; support 1: presentable) space=12 support=1 set=Ok(())
    HDR: the planes' formats, DXGI colour spaces and sizes (second format 0: one plane) first_format=28 first_space=0 first_size=[3840, 2160] second_format=24 second_space=12 second_size=Some([2560, 1440])
    
  • On main at 829188e merged in: the same log lines, and DLSS frame generation shows its frames. With the Windows slider at 212 nits: HDR: paper white nits=212.0 from="the SDR content brightness in Windows".
  • In HDR the output is 2560x1440 (presenting to a window width=2560 height=1440 format=24), and the F1 menu stays in place with DLSS frame generation.
  • The F1 item in the world: HDR off gives a correct SDR picture with the dark tones of the HDR picture, HDR on gives the HDR picture again. Each switch stops the title for less than a second:
    HDR asked for: the title asks again on=false
    suspending and resuming the title, so it asks for HDR again constrained=1 routines=2
    HDR mode: disabled (SDR presentation; VICTORY_HDR=1 with HDR on in Windows: HDR10) preference=0
    title resumed suspended=true
    HDR: the swap chain's colour space (12: HDR10; support 1: presentable) space=0 support=1 set=Ok(())
    
  • Not tested: FSR 3 frame generation, HDR on from the F1 item after a start in SDR, Series S, HDR on a display other than the primary display.
  • For shader changes, the wave sizes tested: no translator change.
  • cargo test passed for the crates it touches: yes, the tests of host::menu (with --test-threads=1), host::panel, queue and display. The display tests that check the SDR answer set VICTORY_HDR=0, as the PC that runs them can show HDR.
  • cargo clippy --workspace --all-targets: no warnings in the changed lines. With --all-features, main does not compile at 829188e (host.rs, SubmissionTiming).
  • With main up to 41adb551 merged in: cargo test -p victory-gpu --lib for host::menu, host::panel and queue (--test-threads=1) and the HDR tests, and cargo test -p victory-hle --lib display: passed.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1470, #1668 and #1265 (in main). The branch has main up to 41adb551 merged in.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545746721 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1727). Originally posted by [paales](https://github.com/paales) on 2026-11-28T23:46:10Z. --- _Written by 🤖:_ ## What it changes The title asks for HDR with `XDisplayTryEnableHdrMode`. On main the layer answers "disabled", and the title renders SDR. With HDR on in Windows for the primary display (the F1 item `HDR (NEEDS HDR IN WINDOWS)` is ON by default; OFF or `VICTORY_HDR=0` turns it off): - `XDisplayTryEnableHdrMode` returns enabled, with the minimum, peak and full-frame luminance of the display from `IDXGIOutput6::GetDesc1`. - The swap chain is `R10G10B10A2_UNORM` in `DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020`. - The composer reads the DXGI colour space of each plane from the PresentX plane parameters and writes HDR10. Frames with one plane also go through the composer. - In HDR the title presents its interface as the first plane (3840x2160 `R8G8B8A8_UNORM`, sRGB) and its scene as the second plane (2560x1440 `R10G10B10A2_UNORM`, HDR10). The composer puts the HDR10 plane at the bottom. The output takes the size of the HDR10 scene plane, the picture size that is set, and the composer scales the interface plane into it. - SDR planes, the F1 menu, the F3 panel and the notices are at paper white: `VICTORY_HDR_PAPER_WHITE`, else the SDR content brightness that Windows has for the primary display (`DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL`), else 203 nits. The layer reads it once at the start and logs where it came from. - A fallback in `present_placed` presents again only when it drops an interface plane. With HDR the composer draws frames with one plane too, so a second present without an interface plane would go to the composer again. - The F1 item is the first of the layer's switches, with its help lines, and it applies at once. A change makes the layer suspend and resume the title as the console does: at the resume the title asks for HDR again and gets the new answer. The title keeps the planes it chose at its start, so with HDR off after HDR the composer converts the HDR10 plane to SDR (luminance as it is up to 0.75 of paper white, rolled off above, written with the sRGB curve that Windows in HDR reads SDR swap chains with), and the swap chain goes back to `DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709`. The title's own HDR or SDR picture follows at its next start. - With HDR10 output, DLSS and FSR 3 frame generation get the HDR10 scene plane as the colour without the interface (`BUFFER_HUDLESS_COLOR`): it has the back buffer's size and format. The interface and the layer's overlays stay in place in generated frames. With SDR output after HDR they get no interface tags. With HDR off in Windows, or with `VICTORY_HDR=0`, the output does not change. ## How it was tested - GPU and profile: RTX 5070 Ti, Windows 11, Series X, 2560x1440, DLSS Quality, DLSS frame generation 2X, ray tracing off. ASUS display with HDR on in Windows, 1250 nits peak. - Before: SDR. The log shows `HDR mode: disabled (SDR presentation)`. - After: the picture is correct on the HDR display. The interface, the F1 menu and the FPS line are at paper white. DLSS frame generation shows its frames in HDR. ``` HDR mode: enabled (HDR10 presentation) preference=0 min=0.0 max=1250.0 full_frame=1250.0 HDR: the swap chain's colour space (12: HDR10; support 1: presentable) space=12 support=1 set=Ok(()) HDR: the planes' formats, DXGI colour spaces and sizes (second format 0: one plane) first_format=28 first_space=0 first_size=[3840, 2160] second_format=24 second_space=12 second_size=Some([2560, 1440]) ``` - On main at 829188e merged in: the same log lines, and DLSS frame generation shows its frames. With the Windows slider at 212 nits: `HDR: paper white nits=212.0 from="the SDR content brightness in Windows"`. - In HDR the output is 2560x1440 (`presenting to a window width=2560 height=1440 format=24`), and the F1 menu stays in place with DLSS frame generation. - The F1 item in the world: HDR off gives a correct SDR picture with the dark tones of the HDR picture, HDR on gives the HDR picture again. Each switch stops the title for less than a second: ``` HDR asked for: the title asks again on=false suspending and resuming the title, so it asks for HDR again constrained=1 routines=2 HDR mode: disabled (SDR presentation; VICTORY_HDR=1 with HDR on in Windows: HDR10) preference=0 title resumed suspended=true HDR: the swap chain's colour space (12: HDR10; support 1: presentable) space=0 support=1 set=Ok(()) ``` - Not tested: FSR 3 frame generation, HDR on from the F1 item after a start in SDR, Series S, HDR on a display other than the primary display. - For shader changes, the wave sizes tested: no translator change. - `cargo test` passed for the crates it touches: yes, the tests of `host::menu` (with `--test-threads=1`), `host::panel`, `queue` and `display`. The `display` tests that check the SDR answer set `VICTORY_HDR=0`, as the PC that runs them can show HDR. - `cargo clippy --workspace --all-targets`: no warnings in the changed lines. With `--all-features`, main does not compile at 829188e (`host.rs`, `SubmissionTiming`). - With main up to 41adb551 merged in: `cargo test -p victory-gpu --lib` for `host::menu`, `host::panel` and `queue` (`--test-threads=1`) and the HDR tests, and `cargo test -p victory-hle --lib display`: passed. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1470, #1668 and #1265 (in main). The branch has main up to 41adb551 merged in.
barrenechea commented 2026-11-28 23:59:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by barrenechea on 2026-11-28T23:59:15Z.


@trustno1-code please consider this one!

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7247794100 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1727#issuecomment-7247794100). Originally posted by [barrenechea](https://github.com/barrenechea) on 2026-11-28T23:59:15Z. --- @trustno1-code please consider this one!
falc410 commented 2026-12-01 00:08:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by falc410 on 2026-12-01T00:08:55Z.


tested it locally and looks great! wish there was an upvote mechanic.

@paales I had my local AI help me with the merge conflicts. Leaving the info here for anyone else running into this problem. Below is written by Qwen3.8-Flash-Next

Merged onto today's main and played: three conflicts, all of them keep both sides

I merged this branch into 7d93ee07 (today's main) as 2f7a2cde, built it with cargo build --release --locked -p victory and played it.

Setup: RTX 5070 Ti, Windows 11, Series X, 2560x1440 ultrawide, DLSS Quality with DLSS frame generation 2x, HDR on in Windows.

The merge conflicts: git merge --no-commit --no-ff <this branch> on 7d93ee07 leaves exactly three, with the markers at crates/victory-gpu/src/host.rs:15228, host.rs:16849 and crates/victory-hle/src/modules/lifecycle.rs:171. In the first two both sides can simply be kept; main had moved underneath.

1. host.rs:15228, where fn colour_space is added. main put its new mod present_aside { ... } (588 lines) at exactly that spot, and the single } after the conflict block closes that module on main's side. Keeping only one } there leaves the module open and the file does not parse, so the module closes first and this function follows it:

    }
}
}

/// HDR10 on the 10-bit swap chain while the title renders HDR, and SDR again
/// once it renders SDR.
fn colour_space(swap_chain: &IDXGISwapChain3, format: DXGI_FORMAT) {

2. host.rs:16849, in the presenter. main inserted its present_aside wait in front of the composer rebuild check this PR extends. Keep both, with the new output() comparison inside main's is_none_or:

    // The present handed to its own thread has returned before the swap chain is touched again.
    if present_aside::on() && present_aside::wait() {
        p.presents_tearing = false;
    }
    if planes.is_some()
        && p.composer
            .as_ref()
            .is_none_or(|c| c.format() != format || c.output() != crate::hdr::output())
    {

3. lifecycle.rs:171, the only place that needs new code. suspend_and_resume calls routines() and constrained(), which main replaced with the ROUTINES and CONSTRAINED statics. The registration:

    #[cfg(windows)]
    victory_gpu::hdr::on_ask_again(suspend_and_resume);
    ROUTINES.register(routine, context, registration)

and this is what the middle of the helper becomes against main's API (one at a time, suspend with a deadline, then resume with the title's routines first):

    static BUSY: Mutex<()> = Mutex::new(());
    let Ok(_busy) = BUSY.try_lock() else { return };
    let (done, waited) = std::sync::mpsc::channel();
    std::thread::spawn(move || {
        constrain_then_suspend(&CONSTRAINED, &ROUTINES);
        let _ = done.send(());
    });
    let suspended = waited.recv_timeout(SUSPEND_DEADLINE * 5).is_ok();
    ROUTINES.notify(0);
    CONSTRAINED.notify(0);

Checked the way CI does, on that merge onto 7d93ee07: cargo clippy --workspace --all-targets --locked -- -D warnings is clean and cargo test --workspace --locked passes (victory-gpu alone: 1133 passed, 0 failed). I did not see a CI run for this PR, so those are hand runs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7295987137 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1727#issuecomment-7295987137). Originally posted by [falc410](https://github.com/falc410) on 2026-12-01T00:08:55Z. --- tested it locally and looks great! wish there was an upvote mechanic. @paales I had my local AI help me with the merge conflicts. Leaving the info here for anyone else running into this problem. Below is written by Qwen3.8-Flash-Next **Merged onto today's main and played: three conflicts, all of them keep both sides** I merged this branch into `7d93ee07` (today's main) as `2f7a2cde`, built it with `cargo build --release --locked -p victory` and played it. Setup: RTX 5070 Ti, Windows 11, Series X, 2560x1440 ultrawide, DLSS Quality with DLSS frame generation 2x, HDR on in Windows. The merge conflicts: `git merge --no-commit --no-ff <this branch>` on `7d93ee07` leaves exactly three, with the markers at `crates/victory-gpu/src/host.rs:15228`, `host.rs:16849` and `crates/victory-hle/src/modules/lifecycle.rs:171`. In the first two both sides can simply be kept; main had moved underneath. **1. `host.rs:15228`, where `fn colour_space` is added.** main put its new `mod present_aside { ... }` (588 lines) at exactly that spot, and the single `}` after the conflict block closes *that module* on main's side. Keeping only one `}` there leaves the module open and the file does not parse, so the module closes first and this function follows it: } } } /// HDR10 on the 10-bit swap chain while the title renders HDR, and SDR again /// once it renders SDR. fn colour_space(swap_chain: &IDXGISwapChain3, format: DXGI_FORMAT) { **2. `host.rs:16849`, in the presenter.** main inserted its `present_aside` wait in front of the composer rebuild check this PR extends. Keep both, with the new `output()` comparison inside main's `is_none_or`: // The present handed to its own thread has returned before the swap chain is touched again. if present_aside::on() && present_aside::wait() { p.presents_tearing = false; } if planes.is_some() && p.composer .as_ref() .is_none_or(|c| c.format() != format || c.output() != crate::hdr::output()) { **3. `lifecycle.rs:171`, the only place that needs new code.** `suspend_and_resume` calls `routines()` and `constrained()`, which main replaced with the `ROUTINES` and `CONSTRAINED` statics. The registration: #[cfg(windows)] victory_gpu::hdr::on_ask_again(suspend_and_resume); ROUTINES.register(routine, context, registration) and this is what the middle of the helper becomes against main's API (one at a time, suspend with a deadline, then resume with the title's routines first): static BUSY: Mutex<()> = Mutex::new(()); let Ok(_busy) = BUSY.try_lock() else { return }; let (done, waited) = std::sync::mpsc::channel(); std::thread::spawn(move || { constrain_then_suspend(&CONSTRAINED, &ROUTINES); let _ = done.send(()); }); let suspended = waited.recv_timeout(SUSPEND_DEADLINE * 5).is_ok(); ROUTINES.notify(0); CONSTRAINED.notify(0); Checked the way CI does, on that merge onto `7d93ee07`: `cargo clippy --workspace --all-targets --locked -- -D warnings` is clean and `cargo test --workspace --locked` passes (victory-gpu alone: 1133 passed, 0 failed). I did not see a CI run for this PR, so those are hand runs.
paales commented 2026-12-01 02:57:03 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by paales on 2026-12-01T02:57:03Z.


Written by 🤖:

main 5fabb46e is merged into this branch (3b5f5580). Four conflicts, both sides kept in each:

  • host.rs: main's present_aside module closes first, then colour_space follows; the wait for the present handed to its thread comes before the composer check, which also compares the HDR output.
  • lifecycle.rs: RegisterAppStateChangeNotification registers through ROUTINES; suspend_and_resume suspends and resumes through ROUTINES and CONSTRAINED.
  • font.rs, menu.rs: the HDR white and the F1 HDR item on main's lines.

Checked on an RTX 5070 Ti in HDR full screen: the swap chain is in colour space 12 (HDR10), paper white 212 nits from the Windows SDR content brightness, the HDR10 scene plane under the 3840x2160 interface plane, the picture right. Local clippy reports 5 errors in lines that main has too (font.rs text, menu.rs:674, panel.rs:602 and :668); the merge adds none.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299161851 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1727#issuecomment-7299161851). Originally posted by [paales](https://github.com/paales) on 2026-12-01T02:57:03Z. --- _Written by 🤖:_ `main` 5fabb46e is merged into this branch (3b5f5580). Four conflicts, both sides kept in each: - `host.rs`: main's `present_aside` module closes first, then `colour_space` follows; the wait for the present handed to its thread comes before the composer check, which also compares the HDR output. - `lifecycle.rs`: `RegisterAppStateChangeNotification` registers through `ROUTINES`; `suspend_and_resume` suspends and resumes through `ROUTINES` and `CONSTRAINED`. - `font.rs`, `menu.rs`: the HDR white and the F1 HDR item on main's lines. Checked on an RTX 5070 Ti in HDR full screen: the swap chain is in colour space 12 (HDR10), paper white 212 nits from the Windows SDR content brightness, the HDR10 scene plane under the 3840x2160 interface plane, the picture right. Local clippy reports 5 errors in lines that `main` has too (`font.rs` `text`, `menu.rs:674`, `panel.rs:602` and `:668`); the merge adds none.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1727:upstream-pr/1727'
git switch 'upstream-pr/1727'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1727'
git switch 'upstream-pr/1727'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1727'
git switch 'upstream-pr/1727'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1727'
git switch 'main'
git merge --squash 'upstream-pr/1727'
git switch 'main'
git merge --ff-only 'upstream-pr/1727'
git switch 'main'
git merge 'upstream-pr/1727'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1727
No description provided.