Add native HDR10/scRGB, flip-model VRR tearing, high-refresh modes, and DPI/resize handling #288

Closed
Vladimir-Human wants to merge 652 commits from upstream-pr/288 into main
Vladimir-Human commented 2026-11-27 13:43:00 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Vladimir-Human on 2026-11-27T13:43:00Z.


Summary

Adds three independently switchable native PC display capabilities — all defaulting to 0 (off) so SDR / 2-buffer / 60 Hz / baseline windowing stays the untouched control path for isolated A/B comparison:

  1. Native HDR10 ST.2084 PQ & scRGB (VICTORY_HDR=0|auto|hdr10|scrgb, default 0 = SDR control):

    • Probes IDXGIOutput6::GetDesc1() in crates/victory-gpu/src/display_output.rs for active HDR state, bit depth, luminance bounds, and primaries, returning accurate HDR capabilities (1 + 12-byte luminance info) or SDR (2) from crates/victory-hle/src/modules/display.rs.
    • Configures IDXGISwapChain4 for HDR10 PQ (R10G10B10A2_UNORM + G2084_NONE_P2020 + SetHDRMetaData(HDR10)) or extended-linear scRGB (R16G16B16A16_FLOAT + G10_NONE_P709) when opted in, skipping SetColorSpace1/SetHDRMetaData on SDR control.
    • Updates crates/victory-gpu/src/compose.rs so HDR highlights (> 1.0) are preserved uncrushed while compositing sRGB HUD/overlay planes scaled to VICTORY_HDR_PAPER_WHITE_NITS (default 200 nits, clamped [80, 1000]), with a dedicated UI_FORMAT PSO for Picture::Overlay and paired format/color-space validation (format_matches_color_space, Composer::format(), Composer::record() rejecting format/color-space mismatches with E_INVALIDARG).
  2. Flip-Model VRR Tearing, Waitable Latency & High-Refresh Modes (VICTORY_VRR=0|1, default 0 = baseline 2-buffer / 60 Hz):

    • Under VICTORY_VRR=0: preserves baseline 2-buffer swap chain (Flags == 0, no tearing/waitable), single 60 Hz mode in crates/victory-gpu/src/dxgi.rs, and SIXTIETH default pacing in crates/victory-gpu/src/frame.rs.
    • Under VICTORY_VRR=1: enumerates progressive high-refresh host modes (120/144/180/240 Hz), adopts the active host refresh interval, and enables 3-buffer flip-model swap chains with ALLOW_TEARING (DXGI_PRESENT_ALLOW_TEARING when sync_interval == 0 and windowed/borderless) and FRAME_LATENCY_WAITABLE_OBJECT (SetMaximumFrameLatency(1)), with per-option overrides (VICTORY_SWAP_BUFFERS, VICTORY_TEARING, VICTORY_WAITABLE_SWAP, VICTORY_VSYNC).
  3. Per-Monitor V2 DPI Awareness & Deferred Resize/Occlusion Handling (VICTORY_NATIVE_RESIZE=0|1, default 0 = baseline):

    • Gates Per-Monitor V2 DPI setup (ensure_dpi_awareness()), WM_SIZE / WM_DPICHANGED / WM_DISPLAYCHANGE tracking in host.rs and lifecycle.rs, and DXGI_STATUS_OCCLUDED PRESENT_TEST probing behind VICTORY_NATIVE_RESIZE=1.
    • Keeps safe non-zero resize checks, Host::drain_queue() before ResizeBuffers, and swap-chain buffer_count/swap_flags preservation active unconditionally.

Independent A/B Comparison Guide

Start from the default SDR baseline (all switches unset or 0), then enable one switch at a time on the same output and scene:

  • Control (SDR / baseline): VICTORY_HDR=0 VICTORY_VRR=0 VICTORY_NATIVE_RESIZE=0
  • HDR10 PQ vs SDR: VICTORY_HDR=hdr10 (optional VICTORY_HDR_PAPER_WHITE_NITS=200)
  • scRGB vs SDR: VICTORY_HDR=scrgb (optional VICTORY_HDR_PAPER_WHITE_NITS=200)
  • VRR / high-refresh only: VICTORY_VRR=1
  • DPI / deferred resize / occlusion only: VICTORY_NATIVE_RESIZE=1

Verification

  • cargo run --locked -p xtask -- policy (314 files ok) and cargo test --locked -p xtask (11/11)
  • cargo clippy -p victory-gpu -p victory-hle --all-targets --locked -- -D warnings (default and --all-features: 0 warnings)
  • Real GPU (VICTORY_D3D12_DEBUG=1, --test-threads=1, 0 D3D12/GBV errors):
    • victory-gpu default (26/26), --features diagnostics (32/32), VICTORY_VRR=1 VICTORY_NATIVE_RESIZE=1 (17/17), GBV (VICTORY_D3D12_GBV=1, 16/16)
    • victory-hle default (21/21) and --features diagnostics (21/21)
  • WARP (VICTORY_D3D12_WARP=1, --test-threads=1): --features diagnostics + VICTORY_D3D12_DEBUG=1 (32/32), CI parity without debug layer default (18/18) and --features diagnostics (19/19)
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5527642572 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/288). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T13:43:00Z. --- ## Summary Adds three independently switchable native PC display capabilities — all defaulting to `0` (off) so SDR / 2-buffer / 60 Hz / baseline windowing stays the untouched control path for isolated A/B comparison: 1. **Native HDR10 ST.2084 PQ & scRGB (`VICTORY_HDR=0|auto|hdr10|scrgb`, default `0` = SDR control):** - Probes `IDXGIOutput6::GetDesc1()` in `crates/victory-gpu/src/display_output.rs` for active HDR state, bit depth, luminance bounds, and primaries, returning accurate HDR capabilities (`1` + 12-byte luminance info) or SDR (`2`) from `crates/victory-hle/src/modules/display.rs`. - Configures `IDXGISwapChain4` for HDR10 PQ (`R10G10B10A2_UNORM` + `G2084_NONE_P2020` + `SetHDRMetaData(HDR10)`) or extended-linear scRGB (`R16G16B16A16_FLOAT` + `G10_NONE_P709`) when opted in, skipping `SetColorSpace1`/`SetHDRMetaData` on SDR control. - Updates `crates/victory-gpu/src/compose.rs` so HDR highlights (`> 1.0`) are preserved uncrushed while compositing sRGB HUD/overlay planes scaled to `VICTORY_HDR_PAPER_WHITE_NITS` (default `200` nits, clamped `[80, 1000]`), with a dedicated `UI_FORMAT` PSO for `Picture::Overlay` and paired format/color-space validation (`format_matches_color_space`, `Composer::format()`, `Composer::record()` rejecting format/color-space mismatches with `E_INVALIDARG`). 2. **Flip-Model VRR Tearing, Waitable Latency & High-Refresh Modes (`VICTORY_VRR=0|1`, default `0` = baseline 2-buffer / 60 Hz):** - Under `VICTORY_VRR=0`: preserves baseline 2-buffer swap chain (`Flags == 0`, no tearing/waitable), single 60 Hz mode in `crates/victory-gpu/src/dxgi.rs`, and `SIXTIETH` default pacing in `crates/victory-gpu/src/frame.rs`. - Under `VICTORY_VRR=1`: enumerates progressive high-refresh host modes (120/144/180/240 Hz), adopts the active host refresh interval, and enables 3-buffer flip-model swap chains with `ALLOW_TEARING` (`DXGI_PRESENT_ALLOW_TEARING` when `sync_interval == 0` and windowed/borderless) and `FRAME_LATENCY_WAITABLE_OBJECT` (`SetMaximumFrameLatency(1)`), with per-option overrides (`VICTORY_SWAP_BUFFERS`, `VICTORY_TEARING`, `VICTORY_WAITABLE_SWAP`, `VICTORY_VSYNC`). 3. **Per-Monitor V2 DPI Awareness & Deferred Resize/Occlusion Handling (`VICTORY_NATIVE_RESIZE=0|1`, default `0` = baseline):** - Gates Per-Monitor V2 DPI setup (`ensure_dpi_awareness()`), `WM_SIZE` / `WM_DPICHANGED` / `WM_DISPLAYCHANGE` tracking in `host.rs` and `lifecycle.rs`, and `DXGI_STATUS_OCCLUDED` `PRESENT_TEST` probing behind `VICTORY_NATIVE_RESIZE=1`. - Keeps safe non-zero resize checks, `Host::drain_queue()` before `ResizeBuffers`, and swap-chain `buffer_count`/`swap_flags` preservation active unconditionally. ## Independent A/B Comparison Guide Start from the default SDR baseline (all switches unset or `0`), then enable one switch at a time on the same output and scene: - **Control (SDR / baseline):** `VICTORY_HDR=0` `VICTORY_VRR=0` `VICTORY_NATIVE_RESIZE=0` - **HDR10 PQ vs SDR:** `VICTORY_HDR=hdr10` (optional `VICTORY_HDR_PAPER_WHITE_NITS=200`) - **scRGB vs SDR:** `VICTORY_HDR=scrgb` (optional `VICTORY_HDR_PAPER_WHITE_NITS=200`) - **VRR / high-refresh only:** `VICTORY_VRR=1` - **DPI / deferred resize / occlusion only:** `VICTORY_NATIVE_RESIZE=1` ## Verification - `cargo run --locked -p xtask -- policy` (`314 files ok`) and `cargo test --locked -p xtask` (`11/11`) - `cargo clippy -p victory-gpu -p victory-hle --all-targets --locked -- -D warnings` (default and `--all-features`: 0 warnings) - Real GPU (`VICTORY_D3D12_DEBUG=1`, `--test-threads=1`, 0 D3D12/GBV errors): - `victory-gpu` default (`26/26`), `--features diagnostics` (`32/32`), `VICTORY_VRR=1 VICTORY_NATIVE_RESIZE=1` (`17/17`), GBV (`VICTORY_D3D12_GBV=1`, `16/16`) - `victory-hle` default (`21/21`) and `--features diagnostics` (`21/21`) - WARP (`VICTORY_D3D12_WARP=1`, `--test-threads=1`): `--features diagnostics` + `VICTORY_D3D12_DEBUG=1` (`32/32`), CI parity without debug layer default (`18/18`) and `--features diagnostics` (`19/19`)
TaynanGT commented 2026-11-27 13:48:22 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:48:22Z.


@Vladimir-Human HDR tone mapping, VRR and resize each need a separate comparison. Start with SDR as the control, then check HDR10 or scRGB on the same output and scene, including the HUD and highlight detail. Keep the composer and swap-chain format checks paired with the display mode.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7219966132 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/288#issuecomment-7219966132). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T13:48:22Z. --- @Vladimir-Human HDR tone mapping, VRR and resize each need a separate comparison. Start with SDR as the control, then check HDR10 or scRGB on the same output and scene, including the HUD and highlight detail. Keep the composer and swap-chain format checks paired with the display mode.
Vladimir-Human commented 2026-11-27 14:25:24 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Vladimir-Human on 2026-11-27T14:25:24Z.


@TaynanGT Updated #288 (01f74b90, rebased cleanly onto main e45051af) so HDR, VRR, and native DPI/resize are each independently switchable and default to 0 (SDR / baseline control), with paired composer and swap-chain format checks:

Comparison Switch Default (0) Opted-in behavior
SDR control -> HDR10 / scRGB VICTORY_HDR 0 (SDR, skips HDR metadata/color-space changes) hdr10, scrgb, or auto; optional VICTORY_HDR_PAPER_WHITE_NITS=200 for HUD luminance
Baseline 60 Hz -> VRR / high-refresh VICTORY_VRR 0 (2-buffer swap chain, Flags == 0, 60 Hz mode/pacing) 1 (3-buffer flip-model, ALLOW_TEARING, waitable latency 1, progressive host refresh modes)
Baseline windowing -> DPI / resize / occlusion VICTORY_NATIVE_RESIZE 0 (baseline DPI/resize/occlusion behavior) 1 (Per-Monitor V2 DPI, deferred WM_SIZE/WM_DPICHANGED/WM_DISPLAYCHANGE, DXGI_STATUS_OCCLUDED PRESENT_TEST)

Paired composer / swap-chain format checks and test pointers:

  • display_output.rs: format_matches_color_space, independent_switches_default_off_and_toggle_without_crosstalk, plan_present_always_pairs_swap_format_with_color_space, swap_chain_tearing_waitable_resize_and_present_on_gpu (covers both baseline 2-buffer SDR control and 3-buffer VRR + HDR10/scRGB ResizeBuffers pairing).
  • compose.rs: Composer::format() + Composer::record() reject mismatched target RTV format or display color space with E_INVALIDARG (composer_rejects_mismatched_target_format_or_display_color_space), alongside HUD/highlight readbacks (hdr10_pq_preserves_peak_luminance_and_maps_paper_white_ui, hdr_scrgb_preserves_highlights_above_one_and_scales_paper_white_ui).
  • host.rs::present_planes: keeps p.color_space paired with the active swap-chain format (format_matches_color_space) and rebuilds p.composer whenever the swap format changes.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7220763549 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/288#issuecomment-7220763549). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T14:25:24Z. --- @TaynanGT Updated #288 (`01f74b90`, rebased cleanly onto `main` `e45051af`) so HDR, VRR, and native DPI/resize are each independently switchable and default to `0` (SDR / baseline control), with paired composer and swap-chain format checks: | Comparison | Switch | Default (`0`) | Opted-in behavior | | --- | --- | --- | --- | | SDR control -> HDR10 / scRGB | `VICTORY_HDR` | `0` (SDR, skips HDR metadata/color-space changes) | `hdr10`, `scrgb`, or `auto`; optional `VICTORY_HDR_PAPER_WHITE_NITS=200` for HUD luminance | | Baseline 60 Hz -> VRR / high-refresh | `VICTORY_VRR` | `0` (2-buffer swap chain, `Flags == 0`, 60 Hz mode/pacing) | `1` (3-buffer flip-model, `ALLOW_TEARING`, waitable latency 1, progressive host refresh modes) | | Baseline windowing -> DPI / resize / occlusion | `VICTORY_NATIVE_RESIZE` | `0` (baseline DPI/resize/occlusion behavior) | `1` (Per-Monitor V2 DPI, deferred `WM_SIZE`/`WM_DPICHANGED`/`WM_DISPLAYCHANGE`, `DXGI_STATUS_OCCLUDED` `PRESENT_TEST`) | Paired composer / swap-chain format checks and test pointers: - `display_output.rs`: `format_matches_color_space`, `independent_switches_default_off_and_toggle_without_crosstalk`, `plan_present_always_pairs_swap_format_with_color_space`, `swap_chain_tearing_waitable_resize_and_present_on_gpu` (covers both baseline 2-buffer SDR control and 3-buffer VRR + HDR10/scRGB `ResizeBuffers` pairing). - `compose.rs`: `Composer::format()` + `Composer::record()` reject mismatched target RTV format or display color space with `E_INVALIDARG` (`composer_rejects_mismatched_target_format_or_display_color_space`), alongside HUD/highlight readbacks (`hdr10_pq_preserves_peak_luminance_and_maps_paper_white_ui`, `hdr_scrgb_preserves_highlights_above_one_and_scales_paper_white_ui`). - `host.rs::present_planes`: keeps `p.color_space` paired with the active swap-chain format (`format_matches_color_space`) and rebuilds `p.composer` whenever the swap format changes.
TaynanGT commented 2026-11-27 14:38:55 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T14:38:55Z.


@Vladimir-Human The paired format checks cover the swap-chain and composer mismatch I was looking for. Start with HDR alone on the same display, using the same settled scene. Watch the highlight ramps and HUD brightness. VRR and resize can use their own runs.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7221048679 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/288#issuecomment-7221048679). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T14:38:55Z. --- @Vladimir-Human The paired format checks cover the swap-chain and composer mismatch I was looking for. Start with HDR alone on the same display, using the same settled scene. Watch the highlight ramps and HUD brightness. VRR and resize can use their own runs.
TaynanGT commented 2026-11-30 17:13:03 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:13:03Z.


main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285905204 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/288#issuecomment-7285905204). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:13:03Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

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
TaynanGT/Vice-Tay!288
No description provided.