Fix startup flicker by snapshotting SRV descriptor tables #20
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20"
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 Ryx69 on 2026-11-23T23:14:54Z.
Why the startup flickered
SRV-only tables used shared mirrored heap slots. Reusing a slot after command recording could make an earlier draw sample a different resource when the GPU executed it. The recorded frame tokens matched, and the black pixels were already in the source texture before DXGI presentation. The A/B result points to descriptor reuse in the startup render path.
The runtime already puts tables with constant-buffer views in command-list-owned slots. Apply the same policy to tables with shader-resource views so later descriptor writes cannot change what a recorded draw samples. Keep the existing mirrored path when the snapshot would exceed its heap range or the dynamic slots are exhausted.
Test system and results
32.0.16.2124.26300.E_INVALIDARG, which was also reproduced on a baseline without the descriptor fix.This AI-assisted PR covers the startup descriptor change. The post-terms black screen and packed-format allocation failures remain open.
Imported from Marvisak/VIctory. Originally posted by DaniloMaglia on 2026-11-23T23:33:33Z.
Tested on an RTX 4060 and it fixes the menu flicker here too.
Setup
mainat8c26061, plus the refused-formats patch fromhttps://github.com/Marvisak/VIctory/issues/16#issuecomment-7116625315
(without it, this GPU loses the device in the menus before the flicker
matters), plus this PR
diagbuild; black frames counted from the "a black frame after a framethat was not" lines
Before: single black frames about every 216 frames during the setup
screens (357, 573, 789, ...), plus bursts at screen changes. 18 in about
2 min 20 s. The logged brightness drops to 0 for exactly one frame between
normal frames, so this is flicker, not a fade.
With this PR: the only black frames left are frame 1 and frame 759.
Frame 759 is four frames at 0 between normal ones (44 → 0, 0, 0, 0 → 45),
which looks like an intended cut. Nothing flickered while playing through the
setup screens and menus.
The PR applies to current
mainwith line offsets only (after8c26061).cargo test -p victory-gpupasses (36) and clippy is clean.For the record, what I saw before applying it: in one capture the copy
of the sRGB video target into the UNORM target (pixel shader
f9bf13c6c099ccec, same pipeline in every frame) came out flat gray orred-only, even though the sRGB source had the right picture when saved at
present. That's what you'd expect from the draw sampling whatever a shared
mirrored slot held when the GPU ran it, rather than what it held when the
draw was recorded.
AI-assisted (Claude Code); tested on my machine. No game data in this comment.
Imported from Marvisak/VIctory. Originally posted by Sunkiller-qc on 2026-11-23T23:46:44Z.
Nice A/B data. One interaction to check now that #21 is on main: tables past a capped host heap (NVIDIA) also rely on the 65,536 dynamic slots, and with this change every SRV table draws from the same pool (
draw.rs:592). Whenhost.dynamic(n)fails, the new fallback (draw.rs:652) sends the table back to the mirrored path. For a table past the cap that means the shader reads past the host heap again, which is the #21 hang. Startup screens are probably fine, but the world binds large SRV tables (see the comment you removed abovetables). Could you give tables pasthost.count()priority over plain SRV snapshots, or test in-world on NVIDIA and count the "did not fit" fallbacks? Also, this now conflicts with #33. Static review, not built or run.Imported from Marvisak/VIctory. Originally posted by DaniloMaglia on 2026-11-23T23:51:08Z.
@Sunkiller-qc I ran this in-world on NVIDIA with #21, so here are the counts.
Setup: RTX 4060 (32-lane waves only, view heap capped at 1,000,000),
driver 621.24.
mainat97c78d1(includes #21) + this PR + therefused-formats patch from #16.
diagbuild, about 3 minutes from bootinto the world.
Fallbacks: none. Neither
descriptor table did not fit in command-list slots(this PR's fallback) norno free dynamic descriptor slotsappears inthe log. Both are logged on their first occurrence, so the pool never ran out
in the menus or in the world.
Black frames: five, all multi-frame cuts or fades
(e.g. 44 → 0 for 6+ frames), no single-frame flicker.
The world still loses the device on this GPU, but for a reason that looks
unrelated to this PR. An Aftermath dump shows a mesh shader page-faulting
on an address no resource owns. No fallback had fired before it, and in the
same run the host refused 78 compute pipelines that require
WaveSize(64)(this GPU only runs 32-lane waves). My current guess is wave64 assumptions
in mesh shaders on 32-lane hardware. Upstream reports the world staying up
on AMD.
That's one run on one GPU, and the world part only lasted until that device
loss, so it doesn't rule out exhaustion with heavier world scenes. I agree
that giving tables past
host.count()priority over plain SRV snapshotswould be the safer design. I haven't looked at how this PR and #33 conflict.
AI-assisted (Claude Code); tested on my machine. No game data in this comment.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:13:14Z.
Review: APPROVED
Tested
a68ac08on Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (221 passed, 0 failed; the branch is based on an old main). I can't reproduce the startup flicker without a game package.(table, contents)dedup still applies, but if the dynamic ring wraps onto lists not yet submitted, that is the same corruption in another form. A diagnostics counter for how often the "did not fit" fallback fires in the world would show whether the ring needs to grow.AI-assisted (Claude Code).
Pull request closed