d3d12_xs tests: three --lib tests that fail or crash on a release build (dangling temporary, function address, stale map entry) #276
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!276
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/276/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@QuentinDanblon on GitHub · 2026-11-23 10:53 UTC · original
QuentinDanblon:fix/d3d12xs-hw-lib-tests→main· +3 −3 · 3 files · 3 commits · closed without mergingLibrary / area:
d3d12_xs, tests only (pso_xrec.rstest module,device_console_fix.rstest module,dbcount_tests.rs)Exports changed (exports.txt rows): none
Source of the behaviour: none needed, no runtime behaviour changes. Three tests of the
--libsuite fail or kill the test process on this PC (RTX 5090, Windows 11, release build). CI does not run them:rust.ymlonly runscargo checkford3d12_xs.Three commits, one per test. Each fix is in the test, 3 files, +3 -3.
1.
pso_xrec::tests::unknown_root_signatures_ext_entries_and_cached_blobs_are_not_recorded(ff387bb)The whole test process died with an access violation, 3 runs of 3 with
--exact. Under cdb the fault is inpso_xrec::captureatpso_xrec.rs:294, reading the semantic name of an input-layout element.The test built its descriptor with
gfx_desc(&vs, &ps, &[elem(..)], ..)inside alet. The element array is a temporary dropped at the end of that statement, so the descriptor kept a dangling pointer. The first three captures return before they read the input layout; only the last one dereferenced it.captureis right to read through the title's pointer: the D3D12 create call requires the arrays to be valid for the duration of the call. The array is now bound to a local that outlives every capture. 5 runs of 5 pass.2.
device_console_fix::tests::console_heap_properties_create_on_pc_through_every_wrapped_path(dd6d6f7)Failed on every run at
device_console_fix.rs:384: the test compared slot 26 of the wrapped vtable withget_custom_heap_properties_x as usize, and the two addresses differed.In cdb,
x *!*get_custom_heap_properties_x*lists two symbols of that name in the release test binary. The build holds two copies of that small function, and Rust does not guarantee one address per function. The wrapper does install our function; the test compared two copies of it.The address check is removed. The test still calls slot 26 with a sentinel-filled struct and requires the console values for heap types 1, 2 and 3, then checks that the PC runtime rejects those values unwrapped and that every wrapped create path accepts them.
Checked that the remaining assertions catch a slot 26 that is not replaced: with slot 26 taken from the unwrapped device (local change, not committed) the test process dies with an access violation, because the console order of the arguments is not the PC one.
3.
dbcount::tests::translated_pixel_shaders_with_uavs_keep_their_source(a7ab19e)Failed in full runs with
--test-threads=1: 2 runs of 2 on the two commits above. The test asserted thatPS_SRCholds no entry at the address of a pixel shader without UAVs.PS_SRCis process-wide, keyed by the address of the bytecode, and never shrinks, so an earlier test can leave an entry at an address the allocator later gives to this test.Measured with a probe in place of the assertion, 2 runs of 2: the entry at the address of the plain shader had length 3304, the plain shader 2512 bytes, the UAV shader of this test 3152 bytes. It belongs to neither.
The assertion now uses the rule
strip_psuses in production, which reads an entry only when its length and hash match the bytecode. I did not look for which earlier test notes that entry.Tests
On
a7ab19e(basede1e1da), RTX 5090 PC, Windows 11:cargo test -p d3d12_xs --release --lib -- --test-threads=1: 3 runs, each 662 passed, 1 failed, 71 ignored.xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs. It needs a consoled3d12_xs.dll, which I do not have. Not touched.pr_gate.py --base origin/main: 0 problems.Not covered, not claimed
Other tests compare a vtable slot with a function address in the same way and pass today:
cl_console_fix.rs:413-420,console_slots.rs:591-593,cl2_state.rs:2398. The same duplication could break them in another build. I did not change them.The second fix was checked on the RTX 5090 only.
Whether these tests behave the same on your machine or in a debug build is not known to me.
cargo test -p d3d12_xspasses for what is listed aboveNo game or console files and no binaries included
No fake success; nothing in the runtime changes
🤖 Generated with Claude Code
device_console_fix::tests::console_heap_properties_create_on_pc_through_every_wrapped_path failed on every run in a release build at device_console_fix.rs:384: assertion `left == right` failed left: 140695242310080 right: 140695240276176 The assertion compared slot 26 of the wrapped device vtable with get_custom_heap_properties_x as usize. In cdb, `x *!*get_custom_heap_properties_x*` lists two symbols of that name in the release test binary: the build holds two copies of that small function, and Rust does not guarantee that a function has a single address. The wrapper does install our function; the test compared two copies of it. The address check is removed. The test still calls slot 26 with a sentinel-filled HeapProperties and requires the console values from custom_heap_properties for heap types 1, 2 and 3, then checks that the PC runtime rejects those values unwrapped and that every wrapped create path accepts them. Checked that the remaining assertions still catch a slot 26 that is not replaced: with slot 26 taken from the unwrapped device (temporary local change, not committed) the test process dies with an access violation (exit 139), because the console order of the arguments (result pointer first, object second) is not the PC one. Run: cargo test -p d3d12_xs --release --lib -- --exact <test> on an NVIDIA RTX 5090: passes. Co-Authored-By: Claude Fable 5.2 <[email protected]>@omonkeyz on GitHub · 2026-11-23 13:45 UTC · original
Applied locally on main with your authorship kept (cherry-picked,
c40dd17); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.@omonkeyz on GitHub · 2026-11-25 13:09 UTC · original
Applied on main in
c40dd17(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed