Batched indirect clamp serves records clamped before the title's culling rewrote them: vehicle bodies vanish or go black at some camera angles (RX 9070 XT) #523
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem#523
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@abomalocaris on GitHub · 2026-12-04 21:45 UTC · original
What is seen
On
mainat2d7cb69(also with #342 merged), RX 9070 XT 16 GB, Series X profile, 2560x1440 output with FSR 4 quality, ray tracing on or off:It is not ray tracing (
VICTORY_BVH_BUILDER=0shows it too), andindirect mesh dispatches: ... 0.00 indirect records a frame ran empty for want of their list's budget.What I checked first, and ruled out
Captures (
VICTORY_CAPTURE+VICTORY_DUMP_TARGETS, with a local addition that dumps every level of R32F textures as raw floats):ec68a4e805ecba26merges into the pyramid is the same in the host copy and in title memory, and its occluders lie behind the real geometry.So the inputs to the title's occlusion test are right.
Cause
One command list of the title holds several groups of draws, each preceded by its own culling:
C= instance culling (3b471c122be79b3e/fc5e66f8f873d3bb/764ca63daec9c616),c= meshlet culling (9f017d9011377efa/0452fc2d2e2fc4c3/87bf9e3f2bf2f052),K=9146291b38ea9ce1,m=indirect kind 10 max 1. All ofC,c,Kwrite the 32768-byte argument buffer the following draws read.State::batched()returns the place of a record from the open batch whenever the table can place it.State::buffers_written()only setsbatch.wrote; the batch is dropped inState::synced(), which runs at the title'sbarrier()/sync()/groups_asked(). When no such call falls betweenKand the draws, the draws of a later group are served by the batch opened for an earlier group, whose clamp pass ran before this group'sC c K. A count of zero there is a body that is not drawn in that pass: missing from the G-buffer pass only gives the black silhouette, missing from both gives the see-through one.What fixes it here
Four local variants of one switch, checked by eye at a place where it reproduces every time, and timed on a scripted walk (same save, 30 fps cap):
buffers_written()Two things follow from the table:
VICTORY_BVH_BUILDER=0the first variant runs at full speed (29.7), so it is the ray-tracing dispatches that are expensive to re-batch.Also covering the meshlet culling's own indirect dispatches made rims and manhole covers flicker much more, until the barrier was added in front of the reopened batch. I read that as the clamp pass running before the stores of the shader just before it are visible, but I have not shown it directly.
Patch
The last row, as an opt-in switch. In
State::batched()(crates/victory-gpu/src/draw.rs), before the open batch is asked for the record's place:(
onis the switch;kind != 2leaves indirect dispatches as they are.) It is a workaround at the place the symptom shows. The exact condition is probably "a shader whose unordered views overlap a source of the open batch was recorded", which would cover dispatches as well without the cost; I have not written that.Not fixed by this
Shadows and bushes still pop along a walk. A frame-by-frame pop count over twelve recorded replays of one walk gave 5.8 (unchanged), 5.5 and 6.0 big pops per 1000 frames for the variants: no difference. That is a separate fault.
Side note
The title's depth-pyramid sampler is
CLAMP_BORDERwith a transparent-black border (words 438, 0xc00000, 0x18500000, 0), so on the console a test rectangle that reaches past the screen reads 0 (farthest) there.lower.rs's gather-with-level emulation clamps coordinates to the edge instead. I tried border semantics behind a switch; it did not turn out to be the cause of the above, and I have no case where it changes a picture.github-bot referenced this issue2026-12-05 14:21:31 +00:00
@tommiehansen on GitHub · 2026-12-05 15:58 UTC · original
There's now a PR for this in #597, based on your findings. The reported fix looks promising and doesn't seem to cost much FPS. It's still waiting for review/merge. :)