d3d12_xs tests: size the non-oversize test textures from GetResourceAllocationInfo #322

Closed
GDAgent wants to merge 1 commit from upstream-pr/322 into main
GDAgent commented 2026-11-23 19:02:10 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by GDAgent on 2026-11-23T19:02:10Z.


What

Tests only (alias.rs, placed_offset.rs, title_shadow_tests.rs). No runtime change, no exports change.

Three d3d12_xs --lib tests fail on every run on an RDNA2 GPU (gfx1032), single-threaded or not:

  • alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement
  • placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap
  • title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes

The three tests now query GetResourceAllocationInfo for the textures that are meant to be ordinary placements and pass max(PC size, console size) as the title layout (0x4_0000 for the 256x256 RGBA8 targets, 0x40_0000 for the 4x MSAA target in placed_offset). On an adapter whose PC layout fits the console size nothing changes. The deliberately oversize cases (the MSAA depth in alias, the 64 KB-step MSAA target in placed_offset) still pass the console size, so oversize_span stays covered.

Why

A bisect puts the first bad commit at aa14bfa, which added oversize_span: a placed texture whose PC layout is larger than the title layout gets its own heap, so its PC tail never overlaps the next title placement. Each of the three tests places a 256x256 R8G8B8A8_UNORM render target and passes 0x4_0000 (the console size) as the title layout. On this adapter GetResourceAllocationInfo returns 0x5_0000 for that texture (0x4_0000 for the same texture without the render-target flag). The texture is then oversize, lands in its own heap at offset 0, and the sharing assertions fail:

alias.rs:1034          left: (..., 0)  right: (..., 25100288)
placed_offset.rs:1720  left: (..., 4194304)  right: (..., 0)
title_shadow_tests.rs:355  the texture lands at the buffer's offset in the migrated reservation  left: 0  right: 2097152

The placement code does what aa14bfa intends: a title that tells us 256 KiB for a texture the PC needs 320 KiB for must not share its tail with the next placement. The tests meant these textures to be non-oversize, and on this adapter they were not.

Tests

RDNA2 gfx1032, debug build, TOMBOX_REMOVED_EXIT_MS=off, native Windows 11; not run under Proton.

  • The three tests above: 3 passed (they fail on main on this GPU).
  • cargo test -p d3d12_xs --lib -- --test-threads=1: 667 passed, 1 failed, 71 ignored. The failure is xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs, which needs a console d3d12_xs.dll fixture that is not available here; not touched.
  • pr_gate.py --base origin/main: 0 problems.
  • Overlap: no open PR touches these three files; #276 (three other release-build test failures) is in different files.

Not verified

  • Not run on an NVIDIA or Intel adapter. There the PC size should be at most 0x4_0000, which leaves the arguments exactly as before.
  • Test-only change; nothing verified in a title.
<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6566678855 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/322). Originally posted by [GDAgent](https://github.com/GDAgent) on 2026-11-23T19:02:10Z. --- ## What Tests only (`alias.rs`, `placed_offset.rs`, `title_shadow_tests.rs`). No runtime change, no exports change. Three `d3d12_xs --lib` tests fail on every run on an RDNA2 GPU (gfx1032), single-threaded or not: - `alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement` - `placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap` - `title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes` The three tests now query `GetResourceAllocationInfo` for the textures that are meant to be ordinary placements and pass `max(PC size, console size)` as the title layout (`0x4_0000` for the 256x256 RGBA8 targets, `0x40_0000` for the 4x MSAA target in `placed_offset`). On an adapter whose PC layout fits the console size nothing changes. The deliberately oversize cases (the MSAA depth in `alias`, the 64 KB-step MSAA target in `placed_offset`) still pass the console size, so `oversize_span` stays covered. ## Why A bisect puts the first bad commit at `aa14bfa`, which added `oversize_span`: a placed texture whose PC layout is larger than the title layout gets its own heap, so its PC tail never overlaps the next title placement. Each of the three tests places a 256x256 `R8G8B8A8_UNORM` render target and passes `0x4_0000` (the console size) as the title layout. On this adapter `GetResourceAllocationInfo` returns `0x5_0000` for that texture (`0x4_0000` for the same texture without the render-target flag). The texture is then oversize, lands in its own heap at offset 0, and the sharing assertions fail: ``` alias.rs:1034 left: (..., 0) right: (..., 25100288) placed_offset.rs:1720 left: (..., 4194304) right: (..., 0) title_shadow_tests.rs:355 the texture lands at the buffer's offset in the migrated reservation left: 0 right: 2097152 ``` The placement code does what `aa14bfa` intends: a title that tells us 256 KiB for a texture the PC needs 320 KiB for must not share its tail with the next placement. The tests meant these textures to be non-oversize, and on this adapter they were not. ## Tests RDNA2 gfx1032, debug build, `TOMBOX_REMOVED_EXIT_MS=off`, native Windows 11; not run under Proton. - The three tests above: 3 passed (they fail on `main` on this GPU). - `cargo test -p d3d12_xs --lib -- --test-threads=1`: 667 passed, 1 failed, 71 ignored. The failure is `xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs`, which needs a console `d3d12_xs.dll` fixture that is not available here; not touched. - `pr_gate.py --base origin/main`: 0 problems. - Overlap: no open PR touches these three files; #276 (three other release-build test failures) is in different files. ## Not verified - Not run on an NVIDIA or Intel adapter. There the PC size should be at most `0x4_0000`, which leaves the arguments exactly as before. - Test-only change; nothing verified in a title.
omonkeyz commented 2026-11-25 13:49:40 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:49:40Z.


Applied on main in a1d913d (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7164348253 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/322#issuecomment-7164348253). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:49:40Z. --- Applied on main in a1d913d (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
omonkeyz/xbox-emulator!322
No description provided.