Skip to content

this_first: a test of the stale-vtable return buffer and either argument order - #263

Merged
ivall merged 2 commits into
xcl-dev:mainfrom
ryosen0:this-first-tests
Nov 23, 2026
Merged

ivall merged 2 commits into
xcl-dev:mainfrom
ryosen0:this-first-tests

Conversation

@ryosen0

@ryosen0 ryosen0 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

A test for real::this_first (7a033c8) - synthetic objects only, no GPU and no title.

Covers:

  • either argument order with one adopted object;
  • neither adopted / null: unchanged; one null argument: the other is this, either position;
  • the retail case: an object off the stack and a stack return buffer whose first word is a stale copy of its vtable pointer - both look adopted, and the stack one is the buffer in either order;
  • both on the stack, neither the device: the C++ way (a).

The fake adopted object is built the way queue_tests builds its fake queue (the extension vtable's word before slot 0 points at a PC table, registered in EXTS, removed after).

While writing it I also ran a native MSVC x64 probe of the member-call ABI on this machine (Ryzen 7 9800X3D, Windows 11, MSVC 14.44): for a member function returning a 16-byte struct, rcx = this and rdx = the hidden return buffer, and the compiler reuses the same stack slot for the return buffer across calls at the same stack depth - which is how a stale vtable copy ends up in it. Consistent with the crash this fixed.

Tested

  • Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, rustc 1.100.0-nightly, release
  • cargo test --workspace -- --test-threads=4: 612 passed, 0 failed, 20 ignored; plus the other suites: 13+3+1+3+2+7+1+1+2+1+6 passed, 0 failed, 4+12 ignored
  • SKIPPED on this adapter: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • Regression run (below): main 1937 frames / PR head 2179 frames in 90 s, no device removal, no crash, peak commit 15.4 GB / 14.7 GB

Not tested

  • AMD GPUs, wave64 hardware
  • the retail title's later gameplay (the run reaches the first menu; audio stutter observed there - see below)
  • XAudio2 behaviour: the 90 s runs show the menu's audio stuttering on both main and this PR (the PR adds a test only, no runtime change), so this is not covered here

Regression run
main (9ab7d76):

xcl-smoke v1
commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 1937 (PresentX 1937)
presents per 2 s (last 3): 37 36 35
device removals: 0
crashes: 0
peak commit: 15419 MB

this PR's head (130a143, no uncommitted changes):

xcl-smoke v1
commit: 130a14387196432caa3a37786dbd847667b1d0ab
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2179 (PresentX 2179)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14659 MB

AI use
GPT-6.2 Astra (API model selector), working as the coding agent in this session: wrote the test and this description, ran the tests, the smoke runs and the native ABI probe on the machine above. The human contributor reviewed the diff and the measurements.

@PHeitor1

Copy link
Copy Markdown

Tested 130a143 merged onto main 9ab7d76 on RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X (Zen 3), Windows 11 Pro 26300 (native), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*. Baseline main 9ab7d76: 651 passed, 0 failed, 40 ignored.

Pass: 652 passed, 0 failed, 40 ignored. GPU skips: the same 2 as on main (no wave64).

Run and written with Claude Code (Claude Opus 5.5).

@requiemsnkrp

Copy link
Copy Markdown
Contributor

Tested 130a143 on NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1714 / 617.14, 32-lane waves), Ryzen 5 5600X, Windows 11 Pro 25H2 (26200.9974), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17 (Windows SDK), debug: pass.

Tested

  • cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip test_title_draws_with_a_root_signature_under_the_debug_layer: 650 passed, 0 failed, 40 ignored
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
  • PR's test: hle::d3d12x::real::this_first_tests::a_return_buffer_with_a_stale_vtable_copy_is_not_the_object ... ok
  • main 4017f8f on the same machine, same command: 650 passed, 0 failed, 40 ignored, same 2 SKIPPED. The test commit 2f5979e is on 9ab7d76; the head 130a143 is a merge of main into the branch.
  • Tested the head itself; it merges cleanly into main 4017f8f (git merge-tree), the merge result was not tested.
  • Not run here: the two e2e tests that run the test title (test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer): they open the XCL game window and this PC was in use (the 2 "filtered out").

Not tested

  • Retail title regression run (no game copy here; the PR adds a test only).

AI use: Claude Code with Claude Opus 5.5 (ran the tests and wrote this report).

@ivall
ivall merged commit 8f53764 into xcl-dev:main Nov 23, 2026
2 of 4 checks 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