d3d12 hwrt: the meshlet index cache is bounded; opt-in shown structures and recorded transforms (D3D12-HWRT-MESHLET-BOUND) #3297

Open
OreoFR wants to merge 6 commits from upstream-pr/3297 into main
OreoFR commented 2026-12-03 05:23:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T05:23:58Z.


Item: D3D12-HWRT-MESHLET-BOUND (claimed in #2570).

Extracted from tomk134's local branch (github.com/tomk134/mandy, local/2026-12-03, 844265408). Its hardware-RT pieces port Darner (codefloe.com/TrustNo1/Darner, GPL-3.0-or-later like this repo): 79548f7 for the meshlet cache bound and shown, 6a5f7eeb for the recorded transforms. Credit goes to both.

What changes

  • The meshlet index cache is bounded.
    • Before: decoded_ibs kept every decoded title meshlet index buffer (a committed UPLOAD buffer each) for the whole session.
    • Now: a bounded cache, 256 MB by default (LEONIDA_HW_RT_MESHLET_CACHE_MB; 0 = no bound, as before).
      • Below the bound it keeps exactly what it kept before.
      • Past the bound the least recently used entries go, down to three quarters. An entry used in the current frame is never displaced.
      • Each buffer is charged a whole placement unit.
      • Freed title memory forgets its entries, and a decode that raced the free is not cached.
  • LEONIDA_HW_RT_SHOWN=1, off by default (a trial).
    • What it does: top levels name only bottom structures whose build or copy lies in lists already submitted. This set is kept at submit time through a new HostList::at_submit. Today they name what as_map holds, which is recorded up to a frame ahead, so a top level can name structures the card has not built yet.
    • Why off by default: it changes which structures rays can hit for a frame, and it has not been run in game here.
  • LEONIDA_HW_RT_TX_COPY=1, off by default (a trial).
    • What it does: a triangle build that the budget defers past the frame the title recorded it in takes the 3x4 transform as it was then. main has no equivalent.
    • Darner's own count: 63 of 690 deferred builds read garbage transforms.

Tested

  • Unit tests: five new MeshletCache tests:
    • the switch;
    • below the bound nothing changes, and 0 is unbounded;
    • past the bound the LRU goes down to three quarters;
    • entries of the current frame are kept;
    • freed memory, and a racing decode.
  • Suite: cargo test -p leonida-gpu: 721 passed, 59 ignored. cargo clippy -p leonida-gpu --all-targets -- -D warnings: clean.
  • Counter-test: with the eviction disabled, two of the new tests fail.
  • Repo checks: switches.md regenerated (731 names) and --check OK; check_no_game_data OK.
  • Not run in game.

Needs: an in-game run with -HardwareRT: the default path (the bound), then LEONIDA_HW_RT_SHOWN=1 and LEONIDA_HW_RT_TX_COPY=1.

AI-assisted (oreofr-agent, Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5620554493 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T05:23:58Z. --- Item: **D3D12-HWRT-MESHLET-BOUND** (claimed in #2570). Extracted from tomk134's local branch (github.com/tomk134/mandy, `local/2026-12-03`, 844265408). Its hardware-RT pieces port **Darner** (codefloe.com/TrustNo1/Darner, GPL-3.0-or-later like this repo): 79548f7 for the meshlet cache bound and `shown`, 6a5f7eeb for the recorded transforms. Credit goes to both. ## What changes - **The meshlet index cache is bounded.** - **Before:** `decoded_ibs` kept every decoded title meshlet index buffer (a committed UPLOAD buffer each) for the whole session. - **Now:** a bounded cache, 256 MB by default (`LEONIDA_HW_RT_MESHLET_CACHE_MB`; `0` = no bound, as before). - Below the bound it keeps exactly what it kept before. - Past the bound the least recently used entries go, down to three quarters. An entry used in the current frame is never displaced. - Each buffer is charged a whole placement unit. - Freed title memory forgets its entries, and a decode that raced the free is not cached. - **`LEONIDA_HW_RT_SHOWN=1`, off by default (a trial).** - **What it does:** top levels name only bottom structures whose build or copy lies in lists already submitted. This set is kept at submit time through a new `HostList::at_submit`. Today they name what `as_map` holds, which is recorded up to a frame ahead, so a top level can name structures the card has not built yet. - **Why off by default:** it changes which structures rays can hit for a frame, and it has not been run in game here. - **`LEONIDA_HW_RT_TX_COPY=1`, off by default (a trial).** - **What it does:** a triangle build that the budget defers past the frame the title recorded it in takes the 3x4 transform as it was then. main has no equivalent. - **Darner's own count:** 63 of 690 deferred builds read garbage transforms. ## Tested - **Unit tests:** five new `MeshletCache` tests: - the switch; - below the bound nothing changes, and `0` is unbounded; - past the bound the LRU goes down to three quarters; - entries of the current frame are kept; - freed memory, and a racing decode. - **Suite:** `cargo test -p leonida-gpu`: 721 passed, 59 ignored. `cargo clippy -p leonida-gpu --all-targets -- -D warnings`: clean. - **Counter-test:** with the eviction disabled, two of the new tests fail. - **Repo checks:** `switches.md` regenerated (731 names) and `--check` OK; `check_no_game_data` OK. - **Not run in game.** Needs: an in-game run with `-HardwareRT`: the default path (the bound), then `LEONIDA_HW_RT_SHOWN=1` and `LEONIDA_HW_RT_TX_COPY=1`. AI-assisted (oreofr-agent, Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier commented 2026-12-03 05:37:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T05:37:22Z.

Review: COMMENTED


Reviewed the default cache path on dd1c4d2e merged onto d9b618f10. The Windows MSVC build passed. Under Wine, all five new cache tests passed. The wider hwrt::tests filter gave 26 passes and the same REMAP_HLSL compiles failure that I reproduced on exact main in the same Wine setup. All 20 catalog tests passed.

[P3] Preserve older cache entries when current-frame entries leave too little room for a miss. With an 8 MiB limit, 7 MiB touched this frame, and one older 1 MiB entry, a 2 MiB miss evicts that older entry and still returns the new buffer without caching it. I reproduced this in the exact MeshletCache code: the returned values are [older, new]. Checking the reclaimable bytes while collecting older candidates lets this case return just [new], keeps the cache within the bound, and passed the five stock tests plus the new case. That would avoid an extra miss if the older entry is needed again. The fixture used numeric stand-ins for buffers. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6164249268 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#pullrequestreview-6164249268). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T05:37:22Z. **Review:** COMMENTED --- Reviewed the default cache path on `dd1c4d2e` merged onto `d9b618f10`. The Windows MSVC build passed. Under Wine, all five new cache tests passed. The wider `hwrt::tests` filter gave 26 passes and the same `REMAP_HLSL compiles` failure that I reproduced on exact `main` in the same Wine setup. All 20 catalog tests passed. **[P3] Preserve older cache entries when current-frame entries leave too little room for a miss.** With an 8 MiB limit, 7 MiB touched this frame, and one older 1 MiB entry, a 2 MiB miss evicts that older entry and still returns the new buffer without caching it. I reproduced this in the exact `MeshletCache` code: the returned values are `[older, new]`. Checking the reclaimable bytes while collecting older candidates lets this case return just `[new]`, keeps the cache within the bound, and passed the five stock tests plus the new case. That would avoid an extra miss if the older entry is needed again. The fixture used numeric stand-ins for buffers. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 05:44:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:44:06Z.


VERIFY-3296 — 718/1 y 720/1: las dos con la falla de la iGPU como única, y el opt-in en las dos

Las dos últimas de OreoFR, y las dos con el mismo patrón de la de ayer:

#3296  resource.rs +100, switches.md    718 passed; 1 failed; 59 ignored
#3297  hwrt.rs +432, switches.md        720 passed; 1 failed; 59 ignored

718 y 720 contra los 715 de main — tres y cinco tests nuevos, y en las dos el único fallo es views_are_made_beside…, el de la iGPU de esta máquina.

#3296 — un tope por barrido de texturas

Y es el hermano de #3291 (tope al tiempo total de las pasadas de un frame): el mismo autor, la misma idea, una granularidad distinta — allí el frame entero, aquí cada barrido. Y las dos opt-in.

Que esa decisión se repita cuatro veces en tres PRs (#3290, #3291, #3296, #3297) es lo que quiero acreditar: no es que el autor prefiera interruptores por comodidad — es que en un repositorio donde cada cambio de memoria o de tiempo se mide en gpu-test-results/ con la misma máquina y el mismo título, un cambio siempre-encendido invalida las filas anteriores. El interruptor es lo que permite añadir una fila.

#3297 — el caché de índices de meshlets, acotado

432 líneas en hwrt.rs, el más grande de los cuatro, y switches.md cambia con él en los dos — que en este repositorio es la señal de que la superficie que el jugador puede tocar cambia.

Lo que verifiqué en las dos: la suite completa del crate, con la única falla conocida.
Lo que no: que el caché se acote de verdad ni que el barrido mejore el frame — los dos son estados que se provocan con el título y se miden con una fila de gpu-test-results/, y ninguna de las dos PRs trae una.
Y lo que pediría, con #2379 ya en la cola: cuando entre la herramienta que resume los registros, estas cuatro PRs son las primeras que deberían tener su fila.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369055152 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369055152). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:44:06Z. --- ## VERIFY-3296 — 718/1 y 720/1: las dos con la falla de la iGPU como única, y el `opt-in` en las dos **Las dos últimas de OreoFR, y las dos con el mismo patrón de la de ayer**: ``` #3296 resource.rs +100, switches.md 718 passed; 1 failed; 59 ignored #3297 hwrt.rs +432, switches.md 720 passed; 1 failed; 59 ignored ``` **718 y 720 contra los 715 de `main`** — **tres y cinco tests nuevos**, **y en las dos el único fallo es `views_are_made_beside…`, el de la iGPU de esta máquina.** ## `#3296` — un tope por barrido de texturas **Y es el hermano de `#3291`** (tope al tiempo total de las pasadas de un frame): **el mismo autor, la misma idea, una granularidad distinta** — **allí el frame entero, aquí cada barrido.** **Y las dos `opt-in`.** **Que esa decisión se repita cuatro veces en tres PRs (`#3290`, `#3291`, `#3296`, `#3297`) es lo que quiero acreditar**: **no es que el autor prefiera interruptores por comodidad** — **es que en un repositorio donde cada cambio de memoria o de tiempo se mide en `gpu-test-results/` con la misma máquina y el mismo título, un cambio siempre-encendido invalida las filas anteriores.** **El interruptor es lo que permite añadir una fila.** ## `#3297` — el caché de índices de meshlets, acotado **432 líneas en `hwrt.rs`**, **el más grande de los cuatro**, **y `switches.md` cambia con él en los dos** — **que en este repositorio es la señal de que la superficie que el jugador puede tocar cambia.** **Lo que verifiqué en las dos**: **la suite completa del crate, con la única falla conocida.** **Lo que no**: **que el caché se acote de verdad ni que el barrido mejore el frame** — **los dos son estados que se provocan con el título y se miden con una fila de `gpu-test-results/`, y ninguna de las dos PRs trae una.** **Y lo que pediría, con `#2379` ya en la cola**: **cuando entre la herramienta que resume los registros, estas cuatro PRs son las primeras que deberían tener su fila.**
fiestorra commented 2026-12-03 05:44:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:44:19Z.


Corrección de un número mío en el comentario anterior: 6 y 18, no «tres y cinco»

Escribí «718 y 720 contra los 715 de main — tres y cinco tests nuevos», y eso es aritmética sobre dos números que no se pueden restar: las bases de las dos ramas no son main de hoy, así que 718 − 715 no es el número de tests que añaden.

Medido en el diff de cada una (merge-base..head):

#3296   6 tests nuevos
#3297   18 tests nuevos

Y la diferencia con mi resta es exactamente la misma que corregí esta mañana con los conteos de i18n: restar dos números medidos en árboles distintos y llamar al resultado «lo que añade la PR». El total de la suite sí se puede comparar (los dos son de hoy); el desglose, no.

Lo que no cambia del comentario: las dos pasan con la única falla de la iGPU, las dos son opt-in, y la reflexión sobre por qué el interruptor se repite en cuatro PRs sigue en pie.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369059080 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369059080). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:44:19Z. --- ## Corrección de un número mío en el comentario anterior: **6 y 18**, no «tres y cinco» **Escribí «718 y 720 contra los 715 de `main` — tres y cinco tests nuevos»**, **y eso es aritmética sobre dos números que no se pueden restar**: **las bases de las dos ramas no son `main` de hoy, así que `718 − 715` no es el número de tests que añaden.** **Medido en el diff de cada una (`merge-base..head`)**: ``` #3296 6 tests nuevos #3297 18 tests nuevos ``` **Y la diferencia con mi resta es exactamente la misma que corregí esta mañana con los conteos de i18n**: **restar dos números medidos en árboles distintos y llamar al resultado «lo que añade la PR».** **El total de la suite sí se puede comparar (los dos son de hoy); el desglose, no.** **Lo que no cambia del comentario**: **las dos pasan con la única falla de la iGPU**, **las dos son `opt-in`**, **y la reflexión sobre por qué el interruptor se repite en cuatro PRs sigue en pie.**
OreoFR commented 2026-12-03 05:44:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T05:44:37Z.


Thanks @merzleckeier, fixed in 83c2a9279. insert now sums what the older entries would give back before evicting anything. When that cannot make room for the miss, it drops nothing and returns the buffer for one use. Your case is older_entries_stay_when_this_frame_leaves_too_little_room: it returns just [new] and the older entry is kept. cargo test -p leonida-gpu: 722 passed. Clippy: clean. Without the check, the new test fails. (oreofr-agent, AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369064635 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369064635). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T05:44:37Z. --- Thanks @merzleckeier, fixed in 83c2a9279. `insert` now sums what the older entries would give back before evicting anything. When that cannot make room for the miss, it drops nothing and returns the buffer for one use. Your case is `older_entries_stay_when_this_frame_leaves_too_little_room`: it returns just `[new]` and the older entry is kept. `cargo test -p leonida-gpu`: 722 passed. Clippy: clean. Without the check, the new test fails. (oreofr-agent, AI-assisted)
merzleckeier commented 2026-12-03 05:51:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T05:51:35Z.


Confirmed the fix at 83c2a927 with the exact cache code. All six cache tests passed, including the new regression. I also checked the boundary with an 8 MiB limit, 4 MiB touched this frame, and one older 4 MiB entry: 3 MiB and exactly 4 MiB requests evict the old entry and cache the miss. A 5 MiB request returns only its own buffer and leaves both entries in place. The previous head failed that last case by retiring both the old entry and the new buffer.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369191134 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369191134). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T05:51:35Z. --- Confirmed the fix at `83c2a927` with the exact cache code. All six cache tests passed, including the new regression. I also checked the boundary with an 8 MiB limit, 4 MiB touched this frame, and one older 4 MiB entry: 3 MiB and exactly 4 MiB requests evict the old entry and cache the miss. A 5 MiB request returns only its own buffer and leaves both entries in place. The previous head failed that last case by retiring both the old entry and the new buffer.
lixonik commented 2026-12-03 06:09:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:09:11Z.


RUN (in game, RTX 5070 12 GB, Hardware RT, 315 s in-world gate) -- PASS on head dd1c4d2e7 (merged cleanly via git merge --no-ff onto main d9b618f10).

Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79)

  • python -I scripts/check_no_game_data.py -> PASS
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md -> PASS
  • LEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --features diagnostics --lib --locked hwrt -> 27 passed, 0 failed
  • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -> PASS

Live In-Game Gate (-SeriesS -NoFrameGen, Hardware RT: LEONIDA_HW_RT=1, LEONIDA_AMBIENT=0, LEONIDA_RT_RESOLVE=1, LEONIDA_ACTIVATE_RAYS=1, default 256 MB meshlet cache bound)

  • Duration: 315 s in world (488.3 s total, 63 world samples >= 1000 draws, max 4,768 draws)
  • Errors / Device Lost / Crashes: 0 / 0 / 0
  • Rendered FPS (d3d12_run_fps.py): median 24.9 fps (40.2 ms; 3000-4999 draws median 25.0 fps across 57 samples; slowest tenth 6.8 fps during world entry, fastest tenth 25.6 fps)
  • Hardware RT Telemetry: hardware DXR 1.1 RT manager initialized (LEONIDA_HW_RT=1) tier=11; final counters BLAS live 5152 (built 17724, refit 306530, refit->rebuild 934, rehydrated 3342), TLAS live 5 (builds 34632), BLAS memory: budget 1075 MB, live 582 MB (4896 BLAS), evicted 0. (Opt-in LEONIDA_HW_RT_SHOWN / recorded-transforms switches were left at default off in this run.)

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369511924 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369511924). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:09:11Z. --- **RUN (in game, RTX 5070 12 GB, Hardware RT, 315 s in-world gate) -- PASS** on head `dd1c4d2e7` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79) - `python -I scripts/check_no_game_data.py` -> **PASS** - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` -> **PASS** - `LEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --features diagnostics --lib --locked hwrt` -> **27 passed, 0 failed** - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -> **PASS** ### Live In-Game Gate (`-SeriesS -NoFrameGen`, Hardware RT: `LEONIDA_HW_RT=1`, `LEONIDA_AMBIENT=0`, `LEONIDA_RT_RESOLVE=1`, `LEONIDA_ACTIVATE_RAYS=1`, default 256 MB meshlet cache bound) - **Duration:** `315 s` in world (`488.3 s` total, `63` world samples `>= 1000` draws, max `4,768` draws) - **Errors / Device Lost / Crashes:** **`0` / `0` / `0`** - **Rendered FPS (`d3d12_run_fps.py`):** median **`24.9 fps`** (`40.2 ms`; `3000-4999` draws median `25.0 fps` across `57` samples; slowest tenth `6.8 fps` during world entry, fastest tenth `25.6 fps`) - **Hardware RT Telemetry:** `hardware DXR 1.1 RT manager initialized (LEONIDA_HW_RT=1) tier=11`; final counters `BLAS live 5152` (`built 17724`, `refit 306530`, `refit->rebuild 934`, `rehydrated 3342`), `TLAS live 5` (`builds 34632`), `BLAS memory: budget 1075 MB, live 582 MB (4896 BLAS), evicted 0`. (Opt-in `LEONIDA_HW_RT_SHOWN` / recorded-transforms switches were left at default off in this run.) AI-assisted: yes (Antigravity -- Gemini 4 Neon).
MoonEyes commented 2026-12-03 06:15:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T06:15:00Z.


RUN (in game, one pull request), its head merged with git merge --no-ff onto main d9b618f10: #3297 83c2a9279. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.2, mean 16.6
Rendered fps, last 120 s median 16.2
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. Hardware ray tracing was not on in this 8 GB profile, so the bounded meshlet index cache and the opt-in shown structure were not exercised: this run shows the default path is unharmed, nothing more. An earlier run on head dd1c4d2e7 is not reported: the head moved during it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369624041 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7369624041). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T06:15:00Z. --- RUN (in game, one pull request), its head merged with `git merge --no-ff` onto main `d9b618f10`: #3297 `83c2a9279`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.2, mean 16.6 | | Rendered fps, last 120 s | median 16.2 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. Hardware ray tracing was not on in this 8 GB profile, so the bounded meshlet index cache and the opt-in shown structure were not exercised: this run shows the default path is unharmed, nothing more. An earlier run on head `dd1c4d2e7` is not reported: the head moved during it. AI-assisted (Claude Code).
merzleckeier commented 2026-12-03 06:15:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T06:15:38Z.

Review: COMMENTED


[P2] Capture transforms only for opted-in recorded builds. On 83c2a927, read_geometries runs title_readable (VirtualQuery) and copies 48 bytes for every readable nonzero transform, even with LEONIDA_HW_RT_TX_COPY=0. The flag is checked only when using the saved value later. The prebuild query uses the same decoder and needs only the zero/nonzero address bit, so it also pays for snapshots it discards.

I compiled the exact decoder and memory query with MSVC and fed it 16,384 generated triangle descriptors with a valid synthetic matrix under Wine 11.22. The current off path captured all 16,384 matrices (median 12.15 ms for the decoder). Checking the flag once before the loop captured zero with it off (0.44 ms) and still captured all 16,384 with it on (12.15 ms). These timings are for Wine and the fixture. The count verifies the behavior independent of timing.

Please gate capture on the recording path and leave it off for prebuild sizing. That keeps reads out of both the default path and calls that only compute sizes. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6164594094 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#pullrequestreview-6164594094). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T06:15:38Z. **Review:** COMMENTED --- **[P2] Capture transforms only for opted-in recorded builds.** On `83c2a927`, [`read_geometries`](https://github.com/ProjectLeonida/mandy/blob/83c2a92796e8d75e14b0e92a2732ca54dfa6ef31/d3d12/crates/leonida-gpu/src/hwrt.rs#L329-L353) runs `title_readable` (`VirtualQuery`) and copies 48 bytes for every readable nonzero transform, even with `LEONIDA_HW_RT_TX_COPY=0`. The flag is checked only when using the saved value later. [The prebuild query](https://github.com/ProjectLeonida/mandy/blob/83c2a92796e8d75e14b0e92a2732ca54dfa6ef31/d3d12/crates/leonida-gpu/src/hwrt.rs#L4410-L4445) uses the same decoder and needs only the zero/nonzero address bit, so it also pays for snapshots it discards. I compiled the exact decoder and memory query with MSVC and fed it 16,384 generated triangle descriptors with a valid synthetic matrix under Wine 11.22. The current off path captured all 16,384 matrices (median 12.15 ms for the decoder). Checking the flag once before the loop captured zero with it off (0.44 ms) and still captured all 16,384 with it on (12.15 ms). These timings are for Wine and the fixture. The count verifies the behavior independent of timing. Please gate capture on the recording path and leave it off for prebuild sizing. That keeps reads out of both the default path and calls that only compute sizes. AI-assisted with OpenAI Codex.
OreoFR commented 2026-12-03 06:52:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T06:52:51Z.


Thanks @merzleckeier, fixed in 583860881.

  • read_geometries takes a record flag. The prebuild sizing query passes false, the two recording paths pass true.
  • LEONIDA_HW_RT_TX_COPY is read once per call. capture_transform queries title memory and copies the 48 bytes only when the switch is on, the build is recorded and the transform is set.
  • Tests: with the switch off, nothing is captured and memory is never asked. With it on, the prebuild path asks nothing and a recorded build captures. cargo test -p leonida-gpu: 723 passed. Clippy: clean. With the gate removed, the test fails.

(oreofr-agent, AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370340305 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7370340305). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T06:52:51Z. --- Thanks @merzleckeier, fixed in 583860881. - **`read_geometries` takes a `record` flag.** The prebuild sizing query passes false, the two recording paths pass true. - **`LEONIDA_HW_RT_TX_COPY` is read once per call.** `capture_transform` queries title memory and copies the 48 bytes only when the switch is on, the build is recorded and the transform is set. - **Tests:** with the switch off, nothing is captured and memory is never asked. With it on, the prebuild path asks nothing and a recorded build captures. `cargo test -p leonida-gpu`: 723 passed. Clippy: clean. With the gate removed, the test fails. (oreofr-agent, AI-assisted)
merzleckeier commented 2026-12-03 07:01:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T07:01:08Z.


Confirmed the transform-capture fix at 58386088. I reran the decoder with 16,384 synthetic triangle descriptors per call and counted its memory queries and snapshots. Prebuild sizing performs zero queries and takes zero snapshots with the switch at either 0 or 1. A recorded build with the switch off also produces zero of each. With it on, the recorded build queries and captures all 16,384 transforms, and every copied matrix matches.

I also combined this head with the announced BLAS pool branch at 8c98f430 on d9b618f1. The only merge conflict was the generated switch catalogue. After regenerating it, all 20 catalogue tests passed. The combined Windows MSVC diagnostics build passed 28 HWRT tests under Wine 11.22, including the new transform test. I excluded the existing REMAP_HLSL compilation test after confirming the same Wine failure on plain main. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370497950 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7370497950). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T07:01:08Z. --- Confirmed the transform-capture fix at `58386088`. I reran the decoder with 16,384 synthetic triangle descriptors per call and counted its memory queries and snapshots. Prebuild sizing performs zero queries and takes zero snapshots with the switch at either `0` or `1`. A recorded build with the switch off also produces zero of each. With it on, the recorded build queries and captures all 16,384 transforms, and every copied matrix matches. I also combined this head with the announced BLAS pool branch at `8c98f430` on `d9b618f1`. The only merge conflict was the generated switch catalogue. After regenerating it, all 20 catalogue tests passed. The combined Windows MSVC diagnostics build passed 28 HWRT tests under Wine 11.22, including the new transform test. I excluded the existing `REMAP_HLSL` compilation test after confirming the same Wine failure on plain `main`. AI-assisted with OpenAI Codex.
x2Tweek commented 2026-12-03 07:29:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-12-03T07:29:53Z.


RUN (in game, RTX 5090 32 GB, -HardwareRT, default path): PASS, 0 device losses, no regression I can measure.

  • Head / main: head 583860881 merged with git merge --no-ff onto main d9b618f10 (merge bfa6bda9d, clean). No other changes.
  • GPU / driver / OS: NVIDIA GeForce RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300).
  • Build: diag, features diagnostics,dlss,mimalloc.
  • Settings: Series X profile, 3840x2160 output, DLSS quality, -HardwareRT -SmoothMotion -PrecompileAll -Log, LEONIDA_D3D12_DRED=1. This PR's switches are left at their defaults: the cache bound is on at 256 MB, and SHOWN and TX_COPY are off.
  • Scenario: the same save each time. A key driver presses Enter only while the log shows the menu (under 3000 draws a frame). In the world the character walks, and the camera turns all the time (look keys L/J, 20 s each way) to keep new BLASes and meshlet buffers coming. 600 s in the world.
run device lost fps median frames > 250 ms BLAS built AS memory committed at end textures in blocks
this PR 0 12.6 4 58.2k 175 → 980 MB 47.3 GB 13.9 GB
main alone, same scenario 0 12.4 1 63.9k 175 → 860 MB 48.0 GB 14.7 GB
  • Stability: no device loss, no DRED report, and no ERROR lines tied to hardware RT.
  • Frame rate and memory: the same as main within one run's noise.
  • Not checked: the picture by eye (unattended run). Also unconfirmed is whether the 256 MB bound was ever reached: I found no log line that says so. If there is a counter for meshlet cache evictions, tell me its name and I will read it from the same logs.

AI-assisted: the builds, the automated runs, the log reading and this write-up were done with Claude Opus 5.5 (Claude Code); the numbers are the runtime's own log lines.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371067112 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7371067112). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-12-03T07:29:53Z. --- **RUN (in game, RTX 5090 32 GB, `-HardwareRT`, default path): PASS, 0 device losses, no regression I can measure.** - **Head / main:** head `583860881` merged with `git merge --no-ff` onto `main` `d9b618f10` (merge `bfa6bda9d`, clean). No other changes. - **GPU / driver / OS:** NVIDIA GeForce RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300). - **Build:** diag, features `diagnostics,dlss,mimalloc`. - **Settings:** Series X profile, 3840x2160 output, DLSS quality, `-HardwareRT -SmoothMotion -PrecompileAll -Log`, `LEONIDA_D3D12_DRED=1`. This PR's switches are left at their defaults: the cache bound is on at 256 MB, and `SHOWN` and `TX_COPY` are off. - **Scenario:** the same save each time. A key driver presses Enter only while the log shows the menu (under 3000 draws a frame). In the world the character walks, and the camera turns all the time (look keys `L`/`J`, 20 s each way) to keep new BLASes and meshlet buffers coming. 600 s in the world. | run | device lost | fps median | frames > 250 ms | BLAS built | AS memory | committed at end | textures in blocks | |---|---|---|---|---|---|---|---| | this PR | 0 | 12.6 | 4 | 58.2k | 175 → 980 MB | 47.3 GB | 13.9 GB | | `main` alone, same scenario | 0 | 12.4 | 1 | 63.9k | 175 → 860 MB | 48.0 GB | 14.7 GB | - **Stability:** no device loss, no DRED report, and no ERROR lines tied to hardware RT. - **Frame rate and memory:** the same as `main` within one run's noise. - **Not checked:** the picture by eye (unattended run). Also unconfirmed is whether the 256 MB bound was ever reached: I found no log line that says so. If there is a counter for meshlet cache evictions, tell me its name and I will read it from the same logs. AI-assisted: the builds, the automated runs, the log reading and this write-up were done with Claude Opus 5.5 (Claude Code); the numbers are the runtime's own log lines.
MoonEyes commented 2026-12-03 07:31:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:31:26Z.


RUN (in game, one pull request), its head merged with git merge --no-ff onto main d9b618f10: #3297 583860881. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.3, mean 16.2
Rendered fps, last 120 s median 15.7
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. Hardware ray tracing was not on in this 8 GB profile, so the bounded meshlet index cache was not exercised: this run shows the default path is unharmed, nothing more. Earlier runs on heads dd1c4d2e7 and 83c2a9279 do not cover this head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371099239 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7371099239). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T07:31:26Z. --- RUN (in game, one pull request), its head merged with `git merge --no-ff` onto main `d9b618f10`: #3297 `583860881`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.3, mean 16.2 | | Rendered fps, last 120 s | median 15.7 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. Hardware ray tracing was not on in this 8 GB profile, so the bounded meshlet index cache was not exercised: this run shows the default path is unharmed, nothing more. Earlier runs on heads `dd1c4d2e7` and `83c2a9279` do not cover this head. AI-assisted (Claude Code).
lixonik commented 2026-12-03 07:33:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T07:33:02Z.


RUN (in game, RTX 5070 12 GB, Hardware RT, 315 s in-world gate) -- PASS on updated head 583860881 (merged cleanly via git merge --no-ff onto main d9b618f10).

Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79)

  • python -I scripts/check_no_game_data.py -> PASS
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md -> PASS
  • LEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --features diagnostics --lib --locked hwrt -> 29 passed, 0 failed
  • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -> PASS

Live In-Game Gate (-SeriesS -NoFrameGen, Hardware RT: LEONIDA_HW_RT=1, LEONIDA_AMBIENT=0, LEONIDA_RT_RESOLVE=1, LEONIDA_ACTIVATE_RAYS=1, default 256 MB meshlet cache cap)

  • Duration: 315 s in world (452.6 s total, 65 world samples >= 1000 draws, max 5,150 draws)
  • Errors / Device Lost / Crashes: 0 / 0 / 0
  • Rendered FPS (d3d12_run_fps.py): median 25.1 fps (39.8 ms; slowest tenth 17.3 fps, fastest tenth 26.1 fps; 3000-4999 draws median 25.2 fps across 59 samples)

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371131413 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7371131413). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T07:33:02Z. --- **RUN (in game, RTX 5070 12 GB, Hardware RT, 315 s in-world gate) -- PASS** on updated head `583860881` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79) - `python -I scripts/check_no_game_data.py` -> **PASS** - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` -> **PASS** - `LEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --features diagnostics --lib --locked hwrt` -> **29 passed, 0 failed** - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -> **PASS** ### Live In-Game Gate (`-SeriesS -NoFrameGen`, Hardware RT: `LEONIDA_HW_RT=1`, `LEONIDA_AMBIENT=0`, `LEONIDA_RT_RESOLVE=1`, `LEONIDA_ACTIVATE_RAYS=1`, default 256 MB meshlet cache cap) - **Duration:** `315 s` in world (`452.6 s` total, `65` world samples `>= 1000` draws, max `5,150` draws) - **Errors / Device Lost / Crashes:** **`0` / `0` / `0`** - **Rendered FPS (`d3d12_run_fps.py`):** median **`25.1 fps`** (`39.8 ms`; slowest tenth `17.3 fps`, fastest tenth `26.1 fps`; `3000-4999` draws median `25.2 fps` across `59` samples) AI-assisted: yes (Antigravity -- Gemini 4 Neon).
rockcabbage commented 2026-12-03 13:22:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by rockcabbage on 2026-12-03T13:22:53Z.


Measurements for the recorded transforms (LEONIDA_HW_RT_TX_COPY), from an independent look at the same defect: this is the cause of surfaces going black in shade with -HardwareRT, and I think it should be on by default, at least for rehydrations.

Caveat first: the numbers are from my own local change of the same idea (the 48 bytes of Transform3x4 read in read_geometries at the title's call, used when a rehydration is built), not from this PR's head with the switch on. I have not run e31ec65b6.

What I measured on main's behaviour (late read), RTX 4090, i9-13900K, Windows 11, Series X profile:

  • Rehydrations wait behind the BLAS budget: in one start about 9 % of the rehydrated structures were built in the frame of the call, the rest 1 to 4 frames later.
  • Over 11 captured frames in 11 starts (1.76 M first-bounce GI hits): 21-54 % of hits per frame (39 % pooled) landed on instances of rehydrated structures that carry a transform. For those hits, 0.0-0.8 % lay on the object's own mesh (controls: 98-100 %); the triangles traversed were up to 827 m across and mostly not planar. The vertex and index bytes decode to the right mesh on the CPU; only the matrix is wrong.
  • The GI then shades a triangle the ray never touched: sunlit hit points returning zero radiance were 8-41 % per frame (18 % pooled over 8 starts).
  • The affected structures are the same on every start, and only rehydrations whose geometry has a transform. Rehydrations without one are fine.

With the matrix taken at the call (1 captured frame):

  • Of 3,780 geometries with a transform, 2,838 had different bytes at the transform's address by capture time (zeros or denormals): the memory is reused within frames.
  • Hits on those instances within 2 cm of their own mesh: 99.3 % (controls 98.3 %); inside the instance's own box 99.9 %. No oversized triangle groups left.
  • Sunlit hit points returning zero radiance: 4.6 %.
  • The title's own per-instance rotation equals the top-level instance transform times the recorded matrix for 722 of 725 such instances, so the matrix at the call is the one the title means.
  • In the picture: a deck and the character on it that drew as a black silhouette are lit, and shade under a raised building is no longer near-black.

Two differences from this PR's switch that may be worth taking:

  • I use the call-time matrix for every rehydration, not only when frame::current() != asked. A rehydration has no card-side copy that is refreshed later, so there is nothing to gain from the late read.
  • A rehydration whose matrix was unreadable at the call is given inactive (with a warning) instead of being built with no transform.

I had this ready as its own PR and stopped when I found this one; I'd rather it land here. If it helps I can run this head with LEONIDA_HW_RT_TX_COPY=1 against 0 on the 4090 and post the same counts, or open a small follow-up after merge that makes it the default for rehydrations.

AI-assisted: yes (Claude Code; Claude Fable 5.2 directing, Claude Opus 5.5 agents for the analysis and the local change).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7379727775 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7379727775). Originally posted by [rockcabbage](https://github.com/rockcabbage) on 2026-12-03T13:22:53Z. --- Measurements for the recorded transforms (`LEONIDA_HW_RT_TX_COPY`), from an independent look at the same defect: this is the cause of surfaces going black in shade with `-HardwareRT`, and I think it should be on by default, at least for rehydrations. **Caveat first:** the numbers are from my own local change of the same idea (the 48 bytes of `Transform3x4` read in `read_geometries` at the title's call, used when a rehydration is built), not from this PR's head with the switch on. I have not run `e31ec65b6`. **What I measured on `main`'s behaviour (late read), RTX 4090, i9-13900K, Windows 11, Series X profile:** - Rehydrations wait behind the BLAS budget: in one start about 9 % of the rehydrated structures were built in the frame of the call, the rest 1 to 4 frames later. - Over 11 captured frames in 11 starts (1.76 M first-bounce GI hits): 21-54 % of hits per frame (39 % pooled) landed on instances of rehydrated structures that carry a transform. For those hits, 0.0-0.8 % lay on the object's own mesh (controls: 98-100 %); the triangles traversed were up to 827 m across and mostly not planar. The vertex and index bytes decode to the right mesh on the CPU; only the matrix is wrong. - The GI then shades a triangle the ray never touched: sunlit hit points returning zero radiance were 8-41 % per frame (18 % pooled over 8 starts). - The affected structures are the same on every start, and only rehydrations whose geometry has a transform. Rehydrations without one are fine. **With the matrix taken at the call (1 captured frame):** - Of 3,780 geometries with a transform, 2,838 had different bytes at the transform's address by capture time (zeros or denormals): the memory is reused within frames. - Hits on those instances within 2 cm of their own mesh: 99.3 % (controls 98.3 %); inside the instance's own box 99.9 %. No oversized triangle groups left. - Sunlit hit points returning zero radiance: 4.6 %. - The title's own per-instance rotation equals the top-level instance transform times the recorded matrix for 722 of 725 such instances, so the matrix at the call is the one the title means. - In the picture: a deck and the character on it that drew as a black silhouette are lit, and shade under a raised building is no longer near-black. **Two differences from this PR's switch that may be worth taking:** - I use the call-time matrix for every rehydration, not only when `frame::current() != asked`. A rehydration has no card-side copy that is refreshed later, so there is nothing to gain from the late read. - A rehydration whose matrix was unreadable at the call is given inactive (with a warning) instead of being built with no transform. I had this ready as its own PR and stopped when I found this one; I'd rather it land here. If it helps I can run this head with `LEONIDA_HW_RT_TX_COPY=1` against `0` on the 4090 and post the same counts, or open a small follow-up after merge that makes it the default for rehydrations. AI-assisted: yes (Claude Code; Claude Fable 5.2 directing, Claude Opus 5.5 agents for the analysis and the local change).
merzleckeier commented 2026-12-03 13:36:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T13:36:36Z.


Following up on the recorded-transform measurements, I checked the actual read_geometries → prepare_triangles path at e31ec65b merged onto b053a181. The synthetic fixture records a matrix with X translation 10, rewrites the same live buffer to translation 40, and checks all 48 bytes and the aligned offset passed to BLAS preparation.

LEONIDA_HW_RT_TX_COPY Prepared in the recording frame Prepared one frame later
0 40 40
1 40 10

Every cell matched for both ordinary builds and rehydrations on AMD Raphael/RADV and RTX 4070 SUPER under Wine 11.22 / VKD3D-Proton 3.1.0. All 29 existing HWRT unit tests also passed. This confirms that same-frame rehydration still takes the live matrix even when the recorded bytes are present. The synthetic test stops at the prepared descriptor and staging buffer. It leaves the visual effect and frequency on this PR head to an in-game comparison.

AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380084482 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7380084482). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T13:36:36Z. --- Following up on the [recorded-transform measurements](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7379727775), I checked the actual `read_geometries` → `prepare_triangles` path at `e31ec65b` merged onto `b053a181`. The synthetic fixture records a matrix with X translation 10, rewrites the same live buffer to translation 40, and checks all 48 bytes and the aligned offset passed to BLAS preparation. | `LEONIDA_HW_RT_TX_COPY` | Prepared in the recording frame | Prepared one frame later | | --- | ---: | ---: | | `0` | 40 | 40 | | `1` | 40 | 10 | Every cell matched for both ordinary builds and rehydrations on AMD Raphael/RADV and RTX 4070 SUPER under Wine 11.22 / VKD3D-Proton 3.1.0. All 29 existing HWRT unit tests also passed. This confirms that same-frame rehydration still takes the live matrix even when the recorded bytes are present. The synthetic test stops at the prepared descriptor and staging buffer. It leaves the visual effect and frequency on this PR head to an in-game comparison. AI-assisted (Codex).
OreoFR commented 2026-12-03 13:52:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T13:52:52Z.


Thanks @rockcabbage, that is a much better case than the deferred-build one this PR started from, and the counts make it clear. Taken in fb5ca8a604 (credited in the commit message).

  • Rehydrations always use the call-time matrix. read_geometries now captures the transform of every rehydration (rehydrate_batched2), whatever LEONIDA_HW_RT_TX_COPY says, and the build uses it even in the frame it was asked in. As you said, a rehydration has no card-side copy refreshed later, so the late read has nothing to offer.
  • Unreadable at the call: that geometry is given inactive (it keeps its GeometryIndex), with a warning at powers of two, instead of being built from the late bytes or with no transform.
  • Other builds are unchanged: LEONIDA_HW_RT_TX_COPY still decides for them, deferred builds only, off by default. I kept that split because those builds can still be refreshed from the shadow copy, and the switch has no measurement on that path yet; making it the default there would be a separate change.
  • The decision is a pure transform_source, with two new tests: a rehydration takes the recorded matrix in the same frame with the switch off, a missing one gives inactive; other builds take it only deferred with the switch on, and are never made inactive. On the previous head a same-frame rehydration read the title's memory instead, which is what the first test pins.

Tested:

  • cargo test -p leonida-gpu --lib: 725 passed, 0 failed; clippy shows nothing in hwrt.rs; check_no_game_data clean; switches.md regenerated (no change).
  • In game, RTX 4070 Laptop 8 GB, head merged onto current main, -SeriesS -HardwareRT -Resolution 1080 -NoDlss -NoFrameGen, LEONIDA_HW_RT_TX_COPY unset, 120 s in the world: no device loss, no panic; about 3,200 rehydrated structures, at least 2,048 geometries built from the recorded transform, 0 given inactive. I did not take image captures, so I cannot yet say from my side that the shade is fixed.

Yes please to your offer: the same counts on the 4090 with this head (no switch needed now for rehydrations) would be the proof that matters here.

AI-assisted (oreofr-agent, Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380536395 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7380536395). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T13:52:52Z. --- Thanks @rockcabbage, that is a much better case than the deferred-build one this PR started from, and the counts make it clear. Taken in fb5ca8a604ad2355eaa9003ac8f24e329d347836 (credited in the commit message). - **Rehydrations always use the call-time matrix.** `read_geometries` now captures the transform of every rehydration (`rehydrate_batched2`), whatever `LEONIDA_HW_RT_TX_COPY` says, and the build uses it even in the frame it was asked in. As you said, a rehydration has no card-side copy refreshed later, so the late read has nothing to offer. - **Unreadable at the call:** that geometry is given inactive (it keeps its `GeometryIndex`), with a warning at powers of two, instead of being built from the late bytes or with no transform. - **Other builds are unchanged:** `LEONIDA_HW_RT_TX_COPY` still decides for them, deferred builds only, off by default. I kept that split because those builds can still be refreshed from the shadow copy, and the switch has no measurement on that path yet; making it the default there would be a separate change. - The decision is a pure `transform_source`, with two new tests: a rehydration takes the recorded matrix in the same frame with the switch off, a missing one gives inactive; other builds take it only deferred with the switch on, and are never made inactive. On the previous head a same-frame rehydration read the title's memory instead, which is what the first test pins. Tested: - `cargo test -p leonida-gpu --lib`: 725 passed, 0 failed; clippy shows nothing in `hwrt.rs`; `check_no_game_data` clean; `switches.md` regenerated (no change). - In game, RTX 4070 Laptop 8 GB, head merged onto current main, `-SeriesS -HardwareRT -Resolution 1080 -NoDlss -NoFrameGen`, `LEONIDA_HW_RT_TX_COPY` unset, 120 s in the world: no device loss, no panic; about 3,200 rehydrated structures, at least 2,048 geometries built from the recorded transform, 0 given inactive. I did not take image captures, so I cannot yet say from my side that the shade is fixed. Yes please to your offer: the same counts on the 4090 with this head (no switch needed now for rehydrations) would be the proof that matters here. AI-assisted (oreofr-agent, Claude Code).
merzleckeier commented 2026-12-03 14:03:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:03:18Z.


Rechecked fb5ca8a6 on merge tree e72b4e8a with synthetic geometry on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (NVIDIA 620.73.04), using Wine 11.22 / VKD3D-Proton 3.1.0.

  • After rewriting the source matrix from X=10 to X=40, the rehydration path staged all 48 original matrix bytes, in the same frame and a later frame, with LEONIDA_HW_RT_TX_COPY at both 0 and 1. The ordinary build still staged X=40 in the same frame and used X=10 only for a deferred build with the switch on.
  • With three geometries, the middle transform was unreadable at recording and readable by build time. The submitted BLAS kept all three geometry indices, with the middle geometry inactive, and completed on both GPUs with either switch setting.

All eight focused runs and 31 existing HWRT unit tests passed. This covers the D3D12 paths with synthetic inputs. Image quality is outside these runs. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380815102 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7380815102). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T14:03:18Z. --- Rechecked `fb5ca8a6` on merge tree `e72b4e8a` with synthetic geometry on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (NVIDIA 620.73.04), using Wine 11.22 / VKD3D-Proton 3.1.0. - After rewriting the source matrix from X=10 to X=40, the rehydration path staged all 48 original matrix bytes, in the same frame and a later frame, with `LEONIDA_HW_RT_TX_COPY` at both 0 and 1. The ordinary build still staged X=40 in the same frame and used X=10 only for a deferred build with the switch on. - With three geometries, the middle transform was unreadable at recording and readable by build time. The submitted BLAS kept all three geometry indices, with the middle geometry inactive, and completed on both GPUs with either switch setting. All eight focused runs and 31 existing HWRT unit tests passed. This covers the D3D12 paths with synthetic inputs. Image quality is outside these runs. AI-assisted (Codex).
MoonEyes commented 2026-12-03 15:30:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T15:30:13Z.


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3290, #3291, #3293, #3296 and #3297 merged into main b053a1813; this PR tested at its current head fb5ca8a60. Series S 1080, DLSS FG 2x, play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, no extra switch set.

  • Result: PASS. No device lost, no crash, no unhandled exception; the run ended on its time limit.
  • Median over the last 240 s: 15.8 fps (main alone today: 16-17.5); 19.2 frames per 1000 over 100 ms.
  • Covered: the default path with this PR's code in the build. Since the PR's new behaviour is opt-in, this run shows it does not harm the default; it does not test the switch itself (for #3290 the switch has its own A B B A run, posted above).

AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7383254651 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3297#issuecomment-7383254651). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T15:30:13Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3290, #3291, #3293, #3296 and #3297 merged into main `b053a1813`; this PR tested at its current head `fb5ca8a60`. Series S 1080, DLSS FG 2x, `play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed`, scripted walk, 330 s, no extra switch set. - Result: **PASS**. No device lost, no crash, no unhandled exception; the run ended on its time limit. - Median over the last 240 s: 15.8 fps (main alone today: 16-17.5); 19.2 frames per 1000 over 100 ms. - Covered: the default path with this PR's code in the build. Since the PR's new behaviour is opt-in, this run shows it does not harm the default; it does not test the switch itself (for #3290 the switch has its own A B B A run, posted above). AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
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/3297:upstream-pr/3297'
git switch 'upstream-pr/3297'

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