Skip to content

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

Draft
anes66 wants to merge 2 commits into
xcl-dev:mainfrom
anes66:test/pr1435-current-main-manual
Draft

anes66 wants to merge 2 commits into
xcl-dev:mainfrom
anes66:test/pr1435-current-main-manual

Conversation

@anes66

@anes66 anes66 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #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 D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #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 + D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #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 D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #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.

lukastaro and others added 2 commits November 25, 2026 20:57
…rgument

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 xcl-dev#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 <noreply@anthropic.com>
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@SlopTart

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants