d3d12: mirror a descriptor record that crosses a watch page as one whole record (D3D12-DESCRIPTOR-PAGE-STRADDLE) #3445

Merged
leonida/mandy
MoonEyes merged 3 commits from fix/descriptor-page-straddle into main 2026-12-04 11:35:03 +00:00

Pull request successfully merged and closed

Member

Change

  • The descriptor heap mirror (descriptor.rs, sync_heaps) cut a heap's changed range at watch-page bounds. A record that crosses a page (heap start not a multiple of the record size) and that the title writes in two 16-byte halves, the second half alone on the next page, was skipped: the read began at the first whole record of the page. Now the parts are whole records (sync_record_parts), a record across a page is its own part, and overlapping parts are merged. The read loop takes its first record and count from the part (part_records).
  • out.pages counts pages actually read, not those single-record parts.
  • One info line per placed heap whose start is not a multiple of its record size (start, rest mod 32, rest mod 16), to tell whether the title places such heaps.
  • Not changed: the record sizes, the placed UAV counter, samplers. Same rounding in port_descriptors.rs:270 (plan_parts), left for a separate change.

Tests

  • record_across_a_watch_page_is_one_whole_part and read_loop_takes_whole_records_of_each_part (no GPU): a heap at page-16 with 32-byte records, the second half written alone on the next page, gives one part of the whole record. With the old split the record was not read.

In-game run

Game gate (scripts/game-gate.ps1) on a test branch that merges four changes over main a558375458: this PR together with the FFX jitter, XMem low window and descriptor-record changes and a periodic preload save. -SeriesS -PrecompileUsed, RTX 4060 8 GB, driver 32.0.16.1088, Windows 11, build with diagnostics. PASS, 314 s in the world, no device loss, median 17.7 fps, VRAM peak 6 390 MB for a 6 776 MB budget. Warning fault_after_stop (access violations in the runtime after the gate stopped the run, clean exit): the same 8 faults appear on a run of another branch, so most likely not from this change (not yet compared with main). cargo test --locked -p leonida-gpu -p leonida on that test branch: 742 + 62 + 5 passed, 0 failed.

No "not aligned on its record size" line on this route: the title placed no misaligned heap there, so the fix did not change what was read in this run. It is the same idea as Darner PR #163 (GPL-3.0-or-later), measured there on a 4070 Ti SUPER (missed 2/2 before, mirrored 2/2 after).

AI-assisted

Written with Claude Opus 5.5 (Claude Code); reviewed by a separate Claude Opus 5.5 reviewer instance (an unused assignment, the page count and a test of the read loop are fixed).

🤖 Generated with Claude Code

## Change - The descriptor heap mirror (`descriptor.rs`, `sync_heaps`) cut a heap's changed range at watch-page bounds. A record that crosses a page (heap start not a multiple of the record size) and that the title writes in two 16-byte halves, the second half alone on the next page, was skipped: the read began at the first whole record of the page. Now the parts are whole records (`sync_record_parts`), a record across a page is its own part, and overlapping parts are merged. The read loop takes its first record and count from the part (`part_records`). - `out.pages` counts pages actually read, not those single-record parts. - One `info` line per placed heap whose start is not a multiple of its record size (start, rest mod 32, rest mod 16), to tell whether the title places such heaps. - Not changed: the record sizes, the placed UAV counter, samplers. Same rounding in `port_descriptors.rs:270` (`plan_parts`), left for a separate change. ## Tests - `record_across_a_watch_page_is_one_whole_part` and `read_loop_takes_whole_records_of_each_part` (no GPU): a heap at page-16 with 32-byte records, the second half written alone on the next page, gives one part of the whole record. With the old split the record was not read. ## In-game run Game gate (`scripts/game-gate.ps1`) on a test branch that merges four changes over main `a558375458`: this PR together with the FFX jitter, XMem low window and descriptor-record changes and a periodic preload save. `-SeriesS -PrecompileUsed`, RTX 4060 8 GB, driver 32.0.16.1088, Windows 11, build with diagnostics. **PASS, 314 s in the world, no device loss**, median 17.7 fps, VRAM peak 6 390 MB for a 6 776 MB budget. Warning `fault_after_stop` (access violations in the runtime after the gate stopped the run, clean exit): the same 8 faults appear on a run of another branch, so most likely not from this change (not yet compared with main). `cargo test --locked -p leonida-gpu -p leonida` on that test branch: 742 + 62 + 5 passed, 0 failed. No "not aligned on its record size" line on this route: the title placed no misaligned heap there, so the fix did not change what was read in this run. It is the same idea as Darner PR #163 (GPL-3.0-or-later), measured there on a 4070 Ti SUPER (missed 2/2 before, mirrored 2/2 after). ## AI-assisted Written with Claude Opus 5.5 (Claude Code); reviewed by a separate Claude Opus 5.5 reviewer instance (an unused assignment, the page count and a test of the read loop are fixed). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The written ranges were cut at watch pages and a record straddling a part's
start was left to the part holding its first byte; when only the second page
was written that part did not exist and the record was never mirrored. The
parts are now whole records (sync_record_parts): runs within one page, a
record across a page boundary as a part of its own, overlapping written
ranges deduplicated.

Also logs once per heap a placed heap whose start is not a multiple of its
record size, with the observed remainders.

Test: record_across_a_watch_page_is_one_whole_part (no GPU). On the old code
the second piece alone gave a part starting on the page with the straddling
record skipped, so it fails there (by reasoning, not run).

Same fix idea as Darner PR #163 (GPL-3.0-or-later)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parts is assigned once in each branch; a record across a page boundary no
longer counts as a page read; the read loop's record choice is part_records,
tested without a GPU on a misaligned heap.

Same fix idea as Darner PR #163 (GPL-3.0-or-later)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Member

Merging, with Moon's written OK as maintainer (two maintainers only: the CONTRIBUTING rule against merging one's own PR is waived for this series). Branch updated with main 1a12090494, no conflict. The merged tree (d7c11355) is the one tested locally: cargo test --locked -p leonida-gpu -p leonida -p leonida-hle all passed, tests/test_d3d12_switches.py OK, check_no_game_data.py clean. In-game gate in the description (PASS, 314 s, no device loss). AI-assisted (Claude Opus 5.5).

Merging, with Moon's written OK as maintainer (two maintainers only: the CONTRIBUTING rule against merging one's own PR is waived for this series). Branch updated with main `1a12090494`, no conflict. The merged tree (`d7c11355`) is the one tested locally: `cargo test --locked -p leonida-gpu -p leonida -p leonida-hle` all passed, `tests/test_d3d12_switches.py` OK, `check_no_game_data.py` clean. In-game gate in the description (PASS, 314 s, no device loss). AI-assisted (Claude Opus 5.5).
Sign in to join this conversation.
No description provided.