GPU: add Series S second-plane composition and opt-in screen-probe ambient fallback #3414
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3414"
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 legayclightning22 on 2026-11-26T23:18:38Z.
Ports B10 and B11: opt-in compute composition for the Series S second plane (VICTORY_COMPOSE, VICTORY_PLANE_PREMULTIPLIED) and an off-by-default screen-probe ambient fallback (VICTORY_AMBIENT and tint/shade/sky/file settings), with unit tests for plane dispatch setup and env parsing.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T23:27:37Z.
Review: APPROVED
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).cargo test -p victory-gpu --lib ambient:: -- --test-threads=1: 2 passed, 0 failed.cargo test -p victory-gpu --lib compose:: -- --test-threads=1: 2 passed, 0 failed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 193 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:46:36Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:cargo test -p victory-gpu --lib: 235 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231 passed; +4).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.The added tests are
ambient_gate_is_off_unless_set,ambient_tint_sky_and_shade_settings_parse,plane_composition_setup_is_straight_or_premultipliedandplane_gates_are_off_unless_one; all pass, and the existing draw/placed-UAV tests are unchanged. The screen-probe fallback and the Series S plane composition are both opt-in, so nothing changes for a run with the gates off. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T00:05:50Z.
At
ed1d879,present_with_compositorinvokes the compute pass before it moves the primary texture to copy-source. The pass still declares that transition's starting state asCOPY_SOURCE. The new fixture records an input inRENDER_TARGETand replays the barriers before submitting. On the exact PR, the primary's first barrier declares0x800while its actual state is0x4.Follow-up
5d3b298passes the primary's incoming state into the compute pass and restores both inputs. When both planes refer to the same texture, it transitions that texture once in each direction. The copy and diagnostics use the selected output.On app-local WARP, the 9×7 readback passed twice in each alpha mode. All 63 texels matched the filtered 2×1 overlay within one UNORM8 unit. All 63 texels also matched exactly when both planes used the same input. Strict GPU Clippy in both configurations and asset policy passed. The full suite hit the known frame timer assertion in the unchanged
frame.rs. With that test excluded, it passed 250 with one ignored.@legayclightning22, could you take the state fix and repeat the opt-in Series S present path? If you fold it in, please retain the Git author or use
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T01:21:24Z.
Review: CHANGES_REQUESTED
Tested on RTX 5090 and WARP with
VICTORY_D3D12_DEBUG=1andVICTORY_D3D12_GBV=1. While default builds (both flags off) andVICTORY_AMBIENT=1ran cleanly in the probe, enablingVICTORY_COMPOSE=1reproduces three concrete D3D12 state-tracking / validation errors on both RTX 5090 and WARP:compose::recordassumesgameis already inCOPY_SOURCEand leaves it stuck inCOPY_SOURCEafterpresent(crates/victory-gpu/src/host.rs:3298-3318,crates/victory-gpu/src/compose.rs:265, 273):host.rs:3298-3306callscompose::record(&self.device, list, game, ui, ui_state)before transitioninggameout ofshown[0].1(typicallyD3D12_RESOURCE_STATE_RENDER_TARGET), whilecompose.rs:265unconditionally transitionsgamefromD3D12_RESOURCE_STATE_COPY_SOURCEtoNON_PIXEL_SHADER_RESOURCE. Live D3D12 debug layer output on both RTX 5090 and WARP:compose.rs:273then transitionsgametoCOPY_SOURCE, andhost.rs:3313overwritesstate = D3D12_RESOURCE_STATE_COPY_SOURCE, causing the post-present restore barrier (if state != COPY_SOURCE) to be skipped.gameis left inCOPY_SOURCEeven thoughHost::presentpromises to keep presented textures in their original state, triggering a second D3D12 error on the next render-target use ofgame:game's actualgame_stateintocompose::record, transitiongamegame_state -> NON_PIXEL_SHADER_RESOURCE -> game_state(preserving its state), leaveoutinCOPY_SOURCE, and whenlaid.is_some()skip transitioningtexture(game) altogether aroundCopyResource.Duplicate conflicting barriers when
gameanduirefer to the same resource (crates/victory-gpu/src/compose.rs:264-283):Unlike the multi-plane
Compositorpath (host.rs:3411-3414),compose::recorddoes not checkgame.as_raw() == ui.as_raw(). Passing the same texture in both planes triggers D3D12 validation errors1008(duplicate barrier on the same subresource) and527(mismatched before/after states) on both RTX 5090 and WARP.Diagnostics capture and black-frame probe read uncomposed
textureinstead oflaid(crates/victory-gpu/src/host.rs:3345, 3348):Line
3326copieslaid.as_ref().unwrap_or(texture)into&back, but lines3345(capture::read_back) and3348(capture::probe) still passtexture. That drops the composed overlay from captures/probes and also causesCopyTextureRegionstate error538oncegameis properly restored togame_stateinstead of left inCOPY_SOURCE. Passinglet source = laid.as_ref().unwrap_or(texture);toCopyResource,read_back, andprobekeeps all three consistent.(Design note):
ambient.rsmatches specific shader-name substrings (CS_ScreenProbes_TemporalResolve,CS_UpdateHistory,ps_sky_paraboloid_reflection) and hardcoded root table offsets ((1, 176),(1, 40),(0, 464)). Worth double-checking whether maintainers want title-specific shader/table hooks invictory-gpueven behind an opt-in switch.Imported from Marvisak/VIctory. Originally posted by moe-miau on 2026-11-27T03:44:34Z.
NVIDIA result for the ambient fallback in this PR (
VICTORY_AMBIENT=0.8), RTX 4070 SUPER (32-lane waves), driver 32.0.16.1742, Windows 11. The title was used locally; only numbers and a description of the picture are reported here.Tree:
mainf3578e3+ #2464, #2098, #2626, #2628, #2711, #2851, #2705 (VICTORY_CARD_COPIES=1), #2176/#2925 (VICTORY_WAVE32_APPROX=1), #2958, #3069, then this PR (ed1d879b, clean cherry-pick).diagbuild, Series X profile, the BVH builder held back as on the base. Same save and scripted input for every run, prison cell after the opening.VICTORY_AMBIENT=offVICTORY_AMBIENT=0.8So on NVIDIA the green patches the indirect-light probes leave without the BVH builder are covered by this fallback. I didn't see a frame-time cost I could separate from run-to-run noise. Another NVIDIA observation, not about this PR: on the Series S profile the world stays black in the same tree, because the title's own FSR4 passes don't translate (the known gap in the README), so I tested Series X.
Two notes on the PR itself: the plane composition (
VICTORY_COMPOSE) and the ambient fallback are separate features, and they might review faster as two PRs. AndVICTORY_AMBIENTis also the switch name in #2619, with a different syntax.AI-assisted (Claude Code). Runs done on my machine.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T21:11:16Z.
@legayclightning22 I extracted the ambient fallback from
ed1d879onto63bcca4for the independent review @moe-miau suggested. The split commit keeps your Git authorship. Ambient-only commitOn Windows WARP the standalone pass wrote the expected RGB9E5 value in all six pixels of a synthetic texture with a level of 0.5, neutral tint and sky sampling off. The same control stayed zero with ambient off. The regular diagnostics suite passed 248 project GPU tests plus the readback and SDK identity checks, with one ignored test. Both strict GPU Clippy configurations and the asset policy check passed. The in-game evidence is moe-miau’s Series X report.
The compositor state and readback result is available earlier in this PR. #2619 uses
VICTORY_AMBIENTwith a different value syntax. That setting needs an agreed spelling if the two approaches are going to coexist.If cherry-picking the split, please retain its original Git author. If folding in follow-up work from me, please add the trailer below.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
Imported from Marvisak/VIctory. Originally posted by legayclightning22 on 2026-11-28T04:41:24Z.
Thanks @fuzeofficlal — pushed an updated commit in
compose.rsandhost.rspassinggame_stateintocompose::recordand restoring it cleanly, guarding againstgame == uiduplicate barriers, and routingCopyResource,capture::read_back, andcapture::probethrough the composed texture.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.