victory-gpu: leave host copies of title memory in the common state (debug layer: 704 + 37 state errors -> 0) #2658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2660"
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 pes7 on 2026-11-25T17:42:53Z.
The first world frames move a host copy of title memory into a state it is never in, and leave it there. The debug layer says so about 40 times a minute.
A host copy of title memory (
crate::shadow) is made inD3D12_RESOURCE_STATE_COMMONand normally never moved: every use a copy has - unordered access, vertex and index buffers, indirect arguments, constant data - is served by the host's implicit promotion out of the common state. One place did move one: the indirect clamp.Those are the only transitions of a buffer in the crate, and both name a state the copy was not in. The title's own argument passes write the arguments through a descriptor, with no transition of ours, so the copy is still common when the first barrier claims it was in unordered access:
and the second barrier leaves the copy in unordered access for good, so the next draw that binds the same memory as a vertex buffer is invalid:
The same memory is read as arguments and then as vertices in these frames, which is why the two go together.
Measured with the debug layer on the title (diagnostics build,
VICTORY_D3D12_DEBUG=1, warm caches), counting its messages:The run after the change went further than the one before it - it reached the world frames, 5-20 fps, instead of stopping in the menu - and still had no state mismatch of either kind.
What stays is the UAV barrier, which is the ordering the clamp needs (it must read what the title's argument passes wrote). The transitions go, and so does
done(): there is nothing to put back.cargo test --workspace --locked, both clippy configurations with-D warnings,cargo xtask policy.Imported from Marvisak/VIctory. Originally posted by pes7 on 2026-11-25T17:43:35Z.
Superseded by
315cea1on main ("barriers start from the states resources are in: prelude order, the clamp's own buffer"), which fixes the same thing better: the clamp no longer writes the copy of the title's memory at all - it reads the title's records through a root view and writes the clamped ones into an argument buffer of the list's own, and only that one is transitioned. Title buffers' copies are then never transitioned, which is what this PR's one change (dropping the clamp's transitions anddone) set out to do.For the record, the debug-layer counts I measured on the way, since they agree with the ones in that commit: on the title with
VICTORY_D3D12_DEBUG=1and warm caches,mainbefore any of this reported id=527 ("Before state ... does not match") 704 times and id=538 (vertex buffer in UNORDERED_ACCESS) 37 times; with only the clamp's transitions dropped they were 0 and 0, in a run that went further (it reached the world frames instead of stopping in the menu).Closing rather than rebasing: main's version is strictly better, and tests for it are in that commit.
Pull request closed