GPU: diagnostic 1440p present fallback for 4K primaries (#841) #2439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2441"
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?
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T13:34:29Z.
Refs #841.
Summary
In the prologue and world rendering of GTA VI, the title renders 3D geometry into internal
2560x1440color render targets (f28/f29/f87/f91), but its final upscale/FSR pass to3840x2160fails or remains unwritten, causing the swapchain to present an all-black image while thousands of draws are actively recorded and executed.This PR adds an opt-in
VICTORY_PRESENT_1440P=1diagnostic fallback (derived from community investigation by @mpDom and @MichaelSmithAI in #841):crates/victory-gpu/src/draw.rs,host.rs): Tracks eligible2560x1440color targets during render-target (apply_targets) and UAV writes (readable).crates/victory-gpu/src/host.rs): Publishes the latest candidate target only after the submitting command list's GPU fence has completed on hardware (self.fence.GetCompletedValue() >= submitted).crates/victory-gpu/src/queue.rs): Substitutes plane 0 at present time when primary extent is3840x2160and differs from candidate (is_candidate_4k_primary). Preserves smaller primaries and retained overlays.Tested on native Windows 10 x64 + NVIDIA GeForce RTX 5060:
cargo test -p victory-gpu --features diagnosticspassed.cargo clippy -p victory-gpu --features diagnostics -- -D warningsclean (zero warnings).cargo run -p xtask -- policyclean.Co-authored-by: mpDom [email protected]
Co-authored-by: MichaelSmithAI [email protected]
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T13:58:26Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090:#841) builds cleanly under both default anddiagnosticsfeature configurations.cargo test -p victory-gpu queue::tests: 4/4 passed.cargo test -p victory-gpu --features diagnostics capture::tests: 2/2 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings(both default and--features diagnostics): 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T14:00:51Z.
Thanks @DenRakEiw for testing on RTX 5090 across both default and diagnostics configurations and verifying clean queue and capture test suites! Ready for upstream merge.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:11:18Z.
Review: COMMENTED
Live 1440p present fallback when 4K primaries stay. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T14:27:44Z.
Reviewed — the gating is right for investigation tooling:
#[cfg(feature = "diagnostics")]plusVICTORY_PRESENT_1440Penv means normal builds and runs are untouched. The fallback is conservative on all three axes: only when the recorded work's fence completed (GetCompletedValue >= submitted), only for a true 3840x2160 primary that is not the candidate itself, and the candidate istake()n once per present. The state lookup uses the copy's own tracked state throughlegal_state, not the primary's — correct for a substitute.Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T14:28:47Z.
Thanks @kotekompotek for the thorough review and validating the conservative gating, fence check, and
legal_statetransition mechanics! Exactly what we aimed for to keep production builds zero-overhead while giving diagnostics a rock-solid visual present path.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T16:10:16Z.
Automated triage for the maintainers.
Needs work. Thanks for the rebase; it merges cleanly now and CI
checkpasses. Everything is behinddiagnosticsplusVICTORY_PRESENT_1440P, so normal builds are unchanged. Status of the earlier points at3c9cbae:Host::executeit runs afterWaitForSingleObject, so it only skips publishing when the wait itself failed.is_unwritten_4k: renamed tois_candidate_4k_primary(queue.rs), which matches what it does. Note that it swaps in the candidate for any 3840x2160 primary, written or not, so the PR title and body ("when 4K primaries stay unwritten") overstate it. Please reword them.present_fallback_uses_completed_work_once_and_only_at_4kreturns early without a GPU, so CI never runs it. Even on a GPU, its only checks are thattake_1440p_target()is empty afterpresent, and that would also hold if nothing had been published or substituted. A pure test of the gate would run everywhere: a 1440p candidate plus a 4K primary gives a swap, a smaller primary does not, and the candidate is used once. The two tests also callstd::env::set_varwhile other tests run in parallel, andpresent_1440p_oncaches its first answer in aOnceLock, so the outcome depends on which test runs first.note_1440p_target(host.rs) is mis-indented, there are double blank lines incapture.rs,host.rsandqueue.rs, andpresent_1440p_onhas an over-long line.cargo fmtfixes all of these.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T17:49:27Z.
Rebased cleanly onto
origin/main(13f91ca) resolving the conflict incrates/victory-gpu/src/queue.rs. Verified againstorigin/mainwith unit testpresent_fallback_uses_completed_work_once_and_only_at_4kpassing.[PR #2441] GPU: live 1440p present fallback when 4K primaries stay unwritten (fixes #841)to [PR #2441] GPU: live 1440p present fallback when 4K primaries stay unwritten (#841)[PR #2441] GPU: live 1440p present fallback when 4K primaries stay unwritten (#841)to [PR #2441] GPU: diagnostic 1440p present fallback for 4K primaries (#841)Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-26T08:49:20Z.
Updated PR metadata per latest triage:
Resolves #841(nowRefs #841) to keep #841 open as this is an opt-in diagnostic workaround.is_candidate_4k_primary).origin/main(63bcca4) with all checks passing (CI / checkcompleted / success).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.