d3d12/descriptor: GPU test that a record across two watch pages is mirrored (D3D12-DESCRIPTOR-STRADDLE-GPU-TEST) #3448

Merged
leonida/mandy
MoonEyes merged 2 commits from oreofr/descriptor-straddle-gpu-test into main 2026-12-05 09:36:29 +00:00 AGit

Pull request successfully merged and closed

Member

Item: D3D12-DESCRIPTOR-STRADDLE-GPU-TEST (claimed in #3312)

What

This adds one GPU test to d3d12/crates/leonida-gpu/src/descriptor.rs: dirty_sampler_across_two_watch_pages_is_mirrored. The test:

  1. places a 2-sampler shader-visible heap so that slot 0 starts 8 bytes before a watch-page boundary;
  2. writes a sampler there through the title's path;
  3. runs sync_heaps();
  4. checks that slot 0 is mirrored to the host heap and slot 1 is not.

No code change. The test comes from closed #3431, which #3445 superseded, after Darner (TrustNo1/Darner, GPL-3.0-or-later). MoonEyes asked for it on the bridge.

Why

#3445 fixed the record across a watch page. Its commit says the red case was "by reasoning, not run", and its own test is pure (no GPU). This test checks the fix end to end on a real hardware heap.

Red / green (RTX 4070 Laptop, driver 621.40, Windows 11)

  • Green, main f70caeea4 + this test: test descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored ... ok. It ran on a hardware heap and was not skipped.
  • Red, descriptor.rs from 14e1966f6^ (before #3445) + this test: it fails with left: (false, false), right: (true, false). Without #3445 the straddling sampler is never mirrored.

Checks

  • cargo test --locked -p leonida-gpu: 756 passed, 0 failed, 60 ignored.

  • check_no_game_data on the changed file: clean.

  • cargo clippy -p leonida-gpu --all-targets -- -D warnings reports 4 errors, all in code already on main, none in this test:

    • list.rs:2993, engine never used;
    • list.rs:3120, too many arguments;
    • list/values.rs:249, comparison with false;
    • descriptor.rs:464, unneeded late initialization.

    Clippy is report-only in this repo's CI.

Tested on an RTX 4070 Laptop. Unit/GPU test only, with no in-game run: it changes no runtime code.

AI-assisted.

🤖 Generated with Claude Code

**Item:** D3D12-DESCRIPTOR-STRADDLE-GPU-TEST (claimed in #3312) ## What This adds one GPU test to `d3d12/crates/leonida-gpu/src/descriptor.rs`: `dirty_sampler_across_two_watch_pages_is_mirrored`. The test: 1. places a 2-sampler shader-visible heap so that slot 0 starts 8 bytes before a watch-page boundary; 2. writes a sampler there through the title's path; 3. runs `sync_heaps()`; 4. checks that slot 0 is mirrored to the host heap and slot 1 is not. No code change. The test comes from closed #3431, which #3445 superseded, after Darner (TrustNo1/Darner, GPL-3.0-or-later). MoonEyes asked for it on the bridge. ## Why #3445 fixed the record across a watch page. Its commit says the red case was "by reasoning, not run", and its own test is pure (no GPU). This test checks the fix end to end on a real hardware heap. ## Red / green (RTX 4070 Laptop, driver 621.40, Windows 11) - **Green**, main `f70caeea4` + this test: `test descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored ... ok`. It ran on a hardware heap and was not skipped. - **Red**, `descriptor.rs` from `14e1966f6^` (before #3445) + this test: it fails with `left: (false, false)`, `right: (true, false)`. Without #3445 the straddling sampler is never mirrored. ## Checks - `cargo test --locked -p leonida-gpu`: 756 passed, 0 failed, 60 ignored. - `check_no_game_data` on the changed file: clean. - `cargo clippy -p leonida-gpu --all-targets -- -D warnings` reports 4 errors, all in code already on main, none in this test: - `list.rs:2993`, `engine` never used; - `list.rs:3120`, too many arguments; - `list/values.rs:249`, comparison with `false`; - `descriptor.rs:464`, unneeded late initialization. Clippy is report-only in this repo's CI. Tested on an RTX 4070 Laptop. Unit/GPU test only, with no in-game run: it changes no runtime code. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Ported from #3431 (after Darner, TrustNo1/Darner, GPL-3.0-or-later).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First-time contributor

RUN — Real-GPU Unit Test Gate (NVIDIA RTX 5070 12 GB, Windows 11)

Tested PR head b88cde67e merged cleanly onto main (bba262b94):

  • cargo test -p leonida-gpu --lib --locked descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored -- --exact --nocapture — PASS (1/1 on a real D3D12 device)
  • cargo test -p leonida-gpu --lib --locked each_planned_part_starts_on_a_record_and_reads_the_straddler_whole — PASS (1/1)
  • cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings — 0 warnings
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md — PASS
  • python -I scripts/check_no_game_data.py — PASS

Clean merge and green real-GPU verification. Ready for merge.

AI-assisted.

### RUN — Real-GPU Unit Test Gate (NVIDIA RTX 5070 12 GB, Windows 11) Tested PR head `b88cde67e` merged cleanly onto `main` (`bba262b94`): - `cargo test -p leonida-gpu --lib --locked descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored -- --exact --nocapture` — **PASS** (`1/1` on a real D3D12 device) - `cargo test -p leonida-gpu --lib --locked each_planned_part_starts_on_a_record_and_reads_the_straddler_whole` — **PASS** (`1/1`) - `cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings` — `0` warnings - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` — PASS - `python -I scripts/check_no_game_data.py` — PASS Clean merge and green real-GPU verification. Ready for merge. AI-assisted.
Contributor

A separate hand-generated 4x4 BC7 replacement fixture returned the new texels after a successful upload and kept the old texels after a short read. A follow-up could run this PR's generated page-straddle test on software and hardware D3D12 backends and check the two slots separately. Slot 0 should be mirrored and slot 1 should remain unchanged.

AI-assisted with OpenAI Codex.

A separate hand-generated 4x4 BC7 replacement fixture returned the new texels after a successful upload and kept the old texels after a short read. A follow-up could run this PR's generated page-straddle test on software and hardware D3D12 backends and check the two slots separately. Slot 0 should be mirrored and slot 1 should remain unchanged. AI-assisted with OpenAI Codex.
First-time contributor

Test report from another card (I changed no code). Not a review of the code.

  • Head b88cde67e merged onto main 93b9d90a2: clean merge.
  • RTX 3060 Ti 8 GB, driver 610.88, Windows 11.
  • cargo test -p leonida-gpu --lib --locked descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored -- --exact --nocapture: passed (1 passed; 0 failed; 0 ignored).
  • Not run: the red case before #3445, clippy, the clean-room check.

GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used.

AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).

Test report from another card (I changed no code). Not a review of the code. - Head `b88cde67e` merged onto `main` `93b9d90a2`: clean merge. - RTX 3060 Ti 8 GB, driver 610.88, Windows 11. - `cargo test -p leonida-gpu --lib --locked descriptor::tests::dirty_sampler_across_two_watch_pages_is_mirrored -- --exact --nocapture`: **passed** (`1 passed; 0 failed; 0 ignored`). - Not run: the red case before #3445, clippy, the clean-room check. GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used. AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).
Member

Merged by Moon's agent, on Moon's written authorization (two maintainers). Checked before merging: cargo test --locked -p leonida-gpu -p leonida-shader -p xtask green on main + this test (1247 passed, 0 failed, Windows 11, RTX 4060; dirty_sampler_across_two_watch_pages_is_mirrored ok), check_no_game_data.py clean, and a separate reviewer agent returned ACCEPT. The new head fd351cad5 is a clean merge of the tested head with main and adds only the test. Main is now 03d3b7600a.

Merged by Moon's agent, on Moon's written authorization (two maintainers). Checked before merging: `cargo test --locked -p leonida-gpu -p leonida-shader -p xtask` green on main + this test (1247 passed, 0 failed, Windows 11, RTX 4060; `dirty_sampler_across_two_watch_pages_is_mirrored` ok), `check_no_game_data.py` clean, and a separate reviewer agent returned ACCEPT. The new head fd351cad5 is a clean merge of the tested head with main and adds only the test. Main is now `03d3b7600a`.
Sign in to join this conversation.
No description provided.