d3d12-gpu: a sparse read of only holes keeps the staged texels' digest (D3D12-GPU-SPARSE-ZERO-READ-DIGEST) #2841

Open
Kal0s-design wants to merge 3 commits from upstream-pr/2841 into main
Kal0s-design commented 2026-12-01 05:55:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-01T05:55:36Z.


Claimed in the coordination issue as: D3D12-GPU-SPARSE-ZERO-READ-DIGEST (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7277634936)

What and why

A partly mapped texture is read through its unmapped pages, which come back as zeros (d3d12/crates/leonida-gpu/src/texture.rs, the partial read path). That path stored the read's digest before it rejected an all-zero read. So a read that caught only holes replaced the digest of the texels already detiled, and the next read that found those same texels again detiled and uploaded them a second time.

The change: the decision moves into Last::accept_partial, which rejects an all-zero read before touching the digest, then compares and stores the digest as before. The full (committed) read path is unchanged and still takes a texture that really is all zeros.

This ports a fix from the sibling VIctory tree (TaynanGT/Vice-Tay 26aeded, GPL-3.0).

Tested

  • New test texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels: an all-zero first read stages nothing, a read with texels is taken, a later all-zero read keeps that digest, and the same texels again are not detiled. With main's order put back into accept_partial (a mutation of this branch), it fails (nothing staged yet: the next read with texels detiles, left: Some(Digest(..)), right: None); with the change it passes.
  • cargo test -p leonida-gpu --lib: 600 passed, 0 failed, 54 ignored (main 640b0d0df: 599).
  • cargo clippy -p leonida-gpu --lib --tests: no warning in the changed lines.
  • Windows only, unit tests; the title wasn't run.

GPUs tested: n/a (CPU unit tests)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5579973839 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-01T05:55:36Z. --- Claimed in the coordination issue as: D3D12-GPU-SPARSE-ZERO-READ-DIGEST (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7277634936) ### What and why A partly mapped texture is read through its unmapped pages, which come back as zeros (`d3d12/crates/leonida-gpu/src/texture.rs`, the partial read path). That path stored the read's digest **before** it rejected an all-zero read. So a read that caught only holes replaced the digest of the texels already detiled, and the next read that found those same texels again detiled and uploaded them a second time. The change: the decision moves into `Last::accept_partial`, which rejects an all-zero read before touching the digest, then compares and stores the digest as before. The full (committed) read path is unchanged and still takes a texture that really is all zeros. This ports a fix from the sibling VIctory tree (TaynanGT/Vice-Tay `26aeded`, GPL-3.0). ### Tested - New test `texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels`: an all-zero first read stages nothing, a read with texels is taken, a later all-zero read keeps that digest, and the same texels again are not detiled. With `main`'s order put back into `accept_partial` (a mutation of this branch), it fails (`nothing staged yet: the next read with texels detiles`, `left: Some(Digest(..))`, `right: None`); with the change it passes. - `cargo test -p leonida-gpu --lib`: 600 passed, 0 failed, 54 ignored (`main` `640b0d0df`: 599). - `cargo clippy -p leonida-gpu --lib --tests`: no warning in the changed lines. - Windows only, unit tests; the title wasn't run. GPUs tested: n/a (CPU unit tests) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KelboLive commented 2026-12-01 06:08:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T06:08:36Z.

Review: COMMENTED


The rule is right, and the important part is what it fixes indirectly: Last.hash now describes the staging buffer rather than the last read from title memory, which is what note_held() / unchanged() already assume — so this also stops a wrong "held" digest and stops the alone shortcut marking a texture read when it has only seen holes. 600 passed / 54 ignored here, and restoring the old order fails the new test with left: Some(Digest(..)), right: None.

I checked the invariant separately rather than only the new test:

  • a changed last byte after staging still detiles;
  • a single non-zero byte among 127 hole bytes is taken, so a real texel at a hole boundary is not skipped (the all-zero test is whole-buffer);
  • repeated identical bytes do not detile;
  • no order dependence: copy_mapped zeroes every hole (host.rs:12164, :12250), with_read always hands size bytes, and digest is pure over them.

Two asks:

  1. Pin the invariant in the committed test. It proves the hole-only read no longer poisons the digest, but never that a real change after staging still detiles, nor a mixed texel/hole buffer. Two one-line assertions (I added them temporarily; they pass) would make the test describe the whole rule.
  2. Add the provenance. The body says this ports TaynanGT/Vice-Tay 26aeded (GPL-3.0) but the new doc comment cites nothing, while every other port in this file names repo/commit/author/licence (:160, :208, :1663, :1697). Same rule as the docstring PRs: the attribution belongs next to the code, not only in the PR body.

Cosmetic: accept_partial reads backwards (returning true means "changed, detile"); changed_partial would match the caller. The same texels under a different hole layout still hash differently and re-detile — pre-existing and not made worse, but the new comment could say the digest includes the hole zeros.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6126012220 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#pullrequestreview-6126012220). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T06:08:36Z. **Review:** COMMENTED --- The rule is right, and the important part is what it fixes indirectly: `Last.hash` now describes the **staging buffer** rather than the last read from title memory, which is what `note_held()` / `unchanged()` already assume — so this also stops a wrong "held" digest and stops the `alone` shortcut marking a texture read when it has only seen holes. 600 passed / 54 ignored here, and restoring the old order fails the new test with `left: Some(Digest(..)), right: None`. I checked the invariant separately rather than only the new test: - a changed last byte after staging still detiles; - a single non-zero byte among 127 hole bytes is taken, so a real texel at a hole boundary is not skipped (the all-zero test is whole-buffer); - repeated identical bytes do not detile; - no order dependence: `copy_mapped` zeroes every hole (`host.rs:12164`, `:12250`), `with_read` always hands `size` bytes, and `digest` is pure over them. Two asks: 1. **Pin the invariant in the committed test.** It proves the hole-only read no longer poisons the digest, but never that a *real* change after staging still detiles, nor a mixed texel/hole buffer. Two one-line assertions (I added them temporarily; they pass) would make the test describe the whole rule. 2. **Add the provenance.** The body says this ports `TaynanGT/Vice-Tay 26aeded` (GPL-3.0) but the new doc comment cites nothing, while every other port in this file names repo/commit/author/licence (`:160`, `:208`, `:1663`, `:1697`). Same rule as the docstring PRs: the attribution belongs next to the code, not only in the PR body. Cosmetic: `accept_partial` reads backwards (returning `true` means "changed, detile"); `changed_partial` would match the caller. The same texels under a *different hole layout* still hash differently and re-detile — pre-existing and not made worse, but the new comment could say the digest includes the hole zeros.
lixonik commented 2026-12-01 09:40:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T09:40:49Z.


Reviewed and verified PR #2841 (fix/texture-sparse-zero-digest, merged onto main 7fbcd456e):

  • Diff check: moving the all-zero check ahead of self.hash = Some(hash) in Last::accept_partial prevents a hole-only read from overwriting the digest of previously staged texels, avoiding redundant detile + upload when the texels are read again.
  • cargo test --locked -p leonida-gpu --lib texture::partial_tests -- --nocapture: 2 passed, 0 failed (a_partly_mapped_texture_is_read_again_after_a_write, a_zero_sparse_read_keeps_the_digest_of_the_staged_texels).

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (driver 621.40, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T)

AI-assisted: Antigravity

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7307049032 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7307049032). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-01T09:40:49Z. --- Reviewed and verified PR `#2841` (`fix/texture-sparse-zero-digest`, merged onto `main` `7fbcd456e`): - Diff check: moving the all-zero check ahead of `self.hash = Some(hash)` in `Last::accept_partial` prevents a hole-only read from overwriting the digest of previously staged texels, avoiding redundant detile + upload when the texels are read again. - `cargo test --locked -p leonida-gpu --lib texture::partial_tests -- --nocapture`: **2 passed, 0 failed** (`a_partly_mapped_texture_is_read_again_after_a_write`, `a_zero_sparse_read_keeps_the_digest_of_the_staged_texels`). GPUs tested: NVIDIA GeForce RTX 5070 12 GB (driver 621.40, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T) AI-assisted: Antigravity
MoonEyes commented 2026-12-01 15:20:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T15:20:34Z.


0729d56df: the doc comment names where the change comes from (TaynanGT/Vice-Tay 26aeded), and the test also checks that other texels are detiled and their digest kept. Without self.hash = Some(hash) the test fails. On main cd0c52fcf: 632 passed, 0 failed.

Pushed to your branch by MoonEyes (maintainer, the branch allows it), on top of your head, nothing rewritten. Say so if you would rather have it another way, and I take it out. The earlier verdicts are for the head before this one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315750329 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7315750329). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T15:20:34Z. --- `0729d56df`: the doc comment names where the change comes from (TaynanGT/Vice-Tay 26aeded), and the test also checks that other texels are detiled and their digest kept. Without `self.hash = Some(hash)` the test fails. On `main` `cd0c52fcf`: 632 passed, 0 failed. Pushed to your branch by MoonEyes (maintainer, the branch allows it), on top of your head, nothing rewritten. Say so if you would rather have it another way, and I take it out. The earlier verdicts are for the head before this one. AI-assisted (Claude Code).
merzleckeier commented 2026-12-01 15:32:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:32:04Z.


I tested 0729d56d together with #2852 c4e286fd on 0ff8a532f. The cleanly merged Win64 MSVC target passed the partial-texture and physical-page write selection on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04), using Wine 11.22. The combined selection also passed on both GPUs with LEONIDA_PAGE_WRITES=slots and with 0 (the bake path).

A local digest-before-zero ordering control changes only when this function rejects zero bytes: hash/check/store before rejecting holes, as the old partial path did. Run alone, the stock regression test then fails on the first zero read because the previously empty digest has been populated. The fixed version also checks that a staged texture keeps its digest through holes and accepts different texels afterwards. This is coverage of the partial-read decision and its integration with the neighboring change. MEASURED, AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7316075759 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7316075759). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:32:04Z. --- I tested 0729d56d together with #2852 c4e286fd on 0ff8a532f. The cleanly merged Win64 MSVC target passed the partial-texture and physical-page write selection on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04), using Wine 11.22. The combined selection also passed on both GPUs with LEONIDA_PAGE_WRITES=slots and with 0 (the bake path). A local digest-before-zero ordering control changes only when this function rejects zero bytes: hash/check/store before rejecting holes, as the old partial path did. Run alone, the stock regression test then fails on the first zero read because the previously empty digest has been populated. The fixed version also checks that a staged texture keeps its digest through holes and accepts different texels afterwards. This is coverage of the partial-read decision and its integration with the neighboring change. MEASURED, AI-assisted (Codex).
DadaCap commented 2026-12-01 16:15:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-12-01T16:15:03Z.


Independent red/green on Windows 11 (RTX 5080, NVIDIA 621.24), head 0729d56df merged into main 0ff8a532f:

  • python -I scripts/red_green.py 2841 gives "red does not build": the new test calls the new Last::accept_partial, so main plus the test alone cannot compile. Not a red by itself.
  • Red by mutation instead: with the PR merged, accept_partial given main's order back (the digest kept before the all-zero check) makes texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels fail at texture.rs:6025 ("nothing staged yet: the next read with texels detiles"); with the fix restored it passes. So the test locks the change.
  • Green: all of leonida-gpu on main + PR, 691 run, 0 failed.

It touches rendering, so the in-game gate is still to do; no in-game run from me yet. AI-assisted (Claude Code), posted for DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317287583 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7317287583). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-12-01T16:15:03Z. --- Independent red/green on Windows 11 (RTX 5080, NVIDIA 621.24), head `0729d56df` merged into main `0ff8a532f`: - `python -I scripts/red_green.py 2841` gives "red does not build": the new test calls the new `Last::accept_partial`, so main plus the test alone cannot compile. Not a red by itself. - Red by mutation instead: with the PR merged, `accept_partial` given main's order back (the digest kept before the all-zero check) makes `texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels` fail at `texture.rs:6025` ("nothing staged yet: the next read with texels detiles"); with the fix restored it passes. So the test locks the change. - Green: all of `leonida-gpu` on main + PR, 691 run, 0 failed. It touches rendering, so the in-game gate is still to do; no in-game run from me yet. AI-assisted (Claude Code), posted for DadaCap.
MoonEyes commented 2026-12-02 12:28:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:28:51Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345403087 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7345403087). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:28:51Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Kal0s-design commented 2026-12-02 12:31:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:31:30Z.


Thanks. I can't post that run myself: I only run unit, WARP and debug-layer tests here and don't start the title. If anyone with a working setup can post a report on head 0729d56df merged onto current main (300 s in the world, device losses, median fps, and main alone for comparison), that would unblock it. I'll keep the branch merged-clean in the meantime.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345468682 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7345468682). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T12:31:30Z. --- Thanks. I can't post that run myself: I only run unit, WARP and debug-layer tests here and don't start the title. If anyone with a working setup can post a report on head `0729d56df` merged onto current `main` (300 s in the world, device losses, median fps, and `main` alone for comparison), that would unblock it. I'll keep the branch merged-clean in the meantime. AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 18:03:08 +00:00 (Migrated from github.com)

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


Code review only, not built (Windows-only leonida-gpu). The code is ready, but the in-game gate is still open.

  • Head: 24ff8f24c (a merge of main on top of 0729d56df), merge base bf7886746, 83 behind current main 45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.
  • Unit evidence is for 0729d56df. Between 0729d56df and 24ff8f24c, texture.rs changes only by one parenthesised expression from main, in allocation_costs.
    • DadaCap: mutation red, restoring main's order fails a_zero_sparse_read_keeps_the_digest_of_the_staged_texels. All of leonida-gpu passes.
    • merzleckeier: RADV and RTX under Wine.
  • Missing: the render-path in-game run MoonEyes asked for (12:28). Kal0s-design said they cannot run the title.

Review of d3d12/crates/leonida-gpu/src/texture.rs:

  • Last::accept_partial checks all-zero before storing the digest. A read that catches only holes leaves the staged texels' digest in place, so the next read of the same texels is not detiled and uploaded again. That is the root cause, credited to TaynanGT/Vice-Tay 26aeded (GPL-3.0).
  • Behaviour for a first read of holes is unchanged: no detile, hash stays None.
  • The scan order changes from hash-then-zero-check to zero-check-then-hash. For non-zero data, all(|b| b == 0) stops at the first non-zero byte, so the cost is the same or lower.
  • The test covers holes first, texels, holes again (digest kept), the same texels (skipped) and other texels (taken).

Verdict: ready on code. Do not merge until an in-game run on the current head (300 s, device losses, median fps) is posted.

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353895837 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7353895837). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:03:08Z. --- **Code review only, not built (Windows-only `leonida-gpu`). The code is ready, but the in-game gate is still open.** - Head: `24ff8f24c` (a merge of `main` on top of `0729d56df`), merge base `bf7886746`, 83 behind current `main` `45dc41f95`. A trial merge is clean. CI on the head: all 6 checks pass. - Unit evidence is for `0729d56df`. Between `0729d56df` and `24ff8f24c`, `texture.rs` changes only by one parenthesised expression from `main`, in `allocation_costs`. - DadaCap: mutation red, restoring `main`'s order fails `a_zero_sparse_read_keeps_the_digest_of_the_staged_texels`. All of `leonida-gpu` passes. - merzleckeier: RADV and RTX under Wine. - Missing: the render-path in-game run MoonEyes asked for (12:28). Kal0s-design said they cannot run the title. **Review of `d3d12/crates/leonida-gpu/src/texture.rs`:** - `Last::accept_partial` checks all-zero before storing the digest. A read that catches only holes leaves the staged texels' digest in place, so the next read of the same texels is not detiled and uploaded again. That is the root cause, credited to TaynanGT/Vice-Tay 26aeded (GPL-3.0). - Behaviour for a first read of holes is unchanged: no detile, `hash` stays `None`. - The scan order changes from hash-then-zero-check to zero-check-then-hash. For non-zero data, `all(|b| b == 0)` stops at the first non-zero byte, so the cost is the same or lower. - The test covers holes first, texels, holes again (digest kept), the same texels (skipped) and other texels (taken). Verdict: **ready** on code. Do not merge until an in-game run on the current head (300 s, device losses, median fps) is posted. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:34:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:55Z.


RUN (independent run on Windows, head 24ff8f24cfb5fe90c72295ec87f6b1679fd7a023, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

Merge result: clean, no conflict (merge commit ed58c170c). Only d3d12/crates/leonida-gpu/src/texture.rs changes (+39/-7). Unit tests only; the title was not started.

Green

  • cargo test -p leonida-gpu --release --locked --lib on the merge: 704 passed, 0 failed, 59 ignored.
  • texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels passes on the merge.
  • --features diagnostics --lib not run: the PR only keeps the existing #[cfg(feature = "diagnostics")] lines as they were, with no new diagnostics code. No Python test is touched.

Red

The new test calls the new Last::accept_partial, so it cannot compile against main's texture.rs (a compile failure, not a real red). Four mutations of accept_partial on the merged tree, each run against that test:

# Mutation Result
1 main's order back (digest kept, then the all-zero check) killed (test fails)
2 all-zero check removed killed
3 self.hash = Some(hash) removed killed
4 the self.hash == Some(hash) early return removed killed

All four are caught. The files were restored with git checkout HEAD --.

Review

  • Behaviour: the partial path used to store the digest of every read and only then drop an all-zero one. A hole-only read therefore overwrote the digest of the texels already staged, and the same texels read again were detiled and uploaded a second time. Now an all-zero read leaves the digest alone. A read that is all zeros still returns false as before (nothing is uploaded), so the only change is what Last.hash holds afterwards. The full (committed) read path is untouched.
  • Default-off switches: none added, so no docs/switches.md regeneration is needed. The change is unconditional, on the partial path only.
  • Ordering, lifetimes, fences: the logic is inside the closure of with_read, same lock and same buffer as before; no new fence, no new lifetime. found_blind(last) still runs only when changed.
  • Claim: D3D12-GPU-SPARSE-ZERO-READ-DIGEST, linked to issues/2570 in the description. The only open PR found for this topic is this one.
  • Provenance: a fix from TaynanGT/Vice-Tay 26aeded (GPL-3.0), named in the doc comment.
  • Open questions on the PR: none unanswered on the code. MoonEyes asked for an in-game run on the current head; Kal0s-design said they cannot start the title.
  • In-game runs posted on this exact head 24ff8f24c: none. The existing Wine runs by another contributor (RADV and NVIDIA, partial-texture and page-write selection) and the Windows red/green by DadaCap are on 0729d56df. Between that commit and this head, the diff in texture.rs is limited to a merge from main.

Not covered

  • The test exercises accept_partial directly. A call site that stopped calling it (for instance a later edit to refresh in the partial branch) would not be caught by this test.
  • No run of the title: no device-loss check, no fps, no look at streamed textures in the world.
  • No --features diagnostics build.
  • The test only runs with all-zero and constant-byte buffers; no real tiled data.

Verdict

PARTIAL: the code and the unit evidence are sound (green on the merge, 4 of 4 mutations killed). The in-game run is still required: none is posted on this head, and this is a render-path change.

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359483636 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7359483636). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:34:55Z. --- RUN (independent run on Windows, head `24ff8f24cfb5fe90c72295ec87f6b1679fd7a023`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) Merge result: clean, no conflict (merge commit `ed58c170c`). Only `d3d12/crates/leonida-gpu/src/texture.rs` changes (+39/-7). Unit tests only; the title was not started. ### Green - `cargo test -p leonida-gpu --release --locked --lib` on the merge: 704 passed, 0 failed, 59 ignored. - `texture::partial_tests::a_zero_sparse_read_keeps_the_digest_of_the_staged_texels` passes on the merge. - `--features diagnostics --lib` not run: the PR only keeps the existing `#[cfg(feature = "diagnostics")]` lines as they were, with no new diagnostics code. No Python test is touched. ### Red The new test calls the new `Last::accept_partial`, so it cannot compile against `main`'s `texture.rs` (a compile failure, not a real red). Four mutations of `accept_partial` on the merged tree, each run against that test: | # | Mutation | Result | |---|----------|--------| | 1 | `main`'s order back (digest kept, then the all-zero check) | killed (test fails) | | 2 | all-zero check removed | killed | | 3 | `self.hash = Some(hash)` removed | killed | | 4 | the `self.hash == Some(hash)` early return removed | killed | All four are caught. The files were restored with `git checkout HEAD --`. ### Review - Behaviour: the partial path used to store the digest of every read and only then drop an all-zero one. A hole-only read therefore overwrote the digest of the texels already staged, and the same texels read again were detiled and uploaded a second time. Now an all-zero read leaves the digest alone. A read that is all zeros still returns false as before (nothing is uploaded), so the only change is what `Last.hash` holds afterwards. The full (committed) read path is untouched. - Default-off switches: none added, so no `docs/switches.md` regeneration is needed. The change is unconditional, on the partial path only. - Ordering, lifetimes, fences: the logic is inside the closure of `with_read`, same lock and same buffer as before; no new fence, no new lifetime. `found_blind(last)` still runs only when `changed`. - Claim: D3D12-GPU-SPARSE-ZERO-READ-DIGEST, linked to issues/2570 in the description. The only open PR found for this topic is this one. - Provenance: a fix from TaynanGT/Vice-Tay `26aeded` (GPL-3.0), named in the doc comment. - Open questions on the PR: none unanswered on the code. MoonEyes asked for an in-game run on the current head; Kal0s-design said they cannot start the title. - In-game runs posted on this exact head `24ff8f24c`: none. The existing Wine runs by another contributor (RADV and NVIDIA, partial-texture and page-write selection) and the Windows red/green by DadaCap are on `0729d56df`. Between that commit and this head, the diff in `texture.rs` is limited to a merge from `main`. ### Not covered - The test exercises `accept_partial` directly. A call site that stopped calling it (for instance a later edit to `refresh` in the partial branch) would not be caught by this test. - No run of the title: no device-loss check, no fps, no look at streamed textures in the world. - No `--features diagnostics` build. - The test only runs with all-zero and constant-byte buffers; no real tiled data. ### Verdict PARTIAL: the code and the unit evidence are sound (green on the merge, 4 of 4 mutations killed). The in-game run is still required: none is posted on this head, and this is a render-path change. AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
enlight3d commented 2026-12-03 00:54:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:28Z.


RUN (in game, gate-style): head 24ff8f24c tested in a batch of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with git merge --no-ff onto main f3865cae8. One conflict, in the credit table of d3d12/README.md when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: d3d12/docs/switches.md (#2686, #3119, #3154) and d3d12/README.md (#2588, #3119). Built with diagnostics,mimalloc, target x86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).

Launcher defaults except -PrecompileUsed, Series S settings, -NoDlss -NoFrameGen, standing at the save. On this main the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use -PrecompileUsed (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world:

Reached the world 75 s
Time in the world 331 s
Device losses 0
Crashes 0
Frame median 35.0 ms (28.2 fps rendered)
Card busy 85 %
Private memory, max 28.1 GB

Warnings: only kinds that a run on the same main with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally.

This pull request's own lines: none in the log (the partial-read path keeps its digest without a line). It is covered by the run as a whole: textures drawn normally in the frames saved, and the "texture changed after its upload" warnings in the same numbers as the run without it (203 / 201).

Verdict: PASS for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: -RayTracing, DLSS and frame generation, other GPUs, Wine/Proton.

AI-assisted: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363730489 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7363730489). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-03T00:54:28Z. --- RUN (in game, gate-style): head 24ff8f24c tested **in a batch** of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with `git merge --no-ff` onto `main` f3865cae8. One conflict, in the credit table of `d3d12/README.md` when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: `d3d12/docs/switches.md` (#2686, #3119, #3154) and `d3d12/README.md` (#2588, #3119). Built with `diagnostics,mimalloc`, target `x86_64-pc-windows-msvc`. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Launcher defaults except `-PrecompileUsed`, Series S settings, `-NoDlss -NoFrameGen`, standing at the save. On this `main` the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use `-PrecompileUsed` (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world: | | | |---|---| | Reached the world | 75 s | | Time in the world | 331 s | | Device losses | 0 | | Crashes | 0 | | Frame median | 35.0 ms (28.2 fps rendered) | | Card busy | 85 % | | Private memory, max | 28.1 GB | Warnings: only kinds that a run on the same `main` with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally. This pull request's own lines: none in the log (the partial-read path keeps its digest without a line). It is covered by the run as a whole: textures drawn normally in the frames saved, and the "texture changed after its upload" warnings in the same numbers as the run without it (203 / 201). Verdict: **PASS** for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: `-RayTracing`, DLSS and frame generation, other GPUs, Wine/Proton. AI-assisted: Claude Code (Claude Opus 5.5)
fiestorra commented 2026-12-03 03:25:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:25:51Z.


VERIFY-2841 — el test nuevo pasa, y la única falla de la suite es la conocida de esta máquina

Un fichero, texture.rs, +39/−7, cinco días abierto:

cargo test -p leonida-gpu --lib                         691 passed; 1 failed; 59 ignored
cargo test -p leonida-gpu --lib a_zero_sparse_read       1 passed     ← el test que añade la PR
cargo test -p leonida-gpu --lib views_are_made_beside     1 failed     ← el de la iGPU

Y eso despeja lo que en una suite grande parece un problema: la única falla es descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, la misma que hay en main sin esta PR, y el test nuevo pasa solo. Lo dejo escrito porque "691 passed, 1 failed" en un comentario de revisión no dice nada útil sin ese desglose, y un lector podría tomarlo por un fallo de la PR.

El cambio, en una frase: una lectura dispersa que sólo toca huecos no cambia el digest de los texels preparados — el caso en que un CopyTextureRegion con todo ceros movía el hash de un recurso que nadie había escrito. Y el nombre del test lo dice: a_zero_sparse_read_keeps_the_digest_of_the_staged_texels.

Lo que no probé: que el digest que importa sea el de la GPU y no el del stub — el test compara los valores que el crate calcula, no un ReadBack de verdad; para eso hace falta el título.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366557890 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2841#issuecomment-7366557890). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:25:51Z. --- ## VERIFY-2841 — el test nuevo pasa, y la única falla de la suite es la conocida de esta máquina **Un fichero, `texture.rs`, +39/−7, cinco días abierto**: ``` cargo test -p leonida-gpu --lib 691 passed; 1 failed; 59 ignored cargo test -p leonida-gpu --lib a_zero_sparse_read 1 passed ← el test que añade la PR cargo test -p leonida-gpu --lib views_are_made_beside 1 failed ← el de la iGPU ``` **Y eso despeja lo que en una suite grande parece un problema**: **la única falla es `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in`**, **la misma que hay en `main` sin esta PR**, **y el test nuevo pasa solo.** **Lo dejo escrito porque "691 passed, 1 failed" en un comentario de revisión no dice nada útil sin ese desglose**, **y un lector podría tomarlo por un fallo de la PR.** **El cambio, en una frase**: **una lectura dispersa que sólo toca huecos no cambia el digest de los texels preparados** — **el caso en que un `CopyTextureRegion` con todo ceros movía el hash de un recurso que nadie había escrito.** **Y el nombre del test lo dice**: `a_zero_sparse_read_keeps_the_digest_of_the_staged_texels`. **Lo que no probé**: **que el digest que importa sea el de la GPU y no el del stub** — **el test compara los valores que el crate calcula, no un `ReadBack` de verdad**; **para eso hace falta el título.** Written with an AI assistant.
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/2841:upstream-pr/2841'
git switch 'upstream-pr/2841'

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