gpu: bounce cross-format CopyTextureRegion and CopyResource through a temporary buffer (#2914) #3043

Open
github-bot wants to merge 18 commits from github-bot/gh-3043 into main AGit
Owner

@⁠Nirkster on GitHub · 2026-11-29 19:43 UTC · original
Nirkster:fix/copy-texture-region-cross-format → main · +2069 −879 · 33 files · 18 commits · open

Fixes #2914

Cause

copy_texture_region (including placed_twins) and copy_resource in crates/victory-gpu/src/list.rs recorded direct D3D12 CopyTextureRegion / CopyResource calls without checking D3D12 format compatibility.

On console, raw block copies between different block-compressed families of the same block geometry (e.g. BC7_TYPELESS -> BC6H_TYPELESS or BC3_UNORM_SRGB -> BC5_UNORM, all 16-byte 4x4 blocks) are legal, but D3D12 rejects them at command list Close() with E_INVALIDARG (0x80070057).

Fix

  • crates/victory-gpu/src/resource.rs:
    • Added copy_compatible(a, b) matching D3D12's CopyTextureRegion / CopyResource rules (same typeless family, BC1/BC4 <-> R16G16B16A16/R32G32, BC2/BC3/BC5/BC6H/BC7 <-> R32G32B32A32, R9G9B9E5_SHAREDEXP <-> R32 excluding D32_FLOAT).
    • Added copy_bounce_layout(...) to compute 256-byte row-pitched, block-aligned footprints when source and destination share identical (element_bytes, block_size).
  • crates/victory-gpu/src/list.rs:
    • Added record_texture_copy(...) used by copy_texture_region, its placed_twins loop, and the incompatible-format fallback of copy_resource.
    • Compatible copies remain on the direct fast path unchanged.
    • Incompatible texture-to-texture copies with matching block geometry bounce through a temporary device-local buffer (host.uav_buffer + list.keep(&buffer), freed on list reset).
    • Incompatible footprint-to-texture copies with matching block geometry reinterpret the footprint format to match the destination; mismatched block geometries are logged and skipped instead of poisoning the command list.

Verification

  • Unit & D3D12 GPU tests (cargo test -p victory-gpu -- copy_compatible copy_bounce_layout cross_format_bc7_to_bc6h_copy_preserves_every_bit): 3/3 passed on RTX 5070 Ti, including cross_format_bc7_to_bc6h_copy_preserves_every_bit (full mip 0, full mip 1, and partial 8x8 box BC7_TYPELESS -> BC6H_TYPELESS, verified Close(), Execute(), and bit-for-bit readback).
  • In-game verification (v2026.11.29.02 on RTX 5070 Ti): intercepted 7 consecutive cross-format mip copies (BC3_UNORM_SRGB (78) -> BC5_UNORM (83), 256x256 down to 4x4) with zero 0x80070057 command-list close failures:
    bounced cross-format texture copy through temporary buffer count=1 src_fmt=78 dst_fmt=83 fp_w=256 fp_h=256 fp_d=1 total_bytes=65536
    ...
    bounced cross-format texture copy through temporary buffer count=7 src_fmt=78 dst_fmt=83 fp_w=4 fp_h=4 fp_d=1 total_bytes=256
    
**@⁠Nirkster** on GitHub · 2026-11-29 19:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043) `Nirkster:fix/copy-texture-region-cross-format` → `main` · +2069 −879 · 33 files · 18 commits · open Fixes #2914 ### Cause `copy_texture_region` (including `placed_twins`) and `copy_resource` in `crates/victory-gpu/src/list.rs` recorded direct D3D12 `CopyTextureRegion` / `CopyResource` calls without checking D3D12 format compatibility. On console, raw block copies between different block-compressed families of the same block geometry (e.g. `BC7_TYPELESS` -> `BC6H_TYPELESS` or `BC3_UNORM_SRGB` -> `BC5_UNORM`, all 16-byte 4x4 blocks) are legal, but D3D12 rejects them at command list `Close()` with `E_INVALIDARG` (`0x80070057`). ### Fix - `crates/victory-gpu/src/resource.rs`: - Added `copy_compatible(a, b)` matching D3D12's `CopyTextureRegion` / `CopyResource` rules (same typeless family, `BC1/BC4 <-> R16G16B16A16/R32G32`, `BC2/BC3/BC5/BC6H/BC7 <-> R32G32B32A32`, `R9G9B9E5_SHAREDEXP <-> R32` excluding `D32_FLOAT`). - Added `copy_bounce_layout(...)` to compute 256-byte row-pitched, block-aligned footprints when source and destination share identical `(element_bytes, block_size)`. - `crates/victory-gpu/src/list.rs`: - Added `record_texture_copy(...)` used by `copy_texture_region`, its `placed_twins` loop, and the incompatible-format fallback of `copy_resource`. - Compatible copies remain on the direct fast path unchanged. - Incompatible texture-to-texture copies with matching block geometry bounce through a temporary device-local buffer (`host.uav_buffer` + `list.keep(&buffer)`, freed on list reset). - Incompatible footprint-to-texture copies with matching block geometry reinterpret the footprint format to match the destination; mismatched block geometries are logged and skipped instead of poisoning the command list. ### Verification - **Unit & D3D12 GPU tests** (`cargo test -p victory-gpu -- copy_compatible copy_bounce_layout cross_format_bc7_to_bc6h_copy_preserves_every_bit`): 3/3 passed on RTX 5070 Ti, including `cross_format_bc7_to_bc6h_copy_preserves_every_bit` (full mip 0, full mip 1, and partial 8x8 box `BC7_TYPELESS -> BC6H_TYPELESS`, verified `Close()`, `Execute()`, and bit-for-bit readback). - **In-game verification** (`v2026.11.29.02` on RTX 5070 Ti): intercepted 7 consecutive cross-format mip copies (`BC3_UNORM_SRGB (78) -> BC5_UNORM (83)`, 256x256 down to 4x4) with zero `0x80070057` command-list close failures: ```text bounced cross-format texture copy through temporary buffer count=1 src_fmt=78 dst_fmt=83 fp_w=256 fp_h=256 fp_d=1 total_bytes=65536 ... bounced cross-format texture copy through temporary buffer count=7 src_fmt=78 dst_fmt=83 fp_w=4 fp_h=4 fp_d=1 total_bytes=256 ```
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 19:47:14 +00:00
Author
Owner

@⁠dyshay on GitHub · 2026-11-29 20:46 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-29 20:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7262353638) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.
Author
Owner

@⁠tarakanovalexey on GitHub · 2026-11-29 21:52 UTC · original · edited 2026-11-29 22:25 UTC

Hi @⁠Nirkster — reporting a related-but-distinct failure we hit while testing this PR locally. TL;DR: a format-compatible pair went down the copy_compatible fast path, which currently performs no geometry validation, and Close() still failed with 0x80070057 — same family as #2914, different shape.

Setup: v2026.11.29.03 (cec481f4) + this PR + #2305 + #2988, RTX 4070 Ti 12 GB, Windows 11, VICTORY_D3D12_DEBUG=1.

Crash (~83 min into the session, unix time 1795987693): the debug layer named the fatal call at Close():

CopyTextureRegion: The destination region extends past, at least, one of the edges of the destination subresource. When the destination format is BC3_TYPELESS, the source format is R32G32B32A32_TYPELESS, DstX is 0, DstY is 0, DstZ is 0 and the effective SrcBox width is 256, height is 256, and depth is 1, the operation requires the destination subresource to have 1024 width, 1024 height, and 1 depth. But the destination subresource only has 128 width, 128 height, and 1 depth. id=858

Why I believe the bounce never engaged here: grepping the whole run log gives bounced cross-format texture copy ×0, reinterpreting cross-format footprint copy ×0 — BC3_TYPELESS ↔ R32G32B32A32_TYPELESS is one of D3D12's own equivalent families (BC[2|3|5|6|7] ~= R32G32B32A32, from this very layer's enumeration), so copy_compatible passes and the fast path records the copy raw. What fails is geometry: the source's box of 256×256 texels is read as 256×256 of the destination's blocks (×4 block span), so D3D12 wants a ≥1024×1024-texels destination subresource; the targeted one is 128×128. copy_bounce_layout would have caught exactly this (it rejects mismatched geometry), but the fast path has no such check. I can't prove whether stock v2026.11.29.03 would hit the same copy — the fast path behaves like vanilla for compatible pairs — only that it surfaced under this build.

Proposed minimal fix (running here now): give the fast path the same geometry treatment the bounce path already has — validate the region against the destination subresource. Field note from testing this live: my first cut scaled both the offsets and the extents by the destination's block span (need = w*4, x*4), and that is too eager — ordinary BC-destination copies pass offsets/extents in texels (a whole hour of play flagged ~200k legitimate R16G16B16A16 → BC1 copies like a 66×66 box into a 5808×5808 subresource as "past the edge" when they plainly fit). What survives empirically is plain texel-space containment — it still catches today's fatal copy (box 256×256 into a 128×128-texel mip):

if crate::resource::copy_compatible(src_fmt, dst_fmt) {
    if !texture_copy_geometry_ok(list, &to_location, x, y, host_box, &from, &src_desc, &dst_desc) {
        return;
    }
    // SAFETY: an open list and copy-compatible texture formats.
    unsafe { list.list.CopyTextureRegion(...) }
    return;
}

fn texture_copy_geometry_ok(...) -> bool {
    let mips = u32::from(dst_desc.MipLevels).max(1);
    let sub = (to_location.footprint.offset as u32) % mips;
    let dst_w = (dst_desc.Width >> sub).max(1);
    let dst_h = (u64::from(dst_desc.Height) >> sub).max(1);
    // Region source: the box if given, else the footprint, else the
    // source subresource's own mip extent.
    let (w, h) = /* box / footprint / source-mip extents */;
    u64::from(x) + w <= dst_w && u64::from(y) + h <= dst_h
}

(Plus a VICTORY_GEOMETRY_COPIES=0 escape hatch mirroring VICTORY_FAMILY_COPIES, and a warn-once-per-pair counter.) Whether the debug layer's stricter block-rule arithmetic (box 256×256 ⇒ "requires 1024×1024") also needs honoring per-copy I can't yet tell without another named failure — happy to iterate when the next one names itself.Happy to also paste the surrounding log context (~the last 8k lines of the run, or a gist) if that helps."

**@⁠tarakanovalexey** on GitHub · 2026-11-29 21:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7263223196) · edited 2026-11-29 22:25 UTC Hi @⁠Nirkster — reporting a related-but-distinct failure we hit while testing this PR locally. TL;DR: a **format-compatible** pair went down the `copy_compatible` fast path, which currently performs **no geometry validation**, and `Close()` still failed with `0x80070057` — same family as #2914, different shape. **Setup:** v2026.11.29.03 (`cec481f4`) + this PR + #2305 + #2988, RTX 4070 Ti 12 GB, Windows 11, `VICTORY_D3D12_DEBUG=1`. **Crash (~83 min into the session, `unix time 1795987693`):** the debug layer named the fatal call at `Close()`: > `CopyTextureRegion: The destination region extends past, at least, one of the edges of the destination subresource. When the destination format is BC3_TYPELESS, the source format is R32G32B32A32_TYPELESS, DstX is 0, DstY is 0, DstZ is 0 and the effective SrcBox width is 256, height is 256, and depth is 1, the operation requires the destination subresource to have 1024 width, 1024 height, and 1 depth. But the destination subresource only has 128 width, 128 height, and 1 depth.` id=858 **Why I believe the bounce never engaged here:** grepping the whole run log gives `bounced cross-format texture copy` ×0, `reinterpreting cross-format footprint copy` ×0 — `BC3_TYPELESS ↔ R32G32B32A32_TYPELESS` is one of D3D12's own equivalent families (`BC[2|3|5|6|7] ~= R32G32B32A32`, from this very layer's enumeration), so `copy_compatible` passes and the fast path records the copy raw. What fails is geometry: the source's box of 256×256 **texels** is read as 256×256 of the destination's **blocks** (×4 block span), so D3D12 wants a ≥1024×1024-texels destination subresource; the targeted one is 128×128. `copy_bounce_layout` would have caught exactly this (it rejects mismatched geometry), but the fast path has no such check. I can't prove whether stock `v2026.11.29.03` would hit the same copy — the fast path behaves like vanilla for compatible pairs — only that it surfaced under this build. **Proposed minimal fix** (running here now): give the fast path the same geometry treatment the bounce path already has — validate the region against the destination subresource. Field note from testing this live: my first cut scaled both the offsets *and* the extents by the destination's block span (`need = w*4`, `x*4`), and that is too eager — ordinary BC-destination copies pass offsets/extents in texels (a whole hour of play flagged ~200k legitimate `R16G16B16A16 → BC1` copies like a 66×66 box into a 5808×5808 subresource as "past the edge" when they plainly fit). What survives empirically is plain **texel-space containment** — it still catches today's fatal copy (box 256×256 into a 128×128-texel mip): ```rust if crate::resource::copy_compatible(src_fmt, dst_fmt) { if !texture_copy_geometry_ok(list, &to_location, x, y, host_box, &from, &src_desc, &dst_desc) { return; } // SAFETY: an open list and copy-compatible texture formats. unsafe { list.list.CopyTextureRegion(...) } return; } fn texture_copy_geometry_ok(...) -> bool { let mips = u32::from(dst_desc.MipLevels).max(1); let sub = (to_location.footprint.offset as u32) % mips; let dst_w = (dst_desc.Width >> sub).max(1); let dst_h = (u64::from(dst_desc.Height) >> sub).max(1); // Region source: the box if given, else the footprint, else the // source subresource's own mip extent. let (w, h) = /* box / footprint / source-mip extents */; u64::from(x) + w <= dst_w && u64::from(y) + h <= dst_h } ``` (Plus a `VICTORY_GEOMETRY_COPIES=0` escape hatch mirroring `VICTORY_FAMILY_COPIES`, and a warn-once-per-pair counter.) Whether the debug layer's stricter block-rule arithmetic (box 256×256 ⇒ "requires 1024×1024") also needs honoring per-copy I can't yet tell without another named failure — happy to iterate when the next one names itself.Happy to also paste the surrounding log context (~the last 8k lines of the run, or a gist) if that helps."
Author
Owner

@⁠Nirkster on GitHub · 2026-11-29 22:33 UTC · original

Thanks a lot for the 83-minute debug-layer run and the exact D3D12 capture, @⁠tarakanovalexey!

Great catch — R32G32B32A32_TYPELESS -> BC3_TYPELESS is format-compatible in D3D12, so it goes through the direct fast path where a 256×256 texel box expands to 1024×1024 destination texels and overflows a 128×128 mip (id=858).

I've added source + destination geometry validation (copy_geometry_fits) in 097b507 across all record_texture_copy paths (direct, bounce, and footprint) as well as record_resource_copy, with VICTORY_GEOMETRY_COPIES=0 via toggled! as an escape hatch. One small note on your snippet: in D3D12 DstX/DstY are already in destination texels, so multiplying x * dst_span would reject valid sub-region copies at non-zero offsets — copy_geometry_fits keeps dst_x + need_w <= dst_w.next_multiple_of(dst_block) and also checks BC source/destination alignment and BC -> raw (div_ceil(4)).

Verified with unit tests and a real D3D12 GPU test on an RTX 5070 Ti reproducing R32G32B32A32 256×256 -> BC3 128×128 (skipped cleanly while a valid 32×32 sub-copy passes bit-for-bit).

If you still have the surrounding log context handy, feel free to share a gist — and if you get a chance to re-test 097b507 in that same scene, let me know how it holds up!

**@⁠Nirkster** on GitHub · 2026-11-29 22:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7263767038) Thanks a lot for the 83-minute debug-layer run and the exact D3D12 capture, @⁠tarakanovalexey! Great catch — `R32G32B32A32_TYPELESS -> BC3_TYPELESS` is format-compatible in D3D12, so it goes through the direct fast path where a 256×256 texel box expands to 1024×1024 destination texels and overflows a 128×128 mip (`id=858`). I've added source + destination geometry validation (`copy_geometry_fits`) in `097b507` across all `record_texture_copy` paths (direct, bounce, and footprint) as well as `record_resource_copy`, with `VICTORY_GEOMETRY_COPIES=0` via `toggled!` as an escape hatch. One small note on your snippet: in D3D12 `DstX`/`DstY` are already in destination texels, so multiplying `x * dst_span` would reject valid sub-region copies at non-zero offsets — `copy_geometry_fits` keeps `dst_x + need_w <= dst_w.next_multiple_of(dst_block)` and also checks BC source/destination alignment and `BC -> raw` (`div_ceil(4)`). Verified with unit tests and a real D3D12 GPU test on an RTX 5070 Ti reproducing `R32G32B32A32 256×256 -> BC3 128×128` (skipped cleanly while a valid `32×32` sub-copy passes bit-for-bit). If you still have the surrounding log context handy, feel free to share a gist — and if you get a chance to re-test `097b507` in that same scene, let me know how it holds up!
Author
Owner

@⁠tarakanovalexey on GitHub · 2026-11-29 22:45 UTC · original

Thanks for the fast turnaround — copy_geometry_fits is exactly the shape of fix we hoped to see, and your RTX 5070 Ti GPU test hitting our precise case (R32G32B32A32 256×256 -> BC3 128×128 skipped cleanly, valid 32×32 bit-exact) matches the crash surface.

And acknowledged on DstX/DstY being destination texels: the ~200k false positives I described in an edit above came from scaling offsets by the block span during my first pass, so plain texel containment (your formulation) was the right call.

As requested, here is the surrounding context as a secret gist:
https://gist.github.com/tarakanovalexey/050efa6a442b84dcf9cdaf42211c2cdd
(gist-3043-context.md: switches header, run-log lines 2653300–2653528 around the fatal validation at 21:28:13.360Z, and the crashes.log entry. The geometry warning is the last D3D12 message in the whole run — 1 occurrence out of a 2.65M-line session.)

Status on re-testing: we're currently running 097b507 integration locally; will report how the bar scene holds up.

**@⁠tarakanovalexey** on GitHub · 2026-11-29 22:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7263922485) Thanks for the fast turnaround — `copy_geometry_fits` is exactly the shape of fix we hoped to see, and your RTX 5070 Ti GPU test hitting our precise case (`R32G32B32A32 256×256 -> BC3 128×128` skipped cleanly, valid `32×32` bit-exact) matches the crash surface. And acknowledged on `DstX`/`DstY` being destination texels: the ~200k false positives I described in an edit above came from scaling offsets by the block span during my first pass, so plain texel containment (your formulation) was the right call. As requested, here is the surrounding context as a secret gist: **https://gist.github.com/tarakanovalexey/050efa6a442b84dcf9cdaf42211c2cdd** (`gist-3043-context.md`: switches header, run-log lines 2653300–2653528 around the fatal validation at 21:28:13.360Z, and the crashes.log entry. The geometry warning is the last D3D12 message in the whole run — 1 occurrence out of a 2.65M-line session.) Status on re-testing: we're currently running `097b507` integration locally; will report how the bar scene holds up.
Author
Owner

@⁠upipibi on GitHub · 2026-11-29 23:27 UTC · original

Test report for #3043 (head 097b5070), merged onto main 41adb551, on RTX 30. Synthetic tests only: no title run, no game files.

Setup: RTX 3070 8 GB, driver 621.40, Windows 11 (10.0.26100), rustc 1.98.1. Every step logged the GPU and driver from nvidia-smi.

The PR's five tests (copy_compatible_checks_d3d12_rules, copy_bounce_layout_handles_block_alignment, copy_geometry_fits_checks_d3d12_bounds, cross_format_bc7_to_bc6h_copy_preserves_every_bit, format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds): 5 passed, 0 failed, in 3/3 runs on the card and 3/3 with VICTORY_D3D12_WARP=1.

Negative controls on the card, one line of list.rs changed each:

Change in record_texture_copy Test Result
A: every copy takes the direct path (the copy_compatible branch always taken, so the bounce never runs) cross_format_bc7_to_bc6h_copy_preserves_every_bit fails: a host command list did not close (The parameter is incorrect. (0x80070057))
B: the copy_geometry_fits check switched off format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds fails the same way, 0x80070057 at close

So on this card each test fails exactly as #2914 and the follow-up report describe when its part of the fix is taken out: A is the cross-format copy D3D12 refuses, B is the compatible copy that does not fit its destination. Both tests reach the device and catch it.

cargo test -p victory-gpu --lib --locked, two runs of each tree

Tree Run 1 Run 2
PR 923 passed, 4 failed, 60 ignored 926 passed, 1 failed, 60 ignored
Main 41adb551 920 passed, 2 failed, 60 ignored 919 passed, 3 failed, 60 ignored

None of the failures is in the PR's code or tests:

  • shader_cache::tests::every_switch_of_the_translator_is_in_the_key fails in all four runs, on main too: VICTORY_SCALAR_SPLITS is not read by the translator any more (shader_cache.rs:982). That looks like main's own, independent of the card.
  • The others come and go between runs and trees (host::card_steps::tests::places_written_after_sending_are_learned, host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started, host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue, watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock); main shows them as well.

The PR tree has five more tests than main, the PR's own, and they passed in both suite runs.

Not tested: the copies in a title, and VICTORY_GEOMETRY_COPIES set to anything but its default.

Tested with the help of Claude Code (Claude Fable 5.2).

**@⁠upipibi** on GitHub · 2026-11-29 23:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7264472878) Test report for #3043 (head 097b5070), merged onto main 41adb551, on RTX 30. Synthetic tests only: no title run, no game files. **Setup:** RTX 3070 8 GB, driver 621.40, Windows 11 (10.0.26100), rustc 1.98.1. Every step logged the GPU and driver from `nvidia-smi`. **The PR's five tests** (`copy_compatible_checks_d3d12_rules`, `copy_bounce_layout_handles_block_alignment`, `copy_geometry_fits_checks_d3d12_bounds`, `cross_format_bc7_to_bc6h_copy_preserves_every_bit`, `format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds`): 5 passed, 0 failed, in 3/3 runs on the card and 3/3 with `VICTORY_D3D12_WARP=1`. **Negative controls on the card**, one line of `list.rs` changed each: | Change in `record_texture_copy` | Test | Result | |---|---|---| | A: every copy takes the direct path (the `copy_compatible` branch always taken, so the bounce never runs) | `cross_format_bc7_to_bc6h_copy_preserves_every_bit` | **fails**: `a host command list did not close (The parameter is incorrect. (0x80070057))` | | B: the `copy_geometry_fits` check switched off | `format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds` | **fails** the same way, `0x80070057` at close | So on this card each test fails exactly as #2914 and the follow-up report describe when its part of the fix is taken out: A is the cross-format copy D3D12 refuses, B is the compatible copy that does not fit its destination. Both tests reach the device and catch it. **`cargo test -p victory-gpu --lib --locked`, two runs of each tree** | Tree | Run 1 | Run 2 | |---|---|---| | PR | 923 passed, 4 failed, 60 ignored | 926 passed, 1 failed, 60 ignored | | Main 41adb551 | 920 passed, 2 failed, 60 ignored | 919 passed, 3 failed, 60 ignored | None of the failures is in the PR's code or tests: - `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` fails in all four runs, on main too: `VICTORY_SCALAR_SPLITS is not read by the translator any more` (`shader_cache.rs:982`). That looks like main's own, independent of the card. - The others come and go between runs and trees (`host::card_steps::tests::places_written_after_sending_are_learned`, `host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started`, `host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue`, `watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock`); main shows them as well. The PR tree has five more tests than main, the PR's own, and they passed in both suite runs. Not tested: the copies in a title, and `VICTORY_GEOMETRY_COPIES` set to anything but its default. *Tested with the help of Claude Code (Claude Fable 5.2).*
Author
Owner

@⁠tarakanovalexey on GitHub · 2026-11-30 00:25 UTC · original

Re-testing update — your fix does resolve the copy-class failures I reported (zero extends past / format messages since 097b507), but the validation interacts badly with one specific copy pattern, and that chain kills the list differently:

Failure chain, verbatim (run victory-nvidia-play-20261129-234511, ~33 min in, bar-area scene):

WARN victory_gpu::list: skipping out-of-bounds or unaligned CopyTextureRegion count=1 src_fmt=3 dst_fmt=78 src_size=(256, 256, 1) src_box=None dst_pos=(0, 0, 0) dst_size=(128, 128, 1)
WARN victory_gpu::list: ... count=2 ... src_size=(128, 128, 1) ... dst_size=(64, 64, 1)
WARN victory_gpu::list: ... count=3 ... (64,64)->(32,32)   count=4 (32,32)->(16,16)   count=5 (16,16)->(8,8)   count=6 (8,8)->(4,4)

— six consecutive whole-mip copies of one chain (fmt 3 -> 78, each level half the previous, full-subresource, no box), all judged out-of-bounds by copy_geometry_fits and dropped outright.

Immediately after them, at the very next batch of lists:

D3D12: ID3D12CommandList::CopyTextureRegion: D3D12_TEXTURE_COPY_LOCATION::Subresource is too large for the associated resource. The value is 6, when the resource only has 6 subresources. id=850
The value is 7, when the resource only has 6 subresources.
The value is 8, when the resource only has 6 subresources.
→ Close(): a host command list did not close (0x80070057): a command recorded into it was invalid

So: skip-cascade → someone keeps advancing the subresource index down the same chain → writes land past the host resource's real level count → Close() fails. Session-wide totals: exactly 6 skips, 4 OOBs, one death. Earlier in the same build stack, another ~31-min run died from an unnamed E_INVALIDARG while the gate stayed silent throughout (no skips logged).

Why I think plain "skip" is wrong here: these six copies are the title legally walking a mip chain through D3D12's own block-family aliasing (src_size measured in source texels, each destination level exactly half). Raw recording of such chains worked in every earlier build for weeks (my #2914-era data too); the failing case I originally reported was different (R32G32B32A32_TYPELESS 256×256 box into a 128×128-texel mip). Your own bounce machinery exists precisely for geometry mismatches — it looks like on copy_compatible pairs the geometry check should fall through to the bounce path with a correctly translated layout rather than drop the call.

Also worth checking: the OOB half suggests some caller advances subresource indices without clamping against the host resource's descriptor after a drop — a bounds check on the index itself (not just region fit) may be needed alongside the fit check.

Local status right now: running this exact scene with VICTORY_GEOMETRY_COPIES=0 (+ #2305 temporarily removed while bisecting the unnamed variant) — I'll follow up with how the bar scene holds up without the gate.

**@⁠tarakanovalexey** on GitHub · 2026-11-30 00:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7265250823) Re-testing update — your fix does resolve the copy-class failures I reported (zero `extends past` / format messages since `097b507`), **but the validation interacts badly with one specific copy pattern, and that chain kills the list differently**: **Failure chain, verbatim (run `victory-nvidia-play-20261129-234511`, ~33 min in, bar-area scene):** ``` WARN victory_gpu::list: skipping out-of-bounds or unaligned CopyTextureRegion count=1 src_fmt=3 dst_fmt=78 src_size=(256, 256, 1) src_box=None dst_pos=(0, 0, 0) dst_size=(128, 128, 1) WARN victory_gpu::list: ... count=2 ... src_size=(128, 128, 1) ... dst_size=(64, 64, 1) WARN victory_gpu::list: ... count=3 ... (64,64)->(32,32) count=4 (32,32)->(16,16) count=5 (16,16)->(8,8) count=6 (8,8)->(4,4) ``` — six consecutive whole-mip copies of one chain (fmt `3 -> 78`, each level half the previous, full-subresource, no box), all judged out-of-bounds by `copy_geometry_fits` and **dropped outright**. Immediately after them, at the very next batch of lists: ``` D3D12: ID3D12CommandList::CopyTextureRegion: D3D12_TEXTURE_COPY_LOCATION::Subresource is too large for the associated resource. The value is 6, when the resource only has 6 subresources. id=850 The value is 7, when the resource only has 6 subresources. The value is 8, when the resource only has 6 subresources. → Close(): a host command list did not close (0x80070057): a command recorded into it was invalid ``` So: skip-cascade → someone keeps advancing the subresource index down the same chain → writes land past the host resource's real level count → `Close()` fails. Session-wide totals: exactly 6 skips, 4 OOBs, one death. Earlier in the same build stack, another ~31-min run died from an unnamed `E_INVALIDARG` while the gate stayed silent throughout (no skips logged). **Why I think plain "skip" is wrong here:** these six copies are the title legally walking a mip chain through D3D12's own block-family aliasing (`src_size` measured in source texels, each destination level exactly half). Raw recording of such chains worked in every earlier build for weeks (my #2914-era data too); the failing case I originally reported was different (`R32G32B32A32_TYPELESS 256×256 box into a 128×128-texel mip`). Your own bounce machinery exists precisely for geometry mismatches — it looks like on `copy_compatible` pairs the geometry check should **fall through to the bounce path with a correctly translated layout** rather than drop the call. Also worth checking: the OOB half suggests some caller advances subresource indices without clamping against the *host* resource's descriptor after a drop — a bounds check on the index itself (not just region fit) may be needed alongside the fit check. Local status right now: running this exact scene with `VICTORY_GEOMETRY_COPIES=0` (+ #2305 temporarily removed while bisecting the unnamed variant) — I'll follow up with how the bar scene holds up without the gate.
Author
Owner

@⁠Nirkster on GitHub · 2026-11-30 00:52 UTC · original · edited 2026-11-30 00:59 UTC

Thanks for the detailed follow-up and the runtime logs, @⁠tarakanovalexey. I think these are two related symptoms, but the second is not caused by the first:

  1. Mip requests 0..=5 fail the geometry check; requests 6..=8 expose an independent subresource bounds bug.
    The title issues copy requests for subindices 0..=8 regardless of whether earlier requests are skipped. The first six requests have source extents from 256×256 down to 8×8, while the corresponding host BC3 mips run from 128×128 down to 4×4. The geometry guard rejects those copies; without that guard, the first request would hit the earlier id=858 failure.

    The later id=850 errors occur because the host resource has only six subresources, yet requests for indices 6..=8 still reach D3D12. In 097b507, mip_size used sub % mips, which could make an out-of-range index look like an in-range mip during geometry validation. 92065d2 now checks source and destination subresource indices against their resource's subresource count before recording the copy.

  2. A bounce buffer cannot make the first set of copies fit.
    One R32G32B32A32 texel is 16 bytes — the same storage size as one BC3 block, which covers 4×4 texels. So a 256×256 source corresponds to a 1024×1024 BC3 extent, whereas a 128×128 destination has only 32×32 BC3 blocks. This points to a host texture size or mip-mapping mismatch upstream of the copy operation.

I added the subresource bounds checks in 92065d2 (including two-plane depth/stencil resources) and extended the RTX 5070 Ti D3D12 test to exercise an out-of-range destination subresource (dst_sub = 6). The synthetic test verifies that the invalid copies are skipped and Close() succeeds; it does not establish that the skipped mip chain renders correctly. If you can retest 92065d2 in the same scene, that will tell us whether the host-size mismatch needs a separate fix.

Update: Just noticed PR #3062 addresses that exact upstream resource::held_only / base-level mismatch in copy_texture_region (mapping title subresources to held host copies and calling want_level). Testing #3043 together with #3062 is probably the cleanest way to verify the full mip chain in that scene.

**@⁠Nirkster** on GitHub · 2026-11-30 00:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7265656471) · edited 2026-11-30 00:59 UTC Thanks for the detailed follow-up and the runtime logs, @⁠tarakanovalexey. I think these are two related symptoms, but the second is not caused by the first: 1. **Mip requests `0..=5` fail the geometry check; requests `6..=8` expose an independent subresource bounds bug.** The title issues copy requests for subindices `0..=8` regardless of whether earlier requests are skipped. The first six requests have source extents from `256×256` down to `8×8`, while the corresponding host `BC3` mips run from `128×128` down to `4×4`. The geometry guard rejects those copies; without that guard, the first request would hit the earlier `id=858` failure. The later `id=850` errors occur because the host resource has only six subresources, yet requests for indices `6..=8` still reach D3D12. In `097b507`, `mip_size` used `sub % mips`, which could make an out-of-range index look like an in-range mip during geometry validation. `92065d2` now checks source and destination subresource indices against their resource's subresource count before recording the copy. 2. **A bounce buffer cannot make the first set of copies fit.** One `R32G32B32A32` texel is 16 bytes — the same storage size as one `BC3` block, which covers `4×4` texels. So a `256×256` source corresponds to a `1024×1024` `BC3` extent, whereas a `128×128` destination has only `32×32` `BC3` blocks. This points to a host texture size or mip-mapping mismatch upstream of the copy operation. I added the subresource bounds checks in `92065d2` (including two-plane depth/stencil resources) and extended the RTX 5070 Ti D3D12 test to exercise an out-of-range destination subresource (`dst_sub = 6`). The synthetic test verifies that the invalid copies are skipped and `Close()` succeeds; it does not establish that the skipped mip chain renders correctly. If you can retest `92065d2` in the same scene, that will tell us whether the host-size mismatch needs a separate fix. **Update:** Just noticed PR #3062 addresses that exact upstream `resource::held_only` / `base`-level mismatch in `copy_texture_region` (mapping title subresources to held host copies and calling `want_level`). Testing #3043 together with #3062 is probably the cleanest way to verify the full mip chain in that scene.
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 03:12 UTC · original

The new commit 097b5070 (geometry check of texture copies) is merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the diff first: no network access, processes, binaries or dependency changes. It builds. Results from the RTX 4090 run will follow.

**@⁠dyshay** on GitHub · 2026-11-30 03:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7267679237) The new commit 097b5070 (geometry check of texture copies) is merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the diff first: no network access, processes, binaries or dependency changes. It builds. Results from the RTX 4090 run will follow.
Author
Owner

@⁠upipibi on GitHub · 2026-11-30 04:42 UTC · original

Follow-up for the new head 92065d20 (subresource index guard), merged onto main 41adb551, on RTX 30. Synthetic tests only: no title run, no game files. My report above was on 097b5070.

Setup: RTX 3070 8 GB, driver 621.40, Windows 11 (10.0.26100), rustc 1.98.1.

The PR's five tests: 5 passed, 0 failed, in 3/3 runs on the card and 3/3 with VICTORY_D3D12_WARP=1. That includes the extended format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds with its copy to destination subresource 6.

Negative controls on the card, one line of record_texture_copy changed each:

Change Test Result
A: every copy takes the direct path (no bounce) cross_format_bc7_to_bc6h_copy_preserves_every_bit fails, 0x80070057 at close
B: the copy_geometry_fits check off format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds fails, 0x80070057 at close
C (new): the out-of-range destination subresource check off (dst_sub >= dst_subs) same test fails, 0x80070057 at close

So on Ampere the copy to subresource 6 of a one-mip destination does make Close() fail without the new guard, and the extended test catches it. A and B still fail as before, so the new commit did not weaken the earlier two checks.

cargo test -p victory-gpu --lib --locked: PR 926 passed, 1 failed, 60 ignored; main 920 passed, 2 failed, 60 ignored. The failure both share is shader_cache::tests::every_switch_of_the_translator_is_in_the_key (main's own, as above); main's second one is host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started, which comes and goes.

Not tested: the source-side subresource check (the test covers the destination side), and the copies in a title.

Tested with the help of Claude Code (Claude Fable 5.2).

**@⁠upipibi** on GitHub · 2026-11-30 04:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7269007466) Follow-up for the new head 92065d20 (subresource index guard), merged onto main 41adb551, on RTX 30. Synthetic tests only: no title run, no game files. My report above was on 097b5070. **Setup:** RTX 3070 8 GB, driver 621.40, Windows 11 (10.0.26100), rustc 1.98.1. **The PR's five tests:** 5 passed, 0 failed, in 3/3 runs on the card and 3/3 with `VICTORY_D3D12_WARP=1`. That includes the extended `format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds` with its copy to destination subresource 6. **Negative controls on the card**, one line of `record_texture_copy` changed each: | Change | Test | Result | |---|---|---| | A: every copy takes the direct path (no bounce) | `cross_format_bc7_to_bc6h_copy_preserves_every_bit` | **fails**, `0x80070057` at close | | B: the `copy_geometry_fits` check off | `format_compatible_out_of_bounds_copy_is_skipped_and_valid_succeeds` | **fails**, `0x80070057` at close | | C (new): the out-of-range destination subresource check off (`dst_sub >= dst_subs`) | same test | **fails**, `0x80070057` at close | So on Ampere the copy to subresource 6 of a one-mip destination does make `Close()` fail without the new guard, and the extended test catches it. A and B still fail as before, so the new commit did not weaken the earlier two checks. **`cargo test -p victory-gpu --lib --locked`:** PR 926 passed, 1 failed, 60 ignored; main 920 passed, 2 failed, 60 ignored. The failure both share is `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` (main's own, as above); main's second one is `host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started`, which comes and goes. Not tested: the source-side subresource check (the test covers the destination side), and the copies in a title. *Tested with the help of Claude Code (Claude Fable 5.2).*
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-30 05:15 UTC · original · approved these changes

Tested locally merged onto main (41adb551).

  • Merge: Clean merge across crates/victory-gpu/src/list.rs and resource.rs.
  • Tests (RTX 5090):
    • cargo test -p victory-gpu --lib list:: passed.
    • cargo test -p victory-gpu --lib resource:: passed (44 passed; 0 failed; 1 ignored).
  • 0 new warnings.

Clean temporary-buffer bounce for cross-format CopyTextureRegion / CopyResource avoiding D3D12 invalid-copy errors. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-30 05:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#pullrequestreview-6107184209) · **approved these changes** Tested locally merged onto `main` (`41adb551`). - **Merge**: Clean merge across `crates/victory-gpu/src/list.rs` and `resource.rs`. - **Tests (RTX 5090)**: - `cargo test -p victory-gpu --lib list::` passed. - `cargo test -p victory-gpu --lib resource::` passed (`44 passed; 0 failed; 1 ignored`). - 0 new warnings. Clean temporary-buffer bounce for cross-format `CopyTextureRegion` / `CopyResource` avoiding D3D12 invalid-copy errors. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 05:50 UTC · original

The new commit 92065d20 (copies outside the subresources skipped) is merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA). I read the diff first. It builds, and results from the RTX 4090 run will follow.

**@⁠dyshay** on GitHub · 2026-11-30 05:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7270049650) The new commit 92065d20 (copies outside the subresources skipped) is merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs)). I read the diff first. It builds, and results from the RTX 4090 run will follow.
Author
Owner

@⁠tarakanovalexey on GitHub · 2026-11-30 07:28 UTC · original

Retest verdict for 92065d2 — all copy-side failures are gone under real gameplay. Ran the exact bar scene (the one from my original report and every crash in between) with both commits (097b507 + 92065d2), gate active: zero extends past, zero Subresource is too large, zero skip-cascades, zero did not close for the whole session. Previous runs on older builds died at this exact scene.

The session did end in a crash, but an unrelated one — the known victory-image NULL deref class:

unix time 1796023575, process 40588
VIctory: unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x3de5cea (read 0x0: nothing mapped there)
  rbx 0x89b2 rcx 0x8 rdx 0x89b2 ...
  #0 victory-image-...dll+0x3de5cea
  #1 +0x3de2054   #2 +0x5188f   #3 +0x5d1d18 ... (full frames in crashes.log)

Same +0x3de5cea first frame we hit twice before (crashes at 19:52 and 23:03 yesterday on the pre-fix builds) — a recurring victory-image issue independent of the copy path; I'll report it separately in its own thread so it doesn't muddy this PR.

Thanks for the quick 92065d2 — marking this thread's copy-class as verified-on-RTX-4070-Ti for the bar scene. Happy to test again after your next iteration if you extend it further.

**@⁠tarakanovalexey** on GitHub · 2026-11-30 07:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7271779262) Retest verdict for `92065d2` — **all copy-side failures are gone under real gameplay.** Ran the exact bar scene (the one from my original report and every crash in between) with both commits (`097b507` + `92065d2`), gate active: zero `extends past`, zero `Subresource is too large`, zero skip-cascades, zero `did not close` for the whole session. Previous runs on older builds died at this exact scene. The session did end in a crash, but an **unrelated** one — the known `victory-image` NULL deref class: ``` unix time 1796023575, process 40588 VIctory: unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x3de5cea (read 0x0: nothing mapped there) rbx 0x89b2 rcx 0x8 rdx 0x89b2 ... #0 victory-image-...dll+0x3de5cea #1 +0x3de2054 #2 +0x5188f #3 +0x5d1d18 ... (full frames in crashes.log) ``` Same `+0x3de5cea` first frame we hit twice before (crashes at 19:52 and 23:03 yesterday on the pre-fix builds) — a recurring `victory-image` issue independent of the copy path; I'll report it separately in its own thread so it doesn't muddy this PR. Thanks for the quick `92065d2` — marking this thread's copy-class as verified-on-RTX-4070-Ti for the bar scene. Happy to test again after your next iteration if you extend it further.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-30 12:17 UTC · original · edited 2026-11-30 13:58 UTC

@⁠ShalakZ, I tested the exact cross-family mip pair you identified in #3901 through this PR's record_texture_copy, which the placed-twin loop calls. I used GitHub's merge of 92065d2 and current main 41adb551 (f85fdea) on Windows WARP 1.0.22.

The generated source was BC3 sRGB, 1024×1024, 11 mips. The destination was BC7 sRGB, 256×256, seven mips. The fixture copied source mips 2–8 into destination mips 0–6 using the PR's buffer path. The list closed, execution completed, and all 87,376 bytes of block data matched on readback. The existing BC7→BC6H positive test passed alongside it.

Would you be able to retest this exact PR in the same RTX 4080 scene using your instrumented build? A capture that shows the former placed-twin copies taking the buffer path and the list closing would connect this isolated result to the reported crash. Your failing-list analysis

AI-assisted with OpenAI Codex.

Field follow-up. The RTX 4090 report records 14 bounced BC3-sRGB to BC7 copies, with sizes from 256x256 down to 4x4, and reports intact visuals near those copies. The 81-minute run included four other PRs and completed without a crash. That run exercises the buffer path on the RTX 4090. The single-change RTX 4080 comparison above is still the test for the earlier placed-twin failure.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-30 12:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7278233616) · edited 2026-11-30 13:58 UTC @⁠ShalakZ, I tested the exact cross-family mip pair you identified in #3901 through this PR's `record_texture_copy`, which the placed-twin loop calls. I used GitHub's merge of `92065d2` and current main `41adb551` (`f85fdea`) on Windows WARP 1.0.22. The generated source was BC3 sRGB, 1024×1024, 11 mips. The destination was BC7 sRGB, 256×256, seven mips. The fixture copied source mips 2–8 into destination mips 0–6 using the PR's buffer path. The list closed, execution completed, and all 87,376 bytes of block data matched on readback. The existing BC7→BC6H positive test passed alongside it. Would you be able to retest this exact PR in the same RTX 4080 scene using your instrumented build? A capture that shows the former placed-twin copies taking the buffer path and the list closing would connect this isolated result to the reported crash. [Your failing-list analysis](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/3901) AI-assisted with OpenAI Codex. Field follow-up. [The RTX 4090 report](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3043) records 14 bounced BC3-sRGB to BC7 copies, with sizes from 256x256 down to 4x4, and reports intact visuals near those copies. The 81-minute run included four other PRs and completed without a crash. That run exercises the buffer path on the RTX 4090. The single-change RTX 4080 comparison above is still the test for the earlier placed-twin failure.
Author
Owner

@⁠Freeman022026 on GitHub · 2026-11-30 13:53 UTC · original

Tested on v2026.11.29.05 (41adb551) in a patched build that also included #3792 (with the stencil-plane fix), #3487, #3730, and #3816. System: Ryzen 7 7800X3D, RTX 4090 24 GB (driver 621.14), 64 GB RAM, Windows 11, Series X profile, 2560x1440, DLSS Performance (1280x720 to 2560x1440), 2x Frame Generation, RT off.

Before these fixes, 7 of 8 runs ended in a host command list did not close (0x80070057), including a 47-minute stock .05 run that crashed right after entering the city center with 17,512 / 20,642 MB VRAM in use. With this PR applied, an 81-minute run through the same city-center area completed with 0 crashes.

The log recorded 14 bounced cross-format texture copies (src_fmt=78 to dst_fmt=98 and dst_fmt=99, BC3_UNORM_SRGB to BC7_UNORM and BC7_UNORM_SRGB, across mip sizes from 256x256 down to 4x4, 65,536 down to 256 bytes). No visual issues appeared around those copies.

**@⁠Freeman022026** on GitHub · 2026-11-30 13:53 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7280524958) Tested on v2026.11.29.05 (`41adb551`) in a patched build that also included #3792 (with the stencil-plane fix), #3487, #3730, and #3816. System: Ryzen 7 7800X3D, RTX 4090 24 GB (driver 621.14), 64 GB RAM, Windows 11, Series X profile, 2560x1440, DLSS Performance (1280x720 to 2560x1440), 2x Frame Generation, RT off. Before these fixes, 7 of 8 runs ended in `a host command list did not close (0x80070057)`, including a 47-minute stock `.05` run that crashed right after entering the city center with 17,512 / 20,642 MB VRAM in use. With this PR applied, an 81-minute run through the same city-center area completed with 0 crashes. The log recorded 14 bounced cross-format texture copies (`src_fmt=78` to `dst_fmt=98` and `dst_fmt=99`, `BC3_UNORM_SRGB` to `BC7_UNORM` and `BC7_UNORM_SRGB`, across mip sizes from 256x256 down to 4x4, 65,536 down to 256 bytes). No visual issues appeared around those copies.
Author
Owner

@⁠Sweetlllusion on GitHub · 2026-11-30 17:50 UTC · original

Same crash here, at the same point: the end of the dock cutscene after Gone Fishing. Two runs on main c71899d9 ended with a host command list did not close (0x80070057) right as the cinematic finished. #3043 fixes it for me. ( same issue as #3928 )

Setup: RTX 4090 24 GB, 64 GB RAM, Windows 11, Series X profile at 2560x1440, DLSS Quality, frame generation 2x, ray tracing off. Main c71899d9 with VICTORY_MAP_ONCE=1, VICTORY_RESIDENCY_HIGH=1 and VICTORY_PARK_TABLES=1 set.

With #3043 (head 92065d20) applied on top of c71899d9:

  • The dock cinematic passed, and the session ran about 35 minutes. It ended when I closed the window, with no errors in the log.
  • The fix bounced at least 16 copies through its buffer, all at one moment: BC3_UNORM_SRGB (78) into BC7_UNORM (98) and BC7_UNORM_SRGB (99), a full mip chain from 256×256 down to 4×4. That's the BC3→BC7 pair named in #2914. No copies were skipped or reinterpreted.
  • The PR's 5 tests pass on the 4090, including cross_format_bc7_to_bc6h_copy_preserves_every_bit. #3792's 3 twin-copy tests also pass with it merged.

Merge notes for #3043 on current main:

  • In copy_texture_region's placed-twin loop, #3792's host_target mapping should stay. I kept location.footprint.offset = host_sub and replaced the raw CopyTextureRegion with record_texture_copy.
  • Main now closes mod tests before mod bar_scratch_tests, so the PR's appended tests land inside bar_scratch_tests and don't compile. I moved them into their own #[cfg(test)] mod with use super::*.
  • Separately, main's victory-gpu lib tests don't compile at all: two card_pass calls in host.rs (around line 20302 and 20328) are missing the new capture argument. Passing [0; 3], as production code does, fixes them.
**@⁠Sweetlllusion** on GitHub · 2026-11-30 17:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7286914124) Same crash here, at the same point: the end of the dock cutscene after Gone Fishing. Two runs on main `c71899d9` ended with `a host command list did not close (0x80070057)` right as the cinematic finished. #3043 fixes it for me. ( same issue as https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/3928 ) **Setup:** RTX 4090 24 GB, 64 GB RAM, Windows 11, Series X profile at 2560x1440, DLSS Quality, frame generation 2x, ray tracing off. Main `c71899d9` with `VICTORY_MAP_ONCE=1`, `VICTORY_RESIDENCY_HIGH=1` and `VICTORY_PARK_TABLES=1` set. **With #3043** (head `92065d20`) applied on top of `c71899d9`: - The dock cinematic passed, and the session ran about 35 minutes. It ended when I closed the window, with no errors in the log. - The fix bounced at least 16 copies through its buffer, all at one moment: `BC3_UNORM_SRGB` (78) into `BC7_UNORM` (98) and `BC7_UNORM_SRGB` (99), a full mip chain from 256×256 down to 4×4. That's the BC3→BC7 pair named in #2914. No copies were skipped or reinterpreted. - The PR's 5 tests pass on the 4090, including `cross_format_bc7_to_bc6h_copy_preserves_every_bit`. #3792's 3 twin-copy tests also pass with it merged. **Merge notes for #3043 on current main:** - In `copy_texture_region`'s placed-twin loop, #3792's `host_target` mapping should stay. I kept `location.footprint.offset = host_sub` and replaced the raw `CopyTextureRegion` with `record_texture_copy`. - Main now closes `mod tests` before `mod bar_scratch_tests`, so the PR's appended tests land inside `bar_scratch_tests` and don't compile. I moved them into their own `#[cfg(test)] mod` with `use super::*`. - Separately, main's `victory-gpu` lib tests don't compile at all: two `card_pass` calls in `host.rs` (around line 20302 and 20328) are missing the new `capture` argument. Passing `[0; 3]`, as production code does, fixes them.
# Conflicts:
#	crates/victory-gpu/src/list.rs
Author
Owner

@⁠Nirkster on GitHub · 2026-11-30 19:37 UTC · original

Thanks for the RTX 4090 field reports and merge notes, @⁠Freeman022026 & @⁠Sweetlllusion!

Merged latest main (v2026.11.30.03 / e1251c31) into #3043 in 77e43130 — kept #3792's host_sub mapping in the placed-twin loop and moved the 5 tests into mod copy_format_tests. All 5 tests pass on RTX 5070 Ti and the PR is clean/mergeable again.

**@⁠Nirkster** on GitHub · 2026-11-30 19:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7289689557) Thanks for the RTX 4090 field reports and merge notes, @⁠Freeman022026 & @⁠Sweetlllusion! Merged latest `main` (`v2026.11.30.03` / `e1251c31`) into `#3043` in `77e43130` — kept `#3792`'s `host_sub` mapping in the placed-twin loop and moved the 5 tests into `mod copy_format_tests`. All 5 tests pass on RTX 5070 Ti and the PR is clean/mergeable again.
Author
Owner

@⁠frametrace on GitHub · 2026-11-30 20:28 UTC · original

Still reproduces on v2026.11.30.03, and this PR clears it in the scene we tested

RTX 5090, game dump 1.0.2.1, new game from the pause menu, then 5.2 min of the prologue. Release builds from source, all with hardware RT on (VICTORY_HW_RT=1, #3706). Hardware RT was the only setting tested, though a make-up texture copy doesn't look RT-specific to us.

Build Result
v2026.11.30.01 2 of 3 runs ended with "a host command list did not close" (0x80070057), both 2.6 min in
v2026.11.30.03 (latest) the first run ended the same way, 2.6 min in
v2026.11.30.03 + this PR 3 of 3 clean. The bounce log line appeared 7 times in each of runs 2 and 3, so 2 of 2 runs that reached the copy survived. Run 1 never logged it, so it didn't take that path and isn't evidence either way.

The ".03 + this PR" build is code-identical to your 77e43130: the only difference is that our local merge had the tests outside the copy_format_tests module. So these runs test the PR as it stands.

The debug layer names the copy. A diagnostics build of .01 with VICTORY_D3D12_DEBUG=1 logged, at the failing moment:

CopyTextureRegion: The source and destination resource formats are incompatible. The source format is BC3_TYPELESS and the destination format is BC7_TYPELESS.

That message appeared 14 times, all in the one list that failed to close.

Our reading of the code and scene: it's the placed-twin copy in copy_texture_region, between the BC3 make-up texture and a BC7 view over the same memory that the face samples. It's the same pair reported in this comment on #2914.

A second check: before finding this PR, we wrote a narrower patch that only reinterprets the twin copy through a buffer. It cleared the failure too:

  • 3 of 3 clean on .01 and 3 of 3 on .03;
  • it fired in all 6 runs, 8–9 times per run, always BC3_UNORM_SRGB (78) → BC7_UNORM (98), texture to texture.

Counting every run where a fix reached the copy, that's 8 clean, against 3 failures in 4 runs without a fix.

Picture: at half size, the screenshots at minutes 3–5 show the character with no visible corruption. We haven't compared the face closely against a run without the fix.

This may be relevant to other "did not close" reports; only this scene was checked.

**@⁠frametrace** on GitHub · 2026-11-30 20:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7290967392) **Still reproduces on v2026.11.30.03, and this PR clears it in the scene we tested** RTX 5090, game dump 1.0.2.1, new game from the pause menu, then 5.2 min of the prologue. Release builds from source, all with hardware RT on (`VICTORY_HW_RT=1`, #3706). Hardware RT was the only setting tested, though a make-up texture copy doesn't look RT-specific to us. | Build | Result | |---|---| | v2026.11.30.01 | 2 of 3 runs ended with "a host command list did not close" (0x80070057), both 2.6 min in | | v2026.11.30.03 (latest) | the first run ended the same way, 2.6 min in | | v2026.11.30.03 + this PR | 3 of 3 clean. The bounce log line appeared 7 times in each of runs 2 and 3, so 2 of 2 runs that reached the copy survived. Run 1 never logged it, so it didn't take that path and isn't evidence either way. | The ".03 + this PR" build is code-identical to your 77e43130: the only difference is that our local merge had the tests outside the `copy_format_tests` module. So these runs test the PR as it stands. **The debug layer names the copy.** A diagnostics build of .01 with `VICTORY_D3D12_DEBUG=1` logged, at the failing moment: > CopyTextureRegion: The source and destination resource formats are incompatible. The source format is BC3_TYPELESS and the destination format is BC7_TYPELESS. That message appeared 14 times, all in the one list that failed to close. **Our reading of the code and scene:** it's the placed-twin copy in `copy_texture_region`, between the BC3 make-up texture and a BC7 view over the same memory that the face samples. It's the same pair reported in [this comment on #2914](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/2914). **A second check:** before finding this PR, we wrote a narrower patch that only reinterprets the twin copy through a buffer. It cleared the failure too: - 3 of 3 clean on .01 and 3 of 3 on .03; - it fired in all 6 runs, 8–9 times per run, always BC3_UNORM_SRGB (78) → BC7_UNORM (98), texture to texture. Counting every run where a fix reached the copy, that's 8 clean, against 3 failures in 4 runs without a fix. **Picture:** at half size, the screenshots at minutes 3–5 show the character with no visible corruption. We haven't compared the face closely against a run without the fix. This may be relevant to other "did not close" reports; only this scene was checked.
Author
Owner

@⁠paales on GitHub · 2026-11-30 20:52 UTC · original

Written by 🤖:

This fixed a crash for me. "A host command list did not close (0x80070057)" at a cut in the intro, in about 1 of 10 runs. The D3D12 debug layer named the command: CopyTextureRegion from BC3_TYPELESS into BC7_TYPELESS. With this PR merged, a run that made that copy sent it through a buffer and went on. There has been no such crash in about 60 runs since.

PC: RTX 5070 Ti 16 GB, Ryzen 9 5900X, Windows 11. Builds: main 41adb551 and later 84bd61e2, with #3918, #1727 and #3553. On 84bd61e2 the twin copy in list.rs conflicts with #3792: the merge takes main's host_sub as the offset, with this PR's record_texture_copy.

**@⁠paales** on GitHub · 2026-11-30 20:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7291581303) _Written by 🤖:_ This fixed a crash for me. "A host command list did not close (0x80070057)" at a cut in the intro, in about 1 of 10 runs. The D3D12 debug layer named the command: `CopyTextureRegion` from `BC3_TYPELESS` into `BC7_TYPELESS`. With this PR merged, a run that made that copy sent it through a buffer and went on. There has been no such crash in about 60 runs since. PC: RTX 5070 Ti 16 GB, Ryzen 9 5900X, Windows 11. Builds: `main` 41adb551 and later 84bd61e2, with #3918, #1727 and #3553. On 84bd61e2 the twin copy in `list.rs` conflicts with #3792: the merge takes main's `host_sub` as the offset, with this PR's `record_texture_copy`.
Author
Owner

@⁠MrBigBritches on GitHub · 2026-12-01 00:11 UTC · original

This fixed the A host command list did not close (0x80070057) crash for me as well.

**@⁠MrBigBritches** on GitHub · 2026-12-01 00:11 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7296048363) This fixed the `A host command list did not close (0x80070057)` crash for me as well.
Author
Owner

@⁠tillo88 on GitHub · 2026-12-01 12:06 UTC · original

Crash and speed check of #3043 (head 77e43130) 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):

build runs list-close / device-lost failures
v2026.11.30.03 27 5: 3 at the prison→plane cutscene cut (+2:15 to +2:18), 1 at +2:40, 1 at +2:49
+ #3043 7 0

Base errors were a host command list did not close (0x80070057) (2) and relay: the device was lost ... (0x887A0006) (3). With #3043 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. Together with #4080, #4522 and #3979 (same kind of fix, same release), 0 of 30 runs stopped against 5 of 27 on the bare release, about 2% by chance (Fisher's exact test).

The PR's line bounced cross-format texture copy through temporary buffer appears in 2 of the 7 runs, both at +2:16, the same second where base runs fail at the cut:

  • one run: 7 bounces, src_fmt=78 dst_fmt=83 (BC3_UNORM_SRGB → BC5_UNORM), 256x256 down to 4x4;
  • another run: 14 bounces, src_fmt=78 dst_fmt=98 and dst_fmt=99 (BC3_UNORM_SRGB → BC7_UNORM / BC7_UNORM_SRGB).

Both runs went on to the end of the route. In the other 5 runs no bounce was logged.

Speed (measured runs only, warm-up excluded):

build runs fps (range) submitting thread ms refresh ms p95 ms p99 ms
v2026.11.30.03 15 32.02 (31.72–32.46) 20.51 6.42 47.7 62.7
+ #3043 6 32.04 (31.77–32.31) 20.35 6.34 48.3 61.9

+0.1% fps: no measurable difference. The higher mean p95 comes from one run (52.2 ms, the run with the 14 bounces); the other five had 47.1–48.0 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.

**@⁠tillo88** on GitHub · 2026-12-01 12:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3043#issuecomment-7310668300) Crash and speed check of #3043 (head 77e43130) 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): | build | runs | list-close / device-lost failures | |---|---|---| | v2026.11.30.03 | 27 | 5: 3 at the prison→plane cutscene cut (+2:15 to +2:18), 1 at +2:40, 1 at +2:49 | | + #3043 | 7 | 0 | Base errors were `a host command list did not close (0x80070057)` (2) and `relay: the device was lost ... (0x887A0006)` (3). With #3043 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. Together with #4080, #4522 and #3979 (same kind of fix, same release), 0 of 30 runs stopped against 5 of 27 on the bare release, about 2% by chance (Fisher's exact test). The PR's line `bounced cross-format texture copy through temporary buffer` appears in 2 of the 7 runs, both at +2:16, the same second where base runs fail at the cut: - one run: 7 bounces, `src_fmt=78 dst_fmt=83` (BC3_UNORM_SRGB → BC5_UNORM), 256x256 down to 4x4; - another run: 14 bounces, `src_fmt=78 dst_fmt=98` and `dst_fmt=99` (BC3_UNORM_SRGB → BC7_UNORM / BC7_UNORM_SRGB). Both runs went on to the end of the route. In the other 5 runs no bounce was logged. **Speed** (measured runs only, warm-up excluded): | build | runs | fps (range) | submitting thread ms | refresh ms | p95 ms | p99 ms | |---|---|---|---|---|---|---| | v2026.11.30.03 | 15 | 32.02 (31.72–32.46) | 20.51 | 6.42 | 47.7 | 62.7 | | + #3043 | 6 | 32.04 (31.77–32.31) | 20.35 | 6.34 | 48.3 | 61.9 | +0.1% fps: no measurable difference. The higher mean p95 comes from one run (52.2 ms, the run with the 14 bounces); the other five had 47.1–48.0 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.
This pull request has changes conflicting with the target branch.
  • apps/victory/src/play.rs
  • crates/victory-gpu/src/list.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-hle/src/modules/xmem.rs
  • scripts/play-nvidia.ps1
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3043/head:github-bot/gh-3043'
git switch 'github-bot/gh-3043'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3043'
git switch 'github-bot/gh-3043'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3043'
git switch 'github-bot/gh-3043'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3043'
git switch 'main'
git merge --squash 'github-bot/gh-3043'
git switch 'main'
git merge --ff-only 'github-bot/gh-3043'
git switch 'main'
git merge 'github-bot/gh-3043'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3043
No description provided.