GPU: check destination format family for CopyTextureRegion placed twins #3979
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3979"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by bemfavivaEC807E52 on 2026-11-30T13:33:56Z.
Summary
Fixes a
0x80070057(a host command list did not close) crash incopy_texture_region'splaced_twinsloop when a placed twin has the same block/element size as the destination texture but belongs to a different DXGI format family (for example BC3 vs BC7, #3901).Root cause
resource::placed_twinspairs overlapping texture views by block/element size only (so 16-byte-block BC3 and BC7 views can be paired).copy_resourcealready checks format-family compatibility before recording twin copies,copy_texture_regionrecordedCopyTextureRegioninto every twin returned byplaced_twinswithout a format-family check.CopyTextureRegioncopies withE_INVALIDARG(0x80070057) atID3D12GraphicsCommandList::Close().What this PR changes (
crates/victory-gpu/src/list.rs)to.GetDesc().Format) against the twin's host format family (other.GetDesc().Format) viaresource::family().R32G32B32A32_TYPELESS -> BC3_TYPELESSfor same-family twins, while cleanly skipping cross-family twins (BC3 vs BC7, BC7 vs BC6H, R8G8B8A8 vs R16G16).host_written,host_write_listed, orensure_state, and logs the first 16 occurrences (then every 1024th) atINFO.placed_twins_require_a_matching_destination_format_family.Relation to #3792 and #3043
placed_twins): on live RTX 4090 / Series X runs tested alongside #3792, the same area that previously crashed twice in a row with0x80070057triggered 16 cross-family twin skips atbase=0(other format family), which held-level mapping alone does not catch, and ran with 0 errors / 0 crashes.Verification
cargo test -p victory-gpu --locked placed_twins_require_a_matching_destination_format_family: passed (0 failures).base=0with 00x80070057crashes.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ozigalko on 2026-11-30T17:30:48Z.
Independent confirmation on RTX 5070 Ti / i7-13700K / 32 GB: with an equivalent family check on v2026.11.30.01, 0 of 7 runs crashed with 0x80070057 (before: 2 of 8 on 11.29.04/.05, 3 of 11 on Broadside-RT rt-test-13). The skipped copies were BC3 (family 76) into BC7 (family 97), on 2 twin textures, which looks like the copy
placed_twinsexists for; #4080 keeps that copy through a buffer instead of skipping it. Details and table in #4080.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T18:59:45Z.
Test report for this PR: the failure it targets is confirmed on WARP, and the PR leaves out every refused pair. The mission crash itself is not reproduced in game.
Setup: v2026.11.30.01 (
c71899d9) and v2026.11.30.02 (84bd61e2); RTX 5080, Series X profile, 2560x1440, DLSS off, frame generation off, ray tracing off. To get it onto current main I re-appliedc383067aon .01 and .02. Main now finds the twin's subresource withresource::host_target, so that lookup stays and the family check comes right after it. No other change.1. Mechanism, unit test on the software adapter (WARP). Each case records one copy into a fresh list, then calls
Close.Closewithout a checkThe middle column comes from the WARP tests. The right column is
twin_copy_same_familychecked on each pair, in a test on the port. Your ownplaced_twins_require_a_matching_destination_format_familypasses there too. The tests ran on the .02 port, because .01's own test build stops at host test calls that .02 fixed. The mechanism tests are on a branch: https://github.com/Lyrnc/VIctory-NVIDIA/commits/test/twin-copy-close-warp (list::twin_close_tests). The per-PR check is below; it goes in the same module. Anyone can take them into this PR.Per-PR check (passes on the port)
2. In game: the mission crash is not reproduced. The save attached to #3972 starts before the mission. Reaching the scene where it crashes means a long drive plus the first part of the mission, and #3890 says there is no save point after that part, so our scripted runs could not get there. I did about 25 min of free roam from that save on .01, outdoors and in a house interior. The build carried a local diagnostic log that names every copy D3D12 would refuse (title copies and placed-twin copies) and, when
Closefails, what that list held. Result: no refused twin copy and no failedClose. The cross-family twin path simply did not come up there, so it gives no before/after for this PR.Not covered by this PR (twins don't need it): a title copy whose own source and destination are of different families, the
BC7_TYPELESS -> BC6Hthat #2914's debug layer named. #3043 goes at that one. The naming log saw none in free roam.Tested and written with Claude Code (AI).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tillo88 on 2026-12-01T12:06:58Z.
Crash and speed check of #3979 (head
0bd8a5f8) merged on top of v2026.11.30.03, against the bare release on the same bench and route.Crashes (warm-up runs included for the count):
Base errors were
a host command list did not close (0x80070057)(2) andrelay: the device was lost ... (0x887A0006)(3). With #3979 all 7 runs went past the cut and ran the whole ~6 min route. At the base rate (5 of 27), 0 of 7 by chance is about 24%, so on its own this is not conclusive.The PR's line
a copy into a view placed over a texture the host copied into is left out ... why="other format family"appears in every run, 12 to 16 times, in two bursts between +0:41 and +1:53 (before the cut). The PR logs only the first 16, and 3 runs reached 16, so any later skips, at the cut included, would not show in those runs. The masked twin was made at +2:14/+2:15 in all 7 runs, as in the base.Speed (measured runs only, warm-up excluded):
+0.3% fps: no measurable difference. The higher mean p95 comes from one run (53.7 ms); the other five had 47.3–47.7 ms.
Setup: Ryzen 7 9800X3D, RTX 5070 Ti 16 GB (driver 621.40), 32 GB RAM, Windows 11, release build, Series X 1440p, DLSS Quality, frame generation off, ray tracing off. Route: same save from the start of the game, prison cutscene, plane cutscene, first boat section, about 6 minutes per run.
Measured unattended on a replay bench (same save, recorded controller input via VICTORY_INPUT_REPLAY); numbers and text prepared with Claude.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:47:21Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed