Alias copies: the buffer's layouts are made again when the view's source texture changed (a copy the host refuses at Close) #3776
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3776
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3776"
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?
@Lyrnc on GitHub · 2026-11-30 06:45 UTC · original
Lyrnc:fix/late-did-not-close→main· +142 −13 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCProblem
a host command list did not close (0x80070057): a command recorded into it was invalid, late in a session and under texture pressure:a first host texture was admitted just over the room line (black face fix)and/ora texture already on the card is brought up to date although the card has no room for new ones.VICTORY_TEXTURE_ROOM_PERCENT=70crashed sooner. The Series S profile got through the steady scene but not the chapter load. One crash came with the card at 80 % and 3 GB free.Root cause: what the code says (vnv/main
41adb551)draw.rs, the heap texture pass, around lines 4320-4373: whenroomis false and the slot has no host texture,room_for_first_upload+first_upload_reservedecidefirst_upload. An admitted slot then goes the way every first upload under the line goes:host.mirror→readable→texture::upload_from→record_upload.first_uploadis read once more, at around 4618, only to sample the budget again. The two log lines are the pass's only frequent info lines whileresource::roomsays no room (they print at n = 1 and every 250th or 500th). So during a streaming burst they are the last lines before any failure. Skipping the admission or flushing before it would bring back the black faces and remove no command.slot_evictruns only withVICTORY_SLOT_EVICT=1or a flush, and it nulls the slots before it lets the copy go. Gone slots show the neutral texture or a null view (descriptor/host.rs,gone_neutral_on). A view of a released resource faults on the card (0x887A0006, the other ending sailcat saw), and does not failClose.StateBeforedoes not failClose. What does fail it is a state the resource cannot take: buffer bits alone on a texture, a write state on an upload buffer (measured in #3488). #3487 handles those. Our pressure paths add no new state.pool.rs::give_back_to, a private-data object), and then rests 2.5 s (REST). Lists hold their copies byArc(slot_evictandlet_go_idlecheckstrong_count, andhost::references). A use after free would fault or remove the device. It would not give a clean E_INVALIDARG.Closewith E_INVALIDARG is a command the runtime checks when it is recorded: copies (format family, subresource index, box), barriers (state legality), and root arguments without the right root signature. The open PRs for this error:placed_twins), and a 10-line patch gave 45 min clean.list.rs.seed_pendingcounted a volume's slices as layers, so its subresource indices went past the texture's.CopyTextureRegion,CopyBufferRegion,Resolve*andResourceBarrieris judged against measured rules (466 cases, checked against WARP). A refused one is logged (close guard: a command D3D12 would refuse) and left out. A failedClosereplays a ring of the list's commands and names the culprit. The run goes on without the list. Not play-tested.texture.rs::alias. This is a view the title placed, in another format, in the memory of a texture the host writes, read through a buffer. It keeps the buffer and both sides' copy layouts inTHROUGH, by the view alone. The source is the newest texture the host writes at the view's memory (resource::alias_of→TARGETS_AT, newest at an address wins).alias_withonly asks that it has the view's width, height, levels and layers, and a one-texel element of the same bytes. So a target the title makes at that address later (a scene or chapter change that makes its targets again) can be of another format of the same width, for example R16G16_FLOAT where R32_UINT was. The entry is not dropped then:texture::forgetof the old target removes only an entry keyed by it. Its layouts still name the old format, and the copy of the new texture into them is a texture ↔ footprint copy between formats that do not copy into each other. The host refuses that atClose(#3488'sread_back_repairedexists for the same rule). The same happens if the view's host copy has fewer levels than when the entry was made (onewant_levelkeeps as the host wrote it): the copies then name subresources it does not have.Fix
crates/victory-gpu/src/texture.rs:through_fits(parts, buffered, written, read): the layouts still fit if both sides have as many parts as the entry, each side's format is the one its layouts name, and there is a buffer exactly when the formats do not copy straight across (direct).alias_partsis the oldcountclosure, as a function.alias: reads both host descriptions before the lookup. An entry that does not fit is removed and made again as a new one would be. The info linean alias copy's layouts were made for other textures: made again(first 8, then powers of two) names the view, the source, the formats it was made for and the formats now.THROUGH_STALEcounts them.alias_withalready asks for the same size, and #3138's block alias (VICTORY_ALIAS_BLOCKS) has footprints of other widths on purpose. An entry that fits costs twoGetDesccalls more than before.Verification
On
2a637617, target dir C:\pt-close, each under the shared heavy lock:cargo check -p victory-gpu --locked -j 6: finished, no errors. 18 warnings in victory-gpu, none intexture.rs(main's own).cargo test -p victory-gpu --lib --locked -j 6 -- alias_layout_tests texture::: 14 passed, 0 failed, 4 ignored (measurements).texture::alias_layout_tests::alias_layouts_are_made_again_for_other_textures. Layouts made for R32_UINT → R9G9B9E5_SHAREDEXP (3 levels, buffered) fit those textures. They do not fit an R16G16_FLOAT source of the same size, a source or view with fewer levels, a missing buffer, or no parts.alias_copy_tests::a_direct_alias_copy_keeps_every_bit(D3D12, on the 5080) and the othertexture::tests.cargo clippy -p victory-gpu --lib --tests --locked -j 6 --no-deps: finished. 32 warnings, none intexture.rs(they are in pipeline.rs, host/font.rs, streamline.rs, shadow.rs, resource.rs, host.rs and others: main's).git merge-tree: clean on vnv/main + #3488 + #2305 (the bench's R1), and on vnv/main + #3138.NOT tested: in-game check pending
Nothing was run in the title. Steps for the bench agent (RTX 5080 16 GB, 9800X3D, 32 GB). The goal is to name T07's command, not just to test this branch.
cargo build --release --locked -p victory):41adb551as it is.refs/pull/3488/head(7f63dc99, which carries #3043) +refs/pull/2305/head(deee533a) + this branch.git merge-treeshows main + #3488, then + #2305, then + this branch, all clean (checked 2026-11-30 on7f63dc99,deee533aand2a637617). Do not add #3062 here (it conflicts with #3488 inlist.rs).VICTORY_TEXTURE_ROOM_PERCENT=40. If R0 does not fail in 15 min, useVICTORY_VRAM_BUDGET_MB=9000(as #3050 did) instead. Forced pressure can take 8 GB-card paths that are not this bug. Note which setting gave the failure.a host command list did not closeand the 30 log lines before it. If neither run fails at either pressure setting, stop: "not reproduced on the 5080". Report the room lines (textures picked by index: ... uploaded so far,memory now: ...) so the pressure can be compared with #3254's (card 12.0 / 14.3 GB, shared 12.2 GB).VICTORY_CLOSE_GUARD=log(commands are judged and logged, still recorded), same route and pressure, 2 runs. Grep the log for:close guard: a command D3D12 would refuse:method,why,command(formats, box, subresources, states) name the command beforeClosefails.close failure: ...and the replay's linethe list's copies, resolves and barriers in the ring were each recorded alone and closed(culprits named), orno command in the ring fails Close alone. The latter means the command is of a kind the guard does not judge (root arguments, a draw, a state call).an alias copy's layouts were made for other textures: made again(this branch).CopyTextureRegion, formats of two families, a twin (fromplaced_twinsinlist.rs): #3043's case. R1 carries #3043, so seeing it means #3043 is incomplete. Report it on #3043 (Selim's call).list.rstitle copies: #3062's case. Then build R2 = main + #3062 alone (+ #2305) and repeat step 5 without the guard. Expect no failure.ResourceBarrierrefused for its states: #3487's case.texture.rs::alias(the ring shows a buffer footprint and the source's format), or the "made again" line just before the failure: this branch. R1 should then not fail at all, so also run main + this branch alone without #3488 and expect it clean.no command in the ring fails Close alone: not a copy or barrier. R1 has #2305, so it is a further root-argument or state case. Next: a diagnostics build of R1 (cargo build --profile diag -p victory --features diagnostics, which compiles on main since41adb551) withVICTORY_D3D12_DEBUG=1. The debug layer can hide a race (#3222), so alsoVICTORY_D3D12_DRED=light.log: one of #2305 / #3043 fixed it. Bisect by dropping #2305 (R1 without it).close guardlines. They are copies left out, which may show as a texture wrong for a frame. Look at faces and signs after the chapter load.Overlap
gh pr list --state open(782 open, 2026-11-30 morning), searched for "did not close", 0x80070057, E_INVALIDARG, THROUGH,fn alias(, alias copy. Then the diffs of the 38 open PRs that touchtexture.rswere read foralias/THROUGH:THROUGHentries are found or kept. None names the stale-source case.CopyTextureRegioncalls further down inaliastochecked::copy_texture: no textual conflict with this hunk. With #3488 alone, the stale copy would be refused and left out (the view shows title memory for that frame). With this branch, the copy is made right.counts,sizes,VICTORY_ALIAS_BLOCKS) right below the lines changed here.git merge-treeof main + #3138 + this branch is clean, and the meaning does not conflict:through_fitscompares no sizes.alias, not the lookup.texture::forget's locks, which this branch does not touch.seed_pendingfor volumes) is another path to the same error. It is a different function, with no overlap.AI use
Claude Code (Claude Opus 5.5) read the issues' text (not the attachments), the code and the open PRs, wrote the change and its test, ran the checks listed above, and wrote this note. Nothing was run in game.
🤖 Generated with Claude Code
texture::alias keeps the buffer and both sides' copy layouts of a view the title placed, in another format, in the memory of a texture the host writes (THROUGH), by the view alone. The source is the newest such texture at the view's memory (resource::alias_of), and alias_with asks only for the view's size and a texel of the same bytes. A target the title makes there later can be of another format of that width (R16G16_FLOAT where R32_UINT was): the kept layouts still named the old format, and the copy of the new texture into them is one the host refuses, so the list does not close (0x80070057). The same held for a view's host copy with fewer levels than when the layouts were made. through_fits checks the part count of both sides, each side's format and whether a buffer is wanted (direct); an entry that does not fit is made again, with an info line ("an alias copy's layouts were made for other textures: made again"). Found while tracing the late "did not close" under texture pressure (#3135, #3254); not shown to be that one's command. Test: texture::alias_layout_tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>