fix: stage only the requested rows for boxed VIctory texture uploads #332

Open
github-bot wants to merge 1 commit from github-bot/gh-332 into main AGit
Owner

@⁠mauroalvare on GitHub · 2026-11-26 03:59 UTC · original
mauroalvare:codex/victory-texture-upload-rows → main · +370 −10 · 4 files · 1 commits · open

Change

CopyTextureRegion staged the whole buffer footprint when uploading a source box to a texture. A small patch could allocate and fill an upload buffer sized for the entire source.

For a 2D box with whole block rows, stage the selected rows, keep the row pitch and horizontal coordinates, and rebase the vertical coordinates. The staging fill reads title memory at submission. A multi-slice footprint or a box with unaligned block rows takes the full-footprint path. This is the buffer-to-texture path in the VIctory runtime built by tools/lancer_victory.ps1.

Verification

Windows x64 MSVC debug builds on the RTX 5070 Ti with driver 621.40. The baseline uses c4c93bdc413191a9dc909998d2d53080a3f0c880 with the staging code extracted and the same synthetic regression.

Run from third_party/victory.

cargo test --locked --offline -j 2 -p victory-gpu --lib list::texture_upload::tests::boxed_upload_stages_the_rows_it_copies -- --exact --nocapture --test-threads=1
Synthetic measurement for six boxed uploads Base Fix
Upload buffers created 6 6
Total upload buffer capacity 24 MiB 1.5 MiB
Bytes staged by the CPU 24 MiB 1.5 MiB
Destination bytes verified by readback 192 KiB 192 KiB

Three fresh-process A/B pairs reproduced the byte-count assertion failing on the base and passing with the fix.

Command Result
baseline-test.exe --test-threads=1 183 passed, 4 failed, 3 ignored
fixed-test.exe --test-threads=1 185 passed, 3 failed, 3 ignored. Includes the block-row test
cargo test --locked --offline -j 2 -p victory-loader --test load_probe 2 passed
cargo check --locked --offline -j 1 -p victory-gpu --features diagnostics Passed
cargo xtask policy 201 files passed
cargo test --release --manifest-path rust/Cargo.toml --locked --offline -j 1 Reused 12 passes from the matching Rust and TomBox sources
python -m pytest -ra 1,665 passed with the required runtime and the RTX 5070 Ti
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools All checks passed
git diff --check Passed

The full victory-gpu runs used the captured Cargo test binaries. Three assertions reproduced on both builds.

  • descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed got None where it expected Some(1).
  • indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots got 0 where it expected 1 in the first result slot on WARP.
  • indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others reported the first differing offsets at 0 through 7 on WARP.

Oracle and test data

The fixture submits six 64×64 patches from a generated 1024×1024 RGBA buffer into different destination strips. It fills the source after recording and checks every destination byte after readback, including the pixels outside the patches. The layout unit test covers aligned BC1 rows, the tight final row, and full-footprint fallbacks. D3D12 CopyTextureRegion

Codex provided AI assistance with the investigation, implementation, and validation.

**@⁠mauroalvare** on GitHub · 2026-11-26 03:59 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/332) `mauroalvare:codex/victory-texture-upload-rows` → `main` · +370 −10 · 4 files · 1 commits · open ## Change `CopyTextureRegion` staged the whole buffer footprint when uploading a source box to a texture. A small patch could allocate and fill an upload buffer sized for the entire source. For a 2D box with whole block rows, stage the selected rows, keep the row pitch and horizontal coordinates, and rebase the vertical coordinates. The staging fill reads title memory at submission. A multi-slice footprint or a box with unaligned block rows takes the full-footprint path. This is the buffer-to-texture path in the VIctory runtime built by `tools/lancer_victory.ps1`. ## Verification Windows x64 MSVC debug builds on the RTX 5070 Ti with driver 621.40. The baseline uses `c4c93bdc413191a9dc909998d2d53080a3f0c880` with the staging code extracted and the same synthetic regression. Run from `third_party/victory`. ```powershell cargo test --locked --offline -j 2 -p victory-gpu --lib list::texture_upload::tests::boxed_upload_stages_the_rows_it_copies -- --exact --nocapture --test-threads=1 ``` | Synthetic measurement for six boxed uploads | Base | Fix | | --- | ---: | ---: | | Upload buffers created | 6 | 6 | | Total upload buffer capacity | 24 MiB | 1.5 MiB | | Bytes staged by the CPU | 24 MiB | 1.5 MiB | | Destination bytes verified by readback | 192 KiB | 192 KiB | Three fresh-process A/B pairs reproduced the byte-count assertion failing on the base and passing with the fix. | Command | Result | | --- | --- | | `baseline-test.exe --test-threads=1` | 183 passed, 4 failed, 3 ignored | | `fixed-test.exe --test-threads=1` | 185 passed, 3 failed, 3 ignored. Includes the block-row test | | `cargo test --locked --offline -j 2 -p victory-loader --test load_probe` | 2 passed | | `cargo check --locked --offline -j 1 -p victory-gpu --features diagnostics` | Passed | | `cargo xtask policy` | 201 files passed | | `cargo test --release --manifest-path rust/Cargo.toml --locked --offline -j 1` | Reused 12 passes from the matching Rust and TomBox sources | | `python -m pytest -ra` | 1,665 passed with the required runtime and the RTX 5070 Ti | | `python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools` | All checks passed | | `git diff --check` | Passed | The full `victory-gpu` runs used the captured Cargo test binaries. Three assertions reproduced on both builds. - `descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed` got `None` where it expected `Some(1)`. - `indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots` got `0` where it expected `1` in the first result slot on WARP. - `indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others` reported the first differing offsets at 0 through 7 on WARP. ## Oracle and test data The fixture submits six 64×64 patches from a generated 1024×1024 RGBA buffer into different destination strips. It fills the source after recording and checks every destination byte after readback, including the pixels outside the patches. The layout unit test covers aligned BC1 rows, the tight final row, and full-footprint fallbacks. [D3D12 CopyTextureRegion](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion) Codex provided AI assistance with the investigation, implementation, and validation.
Rebase a 2D source box onto a smaller staging footprint while keeping its row pitch and deferred fill. Verify the staged byte count and the resulting texture on D3D12, including pixels outside the copied patches.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:43:21 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-332'
git switch 'github-bot/gh-332'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-332'
git switch 'github-bot/gh-332'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-332'
git switch 'main'
git merge --squash 'github-bot/gh-332'
git switch 'main'
git merge --ff-only 'github-bot/gh-332'
git switch 'main'
git merge 'github-bot/gh-332'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.