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

Closed
github-bot wants to merge 1 commit from gh-pr/322/head into gh-pr/322/base
Owner

@⁠GDAgent on GitHub · 2026-11-23 19:02 UTC · original
GDAgent:fix/d3d12-tests-alias-amd-oversize → main · +15 −9 · 3 files · 1 commits · closed without merging

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.
**@⁠GDAgent** on GitHub · 2026-11-23 19:02 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/322) `GDAgent:fix/d3d12-tests-alias-amd-oversize` → `main` · +15 −9 · 3 files · 1 commits · closed without merging ## 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.
oversize_span gives a placed texture its own heap when its PC layout is
larger than the title layout. Three tests place a 256x256 RGBA8 render
target and tell create_placed_x that the title layout is 0x4_0000, the
console size. On adapters whose PC layout for that texture is larger
(0x5_0000 on an RDNA2 GPU, 0x4_0000 without the render-target flag), the
texture is treated as oversize and lands in its own heap at offset 0,
so the tests fail on their sharing assertions although the placement
code behaves as designed:

- alias::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement
- placed_offset::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap
- title_shadow::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes

These textures are meant to be ordinary, non-oversize placements. The
tests now pass max(PC size, console size) as their title layout, so they
stay non-oversize on every adapter. The deliberately oversize cases (the
MSAA depth and the 64 KB-step MSAA target) are unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:18:44 +00:00
github-bot closed this pull request 2026-11-26 06:18:44 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:49 UTC · original

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

**@⁠omonkeyz** on GitHub · 2026-11-25 13:49 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/322#issuecomment-7164348253) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.