Tests: cover XG copy argument forms across pitched subresources #2483

Open
github-bot wants to merge 2 commits from github-bot/gh-2483 into main AGit
Owner

@⁠anes66 on GitHub · 2026-11-25 20:01 UTC · original
anes66:test/pr1435-current-main-manual → main · +170 −3 · 1 files · 2 commits · draft

Stacked on #1435; only the top commit, 767f439, belongs to this PR. The dependency keeps its original author.

The existing ABI regression covers a single RGBA8 surface. These two CPU tests extend it to pitched mip levels, array slices, separate depth/stencil planes, BC1/BC3 blocks and 3D textures. They also cover a source whose address space is reserved but not committed, and stale upper stack-slot bits around the added 32-bit argument.

What is in it

  • crates/xcl/src/hle/xg.rs, tests only: 10 descriptors and 512 copy calls through the six- and seven-argument vtable forms. Expected bytes are placed per element; reads use that reference rather than the preceding copy's output. Whole-buffer comparisons check row/slice padding, other subresources and trailing sentinels too.
  • Argument decoding checks a reserved PAGE_NOACCESS source without reading it, three added-argument values, three stale upper halves, and unused trailing-slot values in the older form.

Tested

  • Windows 10 22H2 (19045), Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug; CPU only. An RTX 3060 12 GB is installed but no GPU was queried or used by these tests.
  • Unmodified #1435 head 14c8a2d: cargo test --locked -p xcl --lib hle::xg::tests -j2 -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored, 0 skipped.
  • With these tests on that head (8b4d42c): the same command: 6 passed, 0 failed, 0 ignored, 0 skipped.
  • With #1435 and these tests on main e0d93c8 (this branch, 767f439): the same command: 6 passed, 0 failed, 0 ignored, 0 skipped.
  • The same tests on the manual A/B tree (main 2898511 + #1435, head aec6fa1) also pass in release: 6 passed, 0 failed, 0 ignored, 0 skipped; 512 copy calls.
  • Negative controls, restored before the passing runs: adding one to the newer form's decoded row pitch fails the copy matrix; requiring committed memory when detecting the source fails the reserved-source test.
  • GitHub Windows CI on this head passes: build plus 1,425 reported passed, 0 failed, 46 ignored across 37 test binaries/doc-test groups. The script reports 346 GPU skips within those pass counts; they are not hardware coverage. Both added tests ran and passed. The runner has no hardware GPU or game sample data, and the workflow excludes the test-title launch.

Not tested

  • Local full workspace suite, hardware GPU execution, the console-library oracle or a retail-title run with this patch. No proprietary files are needed by the new tests.

Merge prerequisites

  • This is a draft dependency stack. Once #1435 lands, rebasing leaves only the test commit; until then the combined diff also contains its runtime change.
  • The description check currently requires the project's disclosure section and paired title smoke runs. Those runs have not been made on this head; no smoke blocks are supplied as passing results.
**@⁠anes66** on GitHub · 2026-11-25 20:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/2483) `anes66:test/pr1435-current-main-manual` → `main` · +170 −3 · 1 files · 2 commits · draft Stacked on #1435; only the top commit, `767f439`, belongs to this PR. The dependency keeps its original author. The existing ABI regression covers a single RGBA8 surface. These two CPU tests extend it to pitched mip levels, array slices, separate depth/stencil planes, BC1/BC3 blocks and 3D textures. They also cover a source whose address space is reserved but not committed, and stale upper stack-slot bits around the added 32-bit argument. **What is in it** - `crates/xcl/src/hle/xg.rs`, tests only: 10 descriptors and 512 copy calls through the six- and seven-argument vtable forms. Expected bytes are placed per element; reads use that reference rather than the preceding copy's output. Whole-buffer comparisons check row/slice padding, other subresources and trailing sentinels too. - Argument decoding checks a reserved `PAGE_NOACCESS` source without reading it, three added-argument values, three stale upper halves, and unused trailing-slot values in the older form. **Tested** - Windows 10 22H2 (19045), Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug; CPU only. An RTX 3060 12 GB is installed but no GPU was queried or used by these tests. - Unmodified #1435 head `14c8a2d`: `cargo test --locked -p xcl --lib hle::xg::tests -j2 -- --nocapture --test-threads=1`: 4 passed, 0 failed, 0 ignored, 0 skipped. - With these tests on that head (`8b4d42c`): the same command: 6 passed, 0 failed, 0 ignored, 0 skipped. - With #1435 and these tests on `main` `e0d93c8` (this branch, `767f439`): the same command: 6 passed, 0 failed, 0 ignored, 0 skipped. - The same tests on the manual A/B tree (`main` `2898511` + #1435, head `aec6fa1`) also pass in release: 6 passed, 0 failed, 0 ignored, 0 skipped; 512 copy calls. - Negative controls, restored before the passing runs: adding one to the newer form's decoded row pitch fails the copy matrix; requiring committed memory when detecting the source fails the reserved-source test. - [GitHub Windows CI on this head](https://github.com/xcl-dev/xcl/actions/runs/45690846488) passes: build plus 1,425 reported passed, 0 failed, 46 ignored across 37 test binaries/doc-test groups. The script reports 346 GPU skips within those pass counts; they are not hardware coverage. Both added tests ran and passed. The runner has no hardware GPU or game sample data, and the workflow excludes the test-title launch. **Not tested** - Local full workspace suite, hardware GPU execution, the console-library oracle or a retail-title run with this patch. No proprietary files are needed by the new tests. **Merge prerequisites** - This is a draft dependency stack. Once #1435 lands, rebasing leaves only the test commit; until then the combined diff also contains its runtime change. - The description check currently requires the project's disclosure section and paired title smoke runs. Those runs have not been made on this head; no smoke blocks are supplied as passing results.
A retail game crashed during its world loading, every run: an
access violation in a memcpy writing to title memory that was never
reserved, mapped or committed. The writer was XCL's
XGTextureAddressComputer::CopyFromSubresource (vtable #9), called by the
game as (linear dst, plane, subresource, 0, tiled src, row pitch, slice
pitch): its library has a 32-bit argument before the source pointer,
which the library the oracle test uses (XDefiant's) does not. Read the
6-argument way, the source was the 0 dword with the stack slot's old
upper half, and the row pitch the low half of the real source pointer,
so the second row went gigabytes past the destination.

The game calls both forms, so they are told apart per call: a value of
16 bits or less in the fourth slot with address space in use at the
fifth is the newer form (address space, not readable memory: title pages
are committed on first use). A nonzero added argument is logged once and
ignored; its meaning is not known.

New test: both forms tile the same bytes and read them back, with
garbage in the upper half of the added argument's slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:31:47 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 20:34 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 20:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2483#issuecomment-7173871668) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 20:52 UTC · original

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of the three new copy tests (copy_argument_forms_keep_reserved_sources_and_stack_dword_boundaries, copy_argument_forms_preserve_pitched_mips_planes_arrays_and_volumes, subresource_copies_take_both_argument_forms): 3 passed.

**@⁠SlopTart** on GitHub · 2026-11-25 20:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2483#issuecomment-7174295345) `gpu_` suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of the three new copy tests (`copy_argument_forms_keep_reserved_sources_and_stack_dword_boundaries`, `copy_argument_forms_preserve_pitched_mips_planes_arrays_and_volumes`, `subresource_copies_take_both_argument_forms`): 3 passed.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2483/head:github-bot/gh-2483'
git switch 'github-bot/gh-2483'

Merge

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