d3d12/gpu: a released target at a shared address leaves the older one found (D3D12-TARGETS-AT-RESTORE) #3054

Open
upipibi wants to merge 1 commit from upstream-pr/3054 into main
upipibi commented 2026-12-02 06:16:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by upipibi on 2026-12-02T06:16:57Z.


D3D12-TARGETS-AT-RESTORE, item 5 of @zmasi's finding (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7334060836). Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7336489248

What was wrong

TARGETS_AT (resource.rs) maps an address to the texture the host writes (a target, depth, or unordered access) that was made there. alias_source looks it up so that a view the title places in that memory, in another format, reads the host's texture rather than title memory. The table held one texture per address:

  • a second texture made at the same address replaced the first (targets.insert);
  • releasing that second texture removed the entry (targets.remove), although the first was still alive.

From then on, a view over the first texture found nothing. It read title memory, which shaders never wrote.

What it changes

  • TARGETS_AT keeps every live texture made at an address, newest last. The newest is the one found, as before, so nothing changes while both are alive.
  • targets_put / targets_take: a release removes only that texture. If it was the newest, the one made before it is found again.
  • levels_changed(at) runs only when the texture found at at changes, as before. TARGETS_CHANGED is raised before every release that touches the table: a raise with no change only makes the quick path (LEONIDA_ALIAS_QUICK) look again.

One file, no new switch. The behaviour differs from main only after the newer of two live textures at one address is released.

When the older texture is the right answer. Once the newer texture is released, what it drew is in neither place: its host copy goes with it, and shader writes to a target reach title memory only for the kinds texback copies back. The older texture is still alive, and whatever the title draws into it next lands in its host copy and nowhere else. A view placed there now sees those draws. On main it read title memory and never saw them. The texture found now depends only on which targets are alive, not on the order they were released. main's answer is better only when the memory is refilled by the CPU or by a copy after the release and the older target is not drawn into again. main already behaves that way whenever the older target is the only one at that address.

How it was tested

RTX 3070 8 GB, driver 621.40, Windows 11 24H2. No game files.

  • New resource::tests::releasing_the_newer_texture_at_an_address_finds_the_older_again (diagnostics, on the device), run with and without the quick path (ALIAS_QUICK_TEST): texture A, then B made at A's address, then a placed view there. The view finds B; after B is released, it must find A again; after A is released, nothing.
  • Red/green: with main's release put back (the whole entry removed when the newest goes), this test fails at "the older texture is found again". It passes with the change.
  • New resource::tests::the_texture_found_at_an_address_gives_way_to_the_one_before_it: pure, no device. It covers the order of release, which releases report a change, unknown textures and addresses, and making the same texture twice.
  • cargo test -p leonida-gpu --features diagnostics --lib --locked: 751 passed, 0 failed, 59 ignored.
  • cargo test -p leonida-gpu --lib --locked: 667 passed, 2 failed (texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, watch::tests::unmapped_blocks_are_reported_once_until_mapped). Both pass when run alone, on main and on this branch, so they look like order-dependent flakes in files this change does not touch.
  • cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings: nothing in resource.rs; the 10 errors left are in other files and are on main already.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs: clean.

The game: I have not run it. EdenBendheim's in-game batch run on an RTX 3090 included this head and passed (https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7358705620). zmasi named this as a candidate for #2960, where the weapon shop's 3D preview blurs under dynamic resolution and is sharp at a fixed resolution. Dynamic resolution makes targets again, which could leave two at one address. TripyFox ran that menu with dynamic resolution and this change (https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7342597771): still blurred, so this PR does not fix #2960.

AI-assisted: written with Claude Code (Claude Opus 5.5). A separate read-only reviewer agent (Claude Opus 5.5) audited the diff before this was opened.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5601013759 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054). Originally posted by [upipibi](https://github.com/upipibi) on 2026-12-02T06:16:57Z. --- **D3D12-TARGETS-AT-RESTORE**, item 5 of @zmasi's finding (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7334060836). Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7336489248 ## What was wrong `TARGETS_AT` (`resource.rs`) maps an address to the texture the host writes (a target, depth, or unordered access) that was made there. `alias_source` looks it up so that a view the title places in that memory, in another format, reads the host's texture rather than title memory. The table held **one** texture per address: - a second texture made at the same address replaced the first (`targets.insert`); - releasing that second texture removed the entry (`targets.remove`), **although the first was still alive**. From then on, a view over the first texture found nothing. It read title memory, which shaders never wrote. ## What it changes - `TARGETS_AT` keeps every live texture made at an address, newest last. The newest is the one found, as before, so nothing changes while both are alive. - `targets_put` / `targets_take`: a release removes only that texture. If it was the newest, the one made before it is found again. - `levels_changed(at)` runs only when the texture found at `at` changes, as before. `TARGETS_CHANGED` is raised before every release that touches the table: a raise with no change only makes the quick path (`LEONIDA_ALIAS_QUICK`) look again. One file, no new switch. The behaviour differs from `main` only after the newer of two live textures at one address is released. **When the older texture is the right answer.** Once the newer texture is released, what it drew is in neither place: its host copy goes with it, and shader writes to a target reach title memory only for the kinds `texback` copies back. The older texture is still alive, and whatever the title draws into it next lands in its host copy and nowhere else. A view placed there now sees those draws. On `main` it read title memory and never saw them. The texture found now depends only on which targets are alive, not on the order they were released. `main`'s answer is better only when the memory is refilled by the CPU or by a copy after the release and the older target is not drawn into again. `main` already behaves that way whenever the older target is the only one at that address. ## How it was tested RTX 3070 8 GB, driver 621.40, Windows 11 24H2. No game files. - New `resource::tests::releasing_the_newer_texture_at_an_address_finds_the_older_again` (diagnostics, on the device), run with and without the quick path (`ALIAS_QUICK_TEST`): texture A, then B made at A's address, then a placed view there. The view finds B; after B is released, it must find A again; after A is released, nothing. - **Red/green:** with `main`'s release put back (the whole entry removed when the newest goes), this test fails at "the older texture is found again". It passes with the change. - New `resource::tests::the_texture_found_at_an_address_gives_way_to_the_one_before_it`: pure, no device. It covers the order of release, which releases report a change, unknown textures and addresses, and making the same texture twice. - `cargo test -p leonida-gpu --features diagnostics --lib --locked`: 751 passed, 0 failed, 59 ignored. - `cargo test -p leonida-gpu --lib --locked`: 667 passed, 2 failed (`texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, `watch::tests::unmapped_blocks_are_reported_once_until_mapped`). Both pass when run alone, on `main` and on this branch, so they look like order-dependent flakes in files this change does not touch. - `cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings`: nothing in `resource.rs`; the 10 errors left are in other files and are on `main` already. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs`: clean. **The game:** I have not run it. EdenBendheim's in-game batch run on an RTX 3090 included this head and passed (https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7358705620). zmasi named this as a candidate for #2960, where the weapon shop's 3D preview blurs under dynamic resolution and is sharp at a fixed resolution. Dynamic resolution makes targets again, which could leave two at one address. TripyFox ran that menu with dynamic resolution and this change (https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7342597771): still blurred, so this PR does not fix #2960. AI-assisted: written with Claude Code (Claude Opus 5.5). A separate read-only reviewer agent (Claude Opus 5.5) audited the diff before this was opened. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kal0s-design commented 2026-12-02 07:40:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T07:40:05Z.


Windows 11, MSVC toolchain 1.98.1. Head ff53fd8b9 merged into current main 229d352ee: the merge is clean. Unit tests only.

cargo test -p leonida-gpu --features diagnostics --lib:

  • hardware: 774 passed, 0 failed, 59 ignored;
  • WARP (LEONIDA_D3D12_WARP=1): 774 passed;
  • WARP with the debug layer (LEONIDA_D3D12_DEBUG=1): 774 passed, with no message from the layer.

cargo test -p leonida-gpu --lib without diagnostics: 692 passed, 0 failed, run twice. The two failures in the description (alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, watch::tests::unmapped_blocks_are_reported_once_until_mapped) didn't come back here.

Red/green, on the hardware device and on WARP. I put main's release back in targets_take: the whole entry goes when the newest texture is released. Both new tests then fail. The device one is releasing_the_newer_texture_at_an_address_finds_the_older_again. The pure one is the_texture_found_at_an_address_gives_way_to_the_one_before_it, at resource.rs:5166, "the older one is found again", left: None. With the change both pass.

Not checked: the game, so nothing on #2960.

GPUs tested: one NVIDIA desktop card + WARP.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7338460211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7338460211). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T07:40:05Z. --- Windows 11, MSVC toolchain 1.98.1. Head `ff53fd8b9` merged into current `main` `229d352ee`: the merge is clean. Unit tests only. `cargo test -p leonida-gpu --features diagnostics --lib`: - hardware: 774 passed, 0 failed, 59 ignored; - WARP (`LEONIDA_D3D12_WARP=1`): 774 passed; - WARP with the debug layer (`LEONIDA_D3D12_DEBUG=1`): 774 passed, with no message from the layer. `cargo test -p leonida-gpu --lib` without diagnostics: 692 passed, 0 failed, run twice. The two failures in the description (`alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, `watch::tests::unmapped_blocks_are_reported_once_until_mapped`) didn't come back here. **Red/green**, on the hardware device and on WARP. I put `main`'s release back in `targets_take`: the whole entry goes when the newest texture is released. Both new tests then fail. The device one is `releasing_the_newer_texture_at_an_address_finds_the_older_again`. The pure one is `the_texture_found_at_an_address_gives_way_to_the_one_before_it`, at `resource.rs:5166`, "the older one is found again", `left: None`. With the change both pass. Not checked: the game, so nothing on #2960. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
lixonik commented 2026-12-02 10:02:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T10:02:28Z.


Verified locally on Windows 10 22H2 + NVIDIA GeForce RTX 5070 12 GB (driver 621.40), PR head ff53fd8b9 merged onto main a917c54d6:

  • Unit tests & clean-room:
    • cargo test -p leonida-gpu --locked --lib resource:: -- 30 passed, 0 failed.
    • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs -- exit 0.
  • Live in-game Series X smoke run (diag build diagnostics,dlss,mimalloc, -NoFrameGen -NoPrecompile, 65 s in-world, 214 s total):
    • 0 ERROR lines, 0 device removals, clean startup and shutdown.
    • 15 world samples (1,000+ draws/frame, up to 5,289 draws): median 20.3 fps (49.2 ms/frame); preparing 33.2 ms (copies 13.2 ms, textures 1.1 ms), GPU wait 0.0 ms, copying back 5.5 ms.

Result: PASS.

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7341867376 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7341867376). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T10:02:28Z. --- Verified locally on Windows 10 22H2 + NVIDIA GeForce RTX 5070 12 GB (driver `621.40`), PR head `ff53fd8b9` merged onto `main` `a917c54d6`: - **Unit tests & clean-room:** - `cargo test -p leonida-gpu --locked --lib resource::` -- **30 passed, 0 failed**. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs` -- exit `0`. - **Live in-game Series X smoke run (`diag` build `diagnostics,dlss,mimalloc`, `-NoFrameGen -NoPrecompile`, 65 s in-world, 214 s total):** - **0 `ERROR` lines**, **0 device removals**, clean startup and shutdown. - 15 world samples (`1,000+` draws/frame, up to `5,289` draws): median **20.3 fps (49.2 ms/frame)**; preparing `33.2 ms` (copies `13.2 ms`, textures `1.1 ms`), GPU wait `0.0 ms`, copying back `5.5 ms`. Result: **PASS**. AI-assisted: yes (Antigravity).
TripyFox commented 2026-12-02 10:31:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TripyFox on 2026-12-02T10:31:34Z.


Tested this against #2960 in the game: only ff53fd8b9 on top of 27613ab6b (resource.rs is identical there), Series X with the title's dynamic resolution (floor 0.5, 4K output), the same save and the same shop menu. The weapon preview is still blurred, so this doesn't fix #2960. The run itself was clean: no device removal or crash, and the only ERROR lines are Streamline's getRefreshRate ... is not a valid window, which main without this PR logs the same way. Full results of the other checks are in https://github.com/ProjectLeonida/mandy/issues/2960#issuecomment-7342531668.

AI-assisted (Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7342597771 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7342597771). Originally posted by [TripyFox](https://github.com/TripyFox) on 2026-12-02T10:31:34Z. --- Tested this against #2960 in the game: only `ff53fd8b9` on top of 27613ab6b (`resource.rs` is identical there), Series X with the title's dynamic resolution (floor 0.5, 4K output), the same save and the same shop menu. The weapon preview is **still blurred**, so this doesn't fix #2960. The run itself was clean: no device removal or crash, and the only `ERROR` lines are Streamline's `getRefreshRate ... is not a valid window`, which `main` without this PR logs the same way. Full results of the other checks are in https://github.com/ProjectLeonida/mandy/issues/2960#issuecomment-7342531668. AI-assisted (Claude Opus 5.5).
MoonEyes commented 2026-12-02 18:18:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:18:39Z.


Verification of #3054 (third party, code review on Linux; not built: Windows-only leonida-gpu)

  • Head verified: ff53fd8b9f56174b90f0dbb61c844f0a7597861f (1 file, d3d12/crates/leonida-gpu/src/resource.rs,
    +117/-7).
  • Merge base 0ae5a2664. git merge-tree --write-tree origin/main pr/3054 against main 45dc41f95 is clean
    (202 commits behind).
  • CI: no check runs on this head (fork workflows waiting for approval).
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs: exit 0.

Review

  • Root cause: TARGETS_AT held one texture per address. Releasing the newer of two targets at one address removed
    the entry, so the older live one was no longer found. Releasing the older first already left the newer in place,
    because of the == self check on main. A Vec per address, newest last
    (resource.rs:1615-1646), fixes the cause.
  • targets_take returns true only when the found entry changes, and levels_changed runs only then
    (:3606-3609). That is right. targets_put dedups (retain) before pushing. The lists are tiny, so the linear
    scans cost nothing.
  • TARGETS_CHANGED is now raised on every target release, not only when the entry matched (:3603-3606). The
    comment explains it. The cost is an extra re-look by LEONIDA_ALIAS_QUICK caches, which is cheap.
  • Tests: the pure-table test (:5153-5177) covers put, take, order, dedup and the missing cases. The device test
    (:5179-5226) goes through create_at_address and alias_of with and without the quick path, and fails on
    main's one-entry table. It is diagnostics-only and returns silently with no host. Print a skip line, as
    other device tests do.
  • Question for the author (not blocking): once the newer target is released, a view now reads the older host
    texture. Anything the newer target rendered to that memory is in neither the older texture nor title memory. Is
    the older texture's content the better answer than title memory in that case? The body says #2960 was not fixed
    by this (TripyFox's run), which fits. A line in the body or findings.md on when "older found again" is the
    correct picture would settle it.

Process

  • Claim and AI disclosure (Claude Opus 5.5 and a reviewer) are present. Kal0s-design (hardware, WARP, debug
    layer) and lixonik ran unit tests on native Windows.

Verdict: ready on review (not built here). It still needs CI approved and an answer to the question above.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354343305 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7354343305). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:18:39Z. --- **Verification of #3054 (third party, code review on Linux; not built: Windows-only `leonida-gpu`)** - Head verified: `ff53fd8b9f56174b90f0dbb61c844f0a7597861f` (1 file, `d3d12/crates/leonida-gpu/src/resource.rs`, +117/-7). - Merge base `0ae5a2664`. `git merge-tree --write-tree origin/main pr/3054` against `main` `45dc41f95` is clean (202 commits behind). - CI: no check runs on this head (fork workflows waiting for approval). - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/resource.rs`: exit 0. **Review** - Root cause: `TARGETS_AT` held one texture per address. Releasing the newer of two targets at one address removed the entry, so the older live one was no longer found. Releasing the older first already left the newer in place, because of the `== self` check on `main`. A `Vec` per address, newest last (`resource.rs:1615-1646`), fixes the cause. - `targets_take` returns `true` only when the found entry changes, and `levels_changed` runs only then (`:3606-3609`). That is right. `targets_put` dedups (`retain`) before pushing. The lists are tiny, so the linear scans cost nothing. - `TARGETS_CHANGED` is now raised on every target release, not only when the entry matched (`:3603-3606`). The comment explains it. The cost is an extra re-look by `LEONIDA_ALIAS_QUICK` caches, which is cheap. - Tests: the pure-table test (`:5153-5177`) covers put, take, order, dedup and the missing cases. The device test (`:5179-5226`) goes through `create_at_address` and `alias_of` with and without the quick path, and fails on `main`'s one-entry table. It is `diagnostics`-only and returns silently with no host. Print a skip line, as other device tests do. - Question for the author (not blocking): once the newer target is released, a view now reads the **older** host texture. Anything the newer target rendered to that memory is in neither the older texture nor title memory. Is the older texture's content the better answer than title memory in that case? The body says #2960 was not fixed by this (TripyFox's run), which fits. A line in the body or `findings.md` on when "older found again" is the correct picture would settle it. **Process** - Claim and AI disclosure (Claude Opus 5.5 and a reviewer) are present. Kal0s-design (hardware, WARP, debug layer) and lixonik ran unit tests on native Windows. **Verdict: ready on review** (not built here). It still needs CI approved and an answer to the question above. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
EdenBendheim commented 2026-12-02 19:17:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T19:17:58Z.


Windows native unit verification (VERIFY-3054-WIN) — PASS WITH NOTE on head ff53fd8b9f56174b90f0dbb61c844f0a7597861f (merged cleanly onto 80910637f, Ryzen 9 5900X / Windows 11 / MSVC):

  • Clean-room scan (scripts/check_no_game_data.py on changed files): PASS.
  • Red on base (80910637f): cargo test -p leonida-gpu --locked -- address --test-threads=1 (and with --features diagnostics) exited 101 (E0425, missing targets_put and targets_take introduced by this PR).
  • Green on merged tree:
    • cargo test -p leonida-gpu --locked -- address --test-threads=1: 13 passed.
    • cargo test -p leonida-gpu --locked --features diagnostics -- address --test-threads=1: 15 passed.
  • Note: The table test covers both release orders; the diagnostics integration test can return early if host initialization fails.

(AI-assisted verification: gemini-4-neon + gpt-6.2-astra.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7355947347 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7355947347). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T19:17:58Z. --- Windows native unit verification (`VERIFY-3054-WIN`) — **PASS WITH NOTE** on head `ff53fd8b9f56174b90f0dbb61c844f0a7597861f` (merged cleanly onto `80910637f`, Ryzen 9 5900X / Windows 11 / MSVC): - **Clean-room scan (`scripts/check_no_game_data.py` on changed files):** PASS. - **Red on base (`80910637f`):** `cargo test -p leonida-gpu --locked -- address --test-threads=1` (and with `--features diagnostics`) exited `101` (`E0425`, missing `targets_put` and `targets_take` introduced by this PR). - **Green on merged tree:** - `cargo test -p leonida-gpu --locked -- address --test-threads=1`: **13 passed**. - `cargo test -p leonida-gpu --locked --features diagnostics -- address --test-threads=1`: **15 passed**. - **Note:** The table test covers both release orders; the diagnostics integration test can return early if host initialization fails. *(AI-assisted verification: `gemini-4-neon` + `gpt-6.2-astra`.)*
EdenBendheim commented 2026-12-02 21:02:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T21:02:36Z.


RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch) — PASS covering exact head ff53fd8b9f56174b90f0dbb61c844f0a7597861f (in addition to the Windows unit verification posted above).

  • Base & build: Merged cleanly via git merge --no-ff onto main b41763227 (diagnostics,dlss,mimalloc, exe_sha16 = c47eeb717f761d9d; changed-file clean-room scan exit 0).
  • Batch heads (14 PRs): #3200 d1a91afd1, #3198 80a627bb1, #3191 93b47ac9d, #3189 c182fc392, #3176 ae0075d9a, #3168 337388052, #3164 1065952da, #3146 ebc0253ff, #3124 64600ef0c, #3069 311d33a40, #3031 8df1bfce7, #3029 e49404808, #3054 ff53fd8b9, #3010 d645712a3.
  • Hardware & setup: Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Series X profile, 2560x1440, -NoFrameGen, scripts/game-gate.ps1 (301.3 s in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (GATE CONTROL moved=2.51 m, max_from_ctrl=5,053.9 m).
  • Result: PASS (0 device lost, 0 crashes, 0 warnings, 0 missed pipeline waits, 20.10 FPS median vs 19.13 FPS main b41763227 baseline, clean exit 0x00000000).

(AI-assisted verification: gemini-4-neon + gpt-6.2-astra.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358705620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7358705620). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T21:02:36Z. --- **RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch)** — **PASS** covering exact head `ff53fd8b9f56174b90f0dbb61c844f0a7597861f` (in addition to the Windows unit verification posted above). - **Base & build:** Merged cleanly via `git merge --no-ff` onto `main` `b41763227` (`diagnostics,dlss,mimalloc`, `exe_sha16 = c47eeb717f761d9d`; changed-file clean-room scan exit `0`). - **Batch heads (`14` PRs):** `#3200` `d1a91afd1`, `#3198` `80a627bb1`, `#3191` `93b47ac9d`, `#3189` `c182fc392`, `#3176` `ae0075d9a`, `#3168` `337388052`, `#3164` `1065952da`, `#3146` `ebc0253ff`, `#3124` `64600ef0c`, `#3069` `311d33a40`, `#3031` `8df1bfce7`, `#3029` `e49404808`, `#3054` `ff53fd8b9`, `#3010` `d645712a3`. - **Hardware & setup:** Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver `610.88`, Series X profile, `2560x1440`, `-NoFrameGen`, `scripts/game-gate.ps1` (`301.3 s` in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (`GATE CONTROL moved=2.51 m`, `max_from_ctrl=5,053.9 m`). - **Result:** `PASS` (`0` device lost, `0` crashes, `0` warnings, `0` missed pipeline waits, `20.10 FPS` median vs `19.13 FPS` `main` `b41763227` baseline, clean exit `0x00000000`). *(AI-assisted verification: `gemini-4-neon` + `gpt-6.2-astra`.)*
fiestorra commented 2026-12-02 22:27:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:27:38Z.


VERIFY-3054 — Windows nativo: las 32 pruebas de recursos pasan y el control muerde la pila de direcciones

Head (this PR)
Merge base 0ae5a2664 (behind main b41763227)
Merged onto main — merge-tree clean, git merge --no-ff clean

Ran

cargo test -p leonida-gpu --lib resource     32 passed; 0 failed; 1 ignored
  resource::tests::the_texture_found_at_an_address_gives_way_to_the_one_before_it ... ok
  resource::tests::releasing_the_newer_texture_at_an_address_finds_the_older_again ... ok
  resource::tests::newer_then_older_at_one_address ... ok

Negative control (synthetic): targets_take removes the texture it is given; I made it remove the oldest instead (here.remove(0)), rebuilt and ran:

FAILED: the_texture_found_at_an_address_gives_way_to_the_one_before_it
assertion `left == right` failed: the older one is found again

The test bites on the mechanism the change adds.

What the change is: the table of targets keeps a stack per address (BTreeMap<u64, Vec<usize>>) instead of one texture, so two textures found at one address both stay: the newest answers a lookup, and releasing it gives way to the older one again — which is what targets_take's newest return and the three new tests pin. The scenario it models is a resource released and refound at the same address in a later place; before this, the older entry was lost.

What I could not test

  • The release/refind in a run: the tests drive the table directly; no title, so the real address reuse is a shape, not a measured event.
  • The one ignored test in the module (it was already ignored): still ignored, and I did not chase what it needs.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360723365 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7360723365). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T22:27:38Z. --- ## VERIFY-3054 — Windows nativo: las 32 pruebas de recursos pasan y el control muerde la pila de direcciones | | | |---|---| | Head | `(this PR)` | | Merge base | `0ae5a2664` (behind `main` `b41763227`) | | Merged onto | `main` — `merge-tree` clean, `git merge --no-ff` clean | **Ran** ``` cargo test -p leonida-gpu --lib resource 32 passed; 0 failed; 1 ignored resource::tests::the_texture_found_at_an_address_gives_way_to_the_one_before_it ... ok resource::tests::releasing_the_newer_texture_at_an_address_finds_the_older_again ... ok resource::tests::newer_then_older_at_one_address ... ok ``` **Negative control (synthetic)**: `targets_take` removes the texture it is given; I made it remove the oldest instead (`here.remove(0)`), rebuilt and ran: ``` FAILED: the_texture_found_at_an_address_gives_way_to_the_one_before_it assertion `left == right` failed: the older one is found again ``` **The test bites on the mechanism the change adds.** **What the change is**: the table of targets keeps a **stack per address** (`BTreeMap<u64, Vec<usize>>`) instead of one texture, so two textures found at one address both stay: the **newest answers a lookup**, and **releasing it gives way to the older one again** — which is what `targets_take`'s `newest` return and the three new tests pin. The scenario it models is a resource released and refound at the same address in a later place; before this, the older entry was lost. ## What I could not test - **The release/refind in a run**: the tests drive the table directly; no title, so the real address reuse is a shape, not a measured event. - **The one ignored test in the module** (it was already ignored): still ignored, and I did not chase what it needs. Written with an AI assistant.
upipibi commented 2026-12-03 16:29:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by upipibi on 2026-12-03T16:29:56Z.


@MoonEyes, on your question: neither source has what the newer target drew once it is released. Its host copy goes with it. Shader writes to a target reach title memory only for the kinds texback copies back (texback.rs:10-15, four water formats by default), and the release drops that texture's pending copies (resource.rs:3597, texback.rs:119-120). So the choice is between the older target's host copy and title memory that no draw reached (the comment at resource.rs:1873).

The older copy is the right answer for whatever the title does next. The older target is still alive, and the title can draw into it again. Those draws land in its host copy and nowhere else, for the same reason. With this PR, a view placed there sees them. On main, the view reads title memory and misses every one of them for as long as the older target lives.

It is also what main already gives in two other cases: when the newer target was never made, and when the two are released in the other order (older first, so the newer one stays found). With this change, which texture is found depends only on which targets are alive, not on the order they were released.

main's answer is better in one case. Suppose that after the release the memory is refilled by the CPU, or by a copy into a texture the title fills there (LEONIDA_COPY_BACK), and the older target is not drawn into again. Then title memory has the new data and the older copy doesn't. main already behaves this way whenever the older target is the only one at that address, so this PR adds no new case of it.

I've put this in the body, along with TripyFox's #2960 run: still blurred, so this PR does not fix #2960.

On the skip line: the other device tests in resource.rs also return without printing when there is no host (:4709, :4940, :5034 on main), and this one does the same. I've left the head at ff53fd8b9 so the runs above stay on the exact head. It still merges cleanly onto main 717b90233 (git merge-tree).

Answered with the help of Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7384939318 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3054#issuecomment-7384939318). Originally posted by [upipibi](https://github.com/upipibi) on 2026-12-03T16:29:56Z. --- @MoonEyes, on your question: neither source has what the newer target drew once it is released. Its host copy goes with it. Shader writes to a target reach title memory only for the kinds `texback` copies back (`texback.rs:10-15`, four water formats by default), and the release drops that texture's pending copies (`resource.rs:3597`, `texback.rs:119-120`). So the choice is between the older target's host copy and title memory that no draw reached (the comment at `resource.rs:1873`). The older copy is the right answer for whatever the title does next. The older target is still alive, and the title can draw into it again. Those draws land in its host copy and nowhere else, for the same reason. With this PR, a view placed there sees them. On `main`, the view reads title memory and misses every one of them for as long as the older target lives. It is also what `main` already gives in two other cases: when the newer target was never made, and when the two are released in the other order (older first, so the newer one stays found). With this change, which texture is found depends only on which targets are alive, not on the order they were released. `main`'s answer is better in one case. Suppose that after the release the memory is refilled by the CPU, or by a copy into a texture the title fills there (`LEONIDA_COPY_BACK`), and the older target is not drawn into again. Then title memory has the new data and the older copy doesn't. `main` already behaves this way whenever the older target is the only one at that address, so this PR adds no new case of it. I've put this in the body, along with TripyFox's #2960 run: still blurred, so this PR does not fix #2960. On the skip line: the other device tests in `resource.rs` also return without printing when there is no host (`:4709`, `:4940`, `:5034` on `main`), and this one does the same. I've left the head at `ff53fd8b9` so the runs above stay on the exact head. It still merges cleanly onto `main` `717b90233` (`git merge-tree`). *Answered with the help of Claude Code (Claude Opus 5.5).*
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3054:upstream-pr/3054'
git switch 'upstream-pr/3054'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3054'
git switch 'upstream-pr/3054'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3054'
git switch 'upstream-pr/3054'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3054'
git switch 'main'
git merge --squash 'upstream-pr/3054'
git switch 'main'
git merge --ff-only 'upstream-pr/3054'
git switch 'main'
git merge 'upstream-pr/3054'
git push origin 'main'
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
ProjectLeonida/mandy!3054
No description provided.