Fix startup flicker by snapshotting SRV descriptor tables #20
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!20
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/20/head"
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?
@Ryx69 on GitHub · 2026-11-23 23:14 UTC · original
Ryx69:codex/fix-srv-descriptor-flicker→main· +16 −12 · 1 files · 1 commits · closed without mergingWhy 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.
@DaniloMaglia on GitHub · 2026-11-23 23:33 UTC · original
Tested on an RTX 4060 and it fixes the menu flicker here too.
Setup
mainat8c26061, plus the refused-formats patch from#16
(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.
@Sunkiller-qc on GitHub · 2026-11-23 23:46 UTC · original
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.@DaniloMaglia on GitHub · 2026-11-23 23:51 UTC · original
@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.
Pull request closed