Repository navigation
Alias copies: the buffer's layouts are made again when the view's source texture changed (a copy the host refuses at Close) - #3776
Merged
Conversation
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 (trustno1-coder#3135, trustno1-coder#3254); not shown to be that one's command.
Test: texture::alias_layout_tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moritz-eckhard-nickel
added a commit
to moritz-eckhard-nickel/VIctory-NVIDIA
that referenced
this pull request
Nov 30, 2026
…outs are made again when the view's source texture changed (a copy the host refuses at Close)) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
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 41adb55)
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 gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #3488). gpu: make texture states D3D12 refuses legal before they reach a barrier (0x80070057) #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(gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #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 World start: no 1.6 s stall (heap buffer views made while the title loads), plus DirectStorage, detiler and pipeline-crash ports #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 2a63761, 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 + gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #3488 + draw: clear the host tracking when the host list or its epoch changed #2305 (the bench's R1), and on vnv/main + World start: no 1.6 s stall (heap buffer views made while the title loads), plus DirectStorage, detiler and pipeline-crash ports #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):refs/pull/3488/head(7f63dc9, which carries gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043) +refs/pull/2305/head(deee533) + this branch.git merge-treeshows main + gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #3488, then + draw: clear the host tracking when the host list or its epoch changed #2305, then + this branch, all clean (checked 2026-11-30 on 7f63dc9, deee533 and 2a63761). Do not add List: title copies name a held host copy's levels, and are fitted to the host's textures #3062 here (it conflicts with gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #3488 inlist.rs).VICTORY_TEXTURE_ROOM_PERCENT=40. If R0 does not fail in 15 min, useVICTORY_VRAM_BUDGET_MB=9000(as v2026.11.29.02: DXGI_ERROR_DEVICE_HUNG after 40-190s on RTX 5080, pipeline library fails to load 72/72 entries #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 Runtime crash on 0x80070057 (host command list did not close) when texture slots run out — 4070 Ti SUPER 16GB, quality + FG 3X, v2026.11.29.03/.04 #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): gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043's case. R1 carries gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043, so seeing it means gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043 is incomplete. Report it on gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043 (Selim's call).list.rstitle copies: List: title copies name a held host copy's levels, and are fitted to the host's textures #3062's case. Then build R2 = main + List: title copies name a held host copy's levels, and are fitted to the host's textures #3062 alone (+ draw: clear the host tracking when the host list or its epoch changed #2305) and repeat step 5 without the guard. Expect no failure.ResourceBarrierrefused for its states: gpu: make texture states D3D12 refuses legal before they reach a barrier (0x80070057) #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 gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #3488 and expect it clean.no command in the ring fails Close alone: not a copy or barrier. R1 has draw: clear the host tracking when the host list or its epoch changed #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 since 41adb55) withVICTORY_D3D12_DEBUG=1. The debug layer can hide a race (v2026.11.29.01 / .02: GPU hang in meshlet culling and "host command list did not close" on an RTX 5070 (both gone with the slower debug build) #3222), so alsoVICTORY_D3D12_DRED=light.log: one of draw: clear the host tracking when the host list or its epoch changed #2305 / gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043 fixed it. Bisect by dropping draw: clear the host tracking when the host list or its epoch changed #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 gpu: close guard, aliasing barriers, copy repairs, and naming/surviving a failed Close (0x80070057) #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 + World start: no 1.6 s stall (heap buffer views made while the title loads), plus DirectStorage, detiler and pipeline-crash ports #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