d3d12: give mesh pipelines the resource index map #390

Open
MathiewMay wants to merge 1 commit from upstream-pr/390 into main
MathiewMay commented 2026-11-28 09:20:18 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by MathiewMay on 2026-11-28T09:20:18Z.


Draft: this can expose a GPU hang in ProjectScarlett that I have not solved. With this change the game runs its terrain mesh draws, which main skips. In three of my runs, all with #386, the GPU then hung on the same draw: the first draw of the terrain pass whose packed root constant is non-zero (0xb8…), mesh program MS_VS_TransformTerrainNormalTint, one group. RADV reported no memory fault, only a hard recovery. Two other runs, of 30 and 7 minutes, did not hit it. I am tracing that draw's inputs and will update this.

Summary

Under descriptor paging, a mesh pipeline whose root indexes the resource heap directly (CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED) got no index map: mesh_table::reflected set index_map: None. Its draws were then skipped as having no paged descriptor layout. In ProjectScarlett every run that reached the first cinematic skipped such work from there on, up to #2048 logged per run.

  • mesh_table::reflected appends the map's root SRV (t0, space32766, all stages) when the root indexes the heap directly and the map's two DWORDs still fit after the pixel stage's mirrored tables (RootSig::heap_index_map_fits, the same 62-DWORD rule compute_table applies to compute and raster roots).
  • Each stage is then translated on its declared root with the map appended (rootsig::append_heap_index_map, rootsig::with_index_map, shader_cache::mesh_stage, mesh_pixel_request, mesh_link_source). The request is derived from the one on the declared root rather than rebuilt: other parts keep their bytes and directory order, and only the root changes. So the requests a launch recorded can be prepared offline byte for byte.
  • A pixel stage that has no translation on its root keeps its root-less one, as without the map, so its heap reads use guest indices; stream.rs logs it. A failed pipeline would end ProjectScarlett instead.

Merge #386 first. In game, ProjectScarlett's first mapped mesh draws faulted the GPU at their root SRV plus 0xFFFFEF70 (runs C6j and C6m). That was the masked-lane raw load #386 fixes: the draws this change stops skipping run into it.

In game I tested this on an older main together with other fixes of mine, #386 among them, not on this branch alone. One run translated 5,904 mesh and 6,176 pixel programs with the map appended (compiled live, as new requests), and with all my fixes a 30-minute run had no fault.

Tested

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: NVIDIA still needs to run them.

No GPU test of the new path. Lanes has console compute and vertex programs that index the heap directly (compute-heap-stride, raster-heap-stride), but no console mesh or pixel program in a mesh pipeline that does, and I have not written one. The rewriting of roots and requests is covered by three unit tests in runtime/dxbc/src/tests/rootsig.rs:

  • appended_heap_map_keeps_guest_bindings_and_sampler_words: version 1.0 and 1.1 roots keep their parameters, samplers and flags, and gain the map as the last parameter.
  • heap_map_budget_includes_pixel_mirrors_and_every_parameter_kind.
  • index_map_requests_replace_only_the_root_and_keep_the_directory_order.

The GPU suites below include every mesh gate (d3d12-mesh, lanes-selftest-mesh-signature, lanes-mesh-samplers, lanes-mesh-sampler-single, lanes-mesh-sampler-rootless), which check that mesh pipelines without such a root are unchanged.

GPU, driver and backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, Linux 7.3, GE-Proton11-14 (--backend proton).

Commands run and their results:

cargo test --locked --target x86_64-unknown-linux-gnu -p tuxbox-dxbc
  29 passed, the three new tests among them

python tuxbox.py verify --only guest-frame --only present --only lanes --only lanes-selftest
    --only lanes-shader-cache --only lanes-raster-tables --only lanes-compute-root
    --only lanes-compute-root-recovery --only lanes-compute-root-srv --only lanes-large-dispatch
    --only lanes-late-pipeline --only lanes-bindless-compute --only lanes-compute-heap-stride
    --only d3d12-exports --only d3d12-features --only d3d12-indirect --only d3d12-queries
    --only d3d12-queues --only d3d12-tables --only d3d12-heaps --only d3d12-placement
    --only d3d12-copy-resource --only d3d12-draw --only d3d12-stream --only d3d12-frame-events
    --only d3d12-guids --only d3d12-signatures --only d3d12-mesh --backend proton --adapter 1002:7550
  78 PASS, 0 FAIL

D3D12 regression controls, all 20 cases
  20 PASS, 0 FAIL

cargo xwin test --no-run --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --lib, the test executable run under Proton
  224 passed, 0 failed

python tuxbox.py check --no-gpu
  passed   Build the shader compiler, Python tests, Shader compiler tests, DXBC tests,
           XG layout tests, Storage codec tests, D3D12 Windows typecheck

The D3D12 controls ran with the tool's own case table, staging and validate, but outside its Bubblewrap/xvfb-run sandbox, which stalls on this machine (it has no Xvfb).

Checks

No evidence JSON changes.

<!-- greyfinch-sync:brcly/TuxBox:issue:5538675479 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390). Originally posted by [MathiewMay](https://github.com/MathiewMay) on 2026-11-28T09:20:18Z. --- **Draft: this can expose a GPU hang in ProjectScarlett that I have not solved.** With this change the game runs its terrain mesh draws, which `main` skips. In three of my runs, all with #386, the GPU then hung on the same draw: the first draw of the terrain pass whose packed root constant is non-zero (`0xb8…`), mesh program `MS_VS_TransformTerrainNormalTint`, one group. RADV reported no memory fault, only a hard recovery. Two other runs, of 30 and 7 minutes, did not hit it. I am tracing that draw's inputs and will update this. ## Summary Under descriptor paging, a mesh pipeline whose root indexes the resource heap directly (`CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED`) got no index map: `mesh_table::reflected` set `index_map: None`. Its draws were then skipped as having no paged descriptor layout. In ProjectScarlett every run that reached the first cinematic skipped such work from there on, up to #2048 logged per run. - `mesh_table::reflected` appends the map's root SRV (`t0, space32766`, all stages) when the root indexes the heap directly and the map's two DWORDs still fit after the pixel stage's mirrored tables (`RootSig::heap_index_map_fits`, the same 62-DWORD rule `compute_table` applies to compute and raster roots). - Each stage is then translated on its declared root with the map appended (`rootsig::append_heap_index_map`, `rootsig::with_index_map`, `shader_cache::mesh_stage`, `mesh_pixel_request`, `mesh_link_source`). The request is derived from the one on the declared root rather than rebuilt: other parts keep their bytes and directory order, and only the root changes. So the requests a launch recorded can be prepared offline byte for byte. - A pixel stage that has no translation on its root keeps its root-less one, as without the map, so its heap reads use guest indices; `stream.rs` logs it. A failed pipeline would end ProjectScarlett instead. **Merge #386 first.** In game, ProjectScarlett's first mapped mesh draws faulted the GPU at their root SRV plus `0xFFFFEF70` (runs C6j and C6m). That was the masked-lane raw load #386 fixes: the draws this change stops skipping run into it. In game I tested this on an older `main` together with other fixes of mine, #386 among them, not on this branch alone. One run translated 5,904 mesh and 6,176 pixel programs with the map appended (compiled live, as new requests), and with all my fixes a 30-minute run had no fault. ## Tested - [x] The checks relevant to this change passed - [ ] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below - [ ] Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: **NVIDIA still needs to run them.** **No GPU test of the new path.** Lanes has console compute and vertex programs that index the heap directly (`compute-heap-stride`, `raster-heap-stride`), but no console mesh or pixel program in a mesh pipeline that does, and I have not written one. The rewriting of roots and requests is covered by three unit tests in `runtime/dxbc/src/tests/rootsig.rs`: - `appended_heap_map_keeps_guest_bindings_and_sampler_words`: version 1.0 and 1.1 roots keep their parameters, samplers and flags, and gain the map as the last parameter. - `heap_map_budget_includes_pixel_mirrors_and_every_parameter_kind`. - `index_map_requests_replace_only_the_root_and_keep_the_directory_order`. The GPU suites below include every mesh gate (`d3d12-mesh`, `lanes-selftest-mesh-signature`, `lanes-mesh-samplers`, `lanes-mesh-sampler-single`, `lanes-mesh-sampler-rootless`), which check that mesh pipelines without such a root are unchanged. GPU, driver and backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, Linux 7.3, GE-Proton11-14 (`--backend proton`). Commands run and their results: ```text cargo test --locked --target x86_64-unknown-linux-gnu -p tuxbox-dxbc 29 passed, the three new tests among them python tuxbox.py verify --only guest-frame --only present --only lanes --only lanes-selftest --only lanes-shader-cache --only lanes-raster-tables --only lanes-compute-root --only lanes-compute-root-recovery --only lanes-compute-root-srv --only lanes-large-dispatch --only lanes-late-pipeline --only lanes-bindless-compute --only lanes-compute-heap-stride --only d3d12-exports --only d3d12-features --only d3d12-indirect --only d3d12-queries --only d3d12-queues --only d3d12-tables --only d3d12-heaps --only d3d12-placement --only d3d12-copy-resource --only d3d12-draw --only d3d12-stream --only d3d12-frame-events --only d3d12-guids --only d3d12-signatures --only d3d12-mesh --backend proton --adapter 1002:7550 78 PASS, 0 FAIL D3D12 regression controls, all 20 cases 20 PASS, 0 FAIL cargo xwin test --no-run --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --lib, the test executable run under Proton 224 passed, 0 failed python tuxbox.py check --no-gpu passed Build the shader compiler, Python tests, Shader compiler tests, DXBC tests, XG layout tests, Storage codec tests, D3D12 Windows typecheck ``` The D3D12 controls ran with the tool's own case table, staging and `validate`, but outside its Bubblewrap/`xvfb-run` sandbox, which stalls on this machine (it has no Xvfb). ## Checks No evidence JSON changes.
Kayotic1337 commented 2026-11-29 23:33:41 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-29T23:33:41Z.


I can test this on an RX 9070 XT (1002:7550, RDNA 4, RADV / Mesa 26.3.1, GE-Proton11-14) once it's rebased, including whether the MS_VS_TransformTerrainNormalTint hang reproduces on RDNA 4.

A trial merge onto current main (f360038d) conflicts in mesh_table.rs and stream.rs. Since this branch, main appends the pixel stage's heap write bitmap parameter to mesh roots and to the pixel root. That parameter competes with the index map for the 64-DWORD root budget. A pixel stage translated on the declared root with only the map appended would also not write that bitmap. I didn't try to resolve it myself.

<!-- greyfinch-sync:brcly/TuxBox:comment:7264553300 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7264553300). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-29T23:33:41Z. --- I can test this on an RX 9070 XT (`1002:7550`, RDNA 4, RADV / Mesa 26.3.1, GE-Proton11-14) once it's rebased, including whether the `MS_VS_TransformTerrainNormalTint` hang reproduces on RDNA 4. A trial merge onto current `main` (`f360038d`) conflicts in `mesh_table.rs` and `stream.rs`. Since this branch, `main` appends the pixel stage's heap write bitmap parameter to mesh roots and to the pixel root. That parameter competes with the index map for the 64-DWORD root budget. A pixel stage translated on the declared root with only the map appended would also not write that bitmap. I didn't try to resolve it myself.
NickStallman commented 2026-11-30 00:02:23 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T00:02:23Z.


@MathiewMay @Kayotic1337 we've been carrying a resolved copy of this in our game builds; here it is as a clean branch, in case it saves you the rebase: d3d12/mesh-index-map-bitmap on f482572a (de1a16f0). @MathiewMay it keeps your commit and authorship, with a paragraph added to the message; please take what you want, I'm not opening a PR for it.

On the heap write bitmap, which it keeps:

  • Roots: the mesh root is guest parameters, mirrors, map, then bitmap, each when it fits. The pixel root decides the bitmap on the same condition, so the two can't disagree.
  • Pixel request: translated on the root that holds the bitmap, with the map appended (the second attempt, with recovered samplers, too), so it names the slots it stores through.
  • Short budget: the map has priority. Without the bitmap the whole heap counts as written, so nothing is missed. It doesn't occur in what we have recorded (largest mapped root 12 of 64).
  • Recorded requests: 119 distinct pixel programs have untraced image stores. All 119 have a recorded request with bitmap and map and translate with the bitmap write. No recorded mesh program writes an image.

check --no-gpu passes; the two added tests are guards that I haven't shown failing. No GPU check has run on this branch. Our game builds with the same code ran on an RTX 5090 (620.70.10): the hang in the description isn't something I can rule out, and 75c was lost in mesh draws after 501 s (cause unknown, #520).

<!-- greyfinch-sync:brcly/TuxBox:comment:7264917005 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7264917005). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T00:02:23Z. --- @MathiewMay @Kayotic1337 we've been carrying a resolved copy of this in our game builds; here it is as a clean branch, in case it saves you the rebase: [`d3d12/mesh-index-map-bitmap`](https://github.com/NickStallman/TuxBox/tree/d3d12/mesh-index-map-bitmap) on f482572a (de1a16f0). @MathiewMay it keeps your commit and authorship, with a paragraph added to the message; please take what you want, I'm not opening a PR for it. On the heap write bitmap, which it keeps: - **Roots:** the mesh root is guest parameters, mirrors, map, then bitmap, each when it fits. The pixel root decides the bitmap on the same condition, so the two can't disagree. - **Pixel request:** translated on the root that holds the bitmap, with the map appended (the second attempt, with recovered samplers, too), so it names the slots it stores through. - **Short budget:** the map has priority. Without the bitmap the whole heap counts as written, so nothing is missed. It doesn't occur in what we have recorded (largest mapped root 12 of 64). - **Recorded requests:** 119 distinct pixel programs have untraced image stores. All 119 have a recorded request with bitmap and map and translate with the bitmap write. No recorded mesh program writes an image. `check --no-gpu` passes; the two added tests are guards that I haven't shown failing. **No GPU check has run on this branch.** Our game builds with the same code ran on an RTX 5090 (620.70.10): the hang in the description isn't something I can rule out, and 75c was lost in mesh draws after 501 s (cause unknown, #520).
Kayotic1337 commented 2026-11-30 01:39:09 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T01:39:09Z.


@NickStallman thanks for the resolved branch. Results for d3d12/mesh-index-map-bitmap (de1a16f0) on an RX 9070 XT (1002:7550, RDNA 4, RADV / Mesa 26.3.1, GE-Proton11-14, Linux 7.3.6):

Full check: tuxbox.py check --adapter 1002:7550 --proton GE-Proton11-14 --prefix … --windows-dxc <DXC 1.9.2609 x64> gives 14 passed, 0 failed, 0 not run. That includes the D3D12 regression controls, the shader translator on the GPU and lanes-selftest-mesh-signature. In an earlier run without --proton there was one failure in guest-present-4k-splash. It passed on a rerun of the present suite and in the full check, so I count it as flaky. The branch doesn't touch present.

Game: three runs of de1a16f0 + #557 (needed to get past Game Init since #527), TUXBOX_XMEM_PRIVATE_VIEWS=1. None of them had a MS_VS_TransformTerrainNormalTint hang or a device loss in mesh draws, and Xbox mesh pipelines are created and used. All three end around the first cutscene, each with a different crash:

Run Reached Ended on Seen without this branch?
1 (1394 s, partly cold) int_chase, frame 1743, half-rendered cutscene frames CPU access violation in the title, game_scarlett_master.exe + 0x469517 no
2 (269 s, warm) int_prolo, frame 1814, nothing on screen compute TCP write permission fault 0x741041 yes, on main
3 (235 s, warm) int_prolo, frame 1712, half-rendered cutscene frames CPU access violation, +0x32E8313 yes, on main

So on RDNA 4 nothing gets worse with this branch, as far as I can see. Only +0x469517 is new, and it happened once in three runs, so I'm not attributing it to this branch.

<!-- greyfinch-sync:brcly/TuxBox:comment:7266323830 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7266323830). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-30T01:39:09Z. --- @NickStallman thanks for the resolved branch. Results for `d3d12/mesh-index-map-bitmap` (`de1a16f0`) on an RX 9070 XT (`1002:7550`, RDNA 4, RADV / Mesa 26.3.1, GE-Proton11-14, Linux 7.3.6): **Full check:** `tuxbox.py check --adapter 1002:7550 --proton GE-Proton11-14 --prefix … --windows-dxc <DXC 1.9.2609 x64>` gives **14 passed, 0 failed, 0 not run**. That includes the D3D12 regression controls, the shader translator on the GPU and `lanes-selftest-mesh-signature`. In an earlier run without `--proton` there was one failure in `guest-present-4k-splash`. It passed on a rerun of the present suite and in the full check, so I count it as flaky. The branch doesn't touch present. **Game:** three runs of `de1a16f0` + #557 (needed to get past `Game Init` since #527), `TUXBOX_XMEM_PRIVATE_VIEWS=1`. None of them had a `MS_VS_TransformTerrainNormalTint` hang or a device loss in mesh draws, and Xbox mesh pipelines are created and used. All three end around the first cutscene, each with a different crash: | Run | Reached | Ended on | Seen without this branch? | | --- | --- | --- | --- | | 1 (1394 s, partly cold) | `int_chase`, frame 1743, half-rendered cutscene frames | CPU access violation in the title, `game_scarlett_master.exe + 0x469517` | no | | 2 (269 s, warm) | `int_prolo`, frame 1814, nothing on screen | compute TCP write permission fault `0x741041` | yes, on `main` | | 3 (235 s, warm) | `int_prolo`, frame 1712, half-rendered cutscene frames | CPU access violation, `+0x32E8313` | yes, on `main` | So on RDNA 4 nothing gets worse with this branch, as far as I can see. Only `+0x469517` is new, and it happened once in three runs, so I'm not attributing it to this branch.
brcly commented 2026-11-30 04:12:28 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:28Z.


Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase.

  • Formatting: the whole workspace is now formatted with rustfmt (see the new rustfmt.toml).
  • Lints: every crate denies unwrap(), lossy as casts and undocumented unsafe outside tests.
  • CI: it now also runs cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.

The least painful way is to format your branch first, so the rebase only shows real changes:

git fetch origin
git checkout origin/main -- rustfmt.toml
cargo fmt --all && git commit -am "rustfmt"
git rebase origin/main

Then run python tuxbox.py check --no-gpu, which now includes the format step.

If clippy flags something new:

  • A cast: use From for widening, TryFrom for narrowing, and a mask for bit fields.
  • An unwrap(): use ?, or expect with the reason it can't fail.
  • An unsafe block: it needs a // SAFETY: comment.

CONTRIBUTING's "Code checks" section lists the commands. Thanks!

<!-- greyfinch-sync:brcly/TuxBox:comment:7268564698 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7268564698). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:28Z. --- Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase. - **Formatting:** the whole workspace is now formatted with rustfmt (see the new `rustfmt.toml`). - **Lints:** every crate denies `unwrap()`, lossy `as` casts and undocumented `unsafe` outside tests. - **CI:** it now also runs `cargo fmt --check`, rustdoc with warnings denied, and Miri on the providers' unit tests. The least painful way is to format your branch first, so the rebase only shows real changes: ```sh git fetch origin git checkout origin/main -- rustfmt.toml cargo fmt --all && git commit -am "rustfmt" git rebase origin/main ``` Then run `python tuxbox.py check --no-gpu`, which now includes the format step. If clippy flags something new: - **A cast:** use `From` for widening, `TryFrom` for narrowing, and a mask for bit fields. - **An `unwrap()`:** use `?`, or `expect` with the reason it can't fail. - **An `unsafe` block:** it needs a `// SAFETY:` comment. CONTRIBUTING's "Code checks" section lists the commands. Thanks!
NickStallman commented 2026-11-30 05:35:10 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T05:35:10Z.


@MathiewMay @Kayotic1337 two things on this, from looking into a GPU loss (#232/#472).

1. It fixes a real gap on main that isn't "skipped draws". Measured: on e5d2e913, a mesh pipeline whose table is reflected and whose root indexes the heap directly gets no index map (mesh_table::reflected: layout.direct_resources true, index_map None); a test of that fails there and passes on this change. By reading: such a draw is neither skipped nor mapped (Recording::draw sends any reflected table to with_reflected_table before paged_layout_gap is reached), so its shaders use guest heap indices as they are. I haven't run one on a GPU. Draws whose pipeline has no reflected table are the ones that are skipped, and the commit message's "draws were skipped" is true only for those; this change doesn't touch them. "Without the map the draw is skipped" isn't so for a reflected table whose root has no room either.

2. Rebased onto main's reformat (your authorship kept): d3d12/mesh-index-map-bitmap is now f172e332 on e5d2e913: your commit, two tests of ours, and the test above. fmt, clippy -D warnings, rustdoc, check --no-gpu and 23 of its unit tests pass; the new test ran on lavapipe only. No GPU check on it. The rest of my earlier notes about it still stand. @MathiewMay please take what you want from it.

One overlap: until #563 is in, an untraced pixel stage with the bitmap no longer counts its own table views as written once a mesh table has the map.

<!-- greyfinch-sync:brcly/TuxBox:comment:7269807808 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7269807808). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T05:35:10Z. --- @MathiewMay @Kayotic1337 two things on this, from looking into a GPU loss (#232/#472). **1. It fixes a real gap on main that isn't "skipped draws".** Measured: on `e5d2e913`, a mesh pipeline whose table is *reflected* and whose root indexes the heap directly gets no index map (`mesh_table::reflected`: `layout.direct_resources` true, `index_map` None); a test of that fails there and passes on this change. By reading: such a draw is neither skipped nor mapped (`Recording::draw` sends any reflected table to `with_reflected_table` before `paged_layout_gap` is reached), so its shaders use guest heap indices as they are. I haven't run one on a GPU. Draws whose pipeline has **no** reflected table are the ones that are skipped, and the commit message's "draws were skipped" is true only for those; this change doesn't touch them. "Without the map the draw is skipped" isn't so for a reflected table whose root has no room either. **2. Rebased onto main's reformat** (your authorship kept): [`d3d12/mesh-index-map-bitmap`](https://github.com/NickStallman/TuxBox/tree/d3d12/mesh-index-map-bitmap) is now f172e332 on e5d2e913: your commit, two tests of ours, and the test above. fmt, clippy -D warnings, rustdoc, `check --no-gpu` and 23 of its unit tests pass; the new test ran on lavapipe only. No GPU check on it. The rest of my earlier notes about it still stand. @MathiewMay please take what you want from it. One overlap: until #563 is in, an untraced pixel stage with the bitmap no longer counts its own table views as written once a mesh table has the map.
NickStallman commented 2026-11-30 06:49:44 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T06:49:44Z.


A game run that separates what this fixes (from @Jerkin42 on #472, RX 9060 XT, RADV, default mode, one run of our rebased copy of this on f482572a + #557 + #389 + #566 + #564): every earlier run of that build hit a scalar-read fault during the PROLOGUE mesh draws, 9 to 11 minutes after the title, and with this change none of those draws faulted and the run reached the world. About 90 s into the world it faulted again, in a different pair (MS 4db9a403 / PS 9b9409d0), which is also among the unfinished draws in our losses. One run, so not a rate; but it's the first direct sign that this change matters in the game. It fits the gap found by the test on e5d2e913 (a reflected table used without its map).

<!-- greyfinch-sync:brcly/TuxBox:comment:7271055528 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7271055528). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T06:49:44Z. --- A game run that separates what this fixes (from @Jerkin42 on #472, RX 9060 XT, RADV, default mode, one run of our rebased copy of this on f482572a + #557 + #389 + #566 + #564): every earlier run of that build hit a scalar-read fault during the PROLOGUE mesh draws, 9 to 11 minutes after the title, and with this change none of those draws faulted and the run reached the world. About 90 s into the world it faulted again, in a different pair (`MS 4db9a403` / `PS 9b9409d0`), which is also among the unfinished draws in our losses. One run, so not a rate; but it's the first direct sign that this change matters in the game. It fits the gap found by the test on `e5d2e913` (a reflected table used without its map).
NickStallman commented 2026-12-01 01:35:51 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T01:35:51Z.


@MathiewMay a game result for the other half of what I wrote above (draws whose pipeline has no reflected table are skipped), and a small follow-up that depends on this PR.

What was skipped. On an RTX 5090 (620.70.10, GE-Proton11-15), an integration build with this PR's commits skipped about 340 draws a frame in ProjectScarlett's world from one depth-only mesh pipeline, a cascade-shadow caster (236,263 draws in 1,111 s): no reflected table, so under paging no index map, so paged_layout_gap left it out. 75 other depth-only mesh pipelines draw.

Cause, confirmed by a log line in the next run: the pipeline changes no table (no table slot or register differs from what the root declares), so mesh_table::reflected returned none, and only a table carries the map. The program's root indexes the heap directly.

Follow-up (one commit on top of this PR's, in three files, not pushed): for a depth-only pipeline on a directly indexed root, with room for the map's two DWORDs, reflected builds a table with the title's parameters unchanged plus the map, used only if the mesh stage translates with it. Pipelines with a pixel stage are left out on purpose.

Run with it (one, 20 min, 18.5 min in the slow phase): the line "no table changes, so it is given one only for the resource index map" appears for that program, its skips go from 338 a frame to 0 and it is drawn 344 times a frame. No device loss, no refusal. Total skipped calls fell from 307,000 and 236,000 in two earlier runs to 58,000, and the picture has shadow edges it didn't have. That build also carries other changes since those runs, so I don't claim the picture for this commit alone.

Not shown: no GPU check reaches this path (it needs a console-format mesh program in a depth-only pipeline on a directly indexed root under a capped heap), and it has not run on AMD.

I'd rather not open it while this is open, since it can't merge first. Say if you want to take it into this PR; otherwise I'll file it after.

<!-- greyfinch-sync:brcly/TuxBox:comment:7297681547 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7297681547). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-01T01:35:51Z. --- @MathiewMay a game result for the other half of what I wrote above (draws whose pipeline has **no** reflected table are skipped), and a small follow-up that depends on this PR. **What was skipped.** On an RTX 5090 (620.70.10, GE-Proton11-15), an integration build with this PR's commits skipped about 340 draws a frame in ProjectScarlett's world from one depth-only mesh pipeline, a cascade-shadow caster (236,263 draws in 1,111 s): no reflected table, so under paging no index map, so `paged_layout_gap` left it out. 75 other depth-only mesh pipelines draw. **Cause, confirmed by a log line in the next run:** the pipeline changes no table (no table slot or register differs from what the root declares), so `mesh_table::reflected` returned none, and only a table carries the map. The program's root indexes the heap directly. **Follow-up (one commit on top of this PR's, in three files, not pushed):** for a depth-only pipeline on a directly indexed root, with room for the map's two DWORDs, `reflected` builds a table with the title's parameters unchanged plus the map, used only if the mesh stage translates with it. Pipelines with a pixel stage are left out on purpose. **Run with it (one, 20 min, 18.5 min in the slow phase):** the line "no table changes, so it is given one only for the resource index map" appears for that program, its skips go from 338 a frame to 0 and it is drawn 344 times a frame. No device loss, no refusal. Total skipped calls fell from 307,000 and 236,000 in two earlier runs to 58,000, and the picture has shadow edges it didn't have. That build also carries other changes since those runs, so I don't claim the picture for this commit alone. **Not shown:** no GPU check reaches this path (it needs a console-format mesh program in a depth-only pipeline on a directly indexed root under a capped heap), and it has not run on AMD. I'd rather not open it while this is open, since it can't merge first. Say if you want to take it into this PR; otherwise I'll file it after.
brcly commented 2026-12-01 15:14:37 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-01T15:14:37Z.


@MathiewMay #617 merged today (4cc17f52). It uses your request derivation for the mesh and amplification stages (credited in its description), and keeps the map only when every stage that reads the heap has a translation that reads it. So I think this PR's change is now on main in that form.

Is anything here not covered by #617, for example the terrain-pass hang you were tracing? If not, I'll close this one. If the hang still shows on current main, a new issue with the draw's inputs would be the best place for it.

<!-- greyfinch-sync:brcly/TuxBox:comment:7315584193 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/390#issuecomment-7315584193). Originally posted by [brcly](https://github.com/brcly) on 2026-12-01T15:14:37Z. --- @MathiewMay #617 merged today (4cc17f52). It uses your request derivation for the mesh and amplification stages (credited in its description), and keeps the map only when every stage that reads the heap has a translation that reads it. So I think this PR's change is now on main in that form. Is anything here not covered by #617, for example the terrain-pass hang you were tracing? If not, I'll close this one. If the hang still shows on current main, a new issue with the draw's inputs would be the best place for it.
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/390:upstream-pr/390'
git switch 'upstream-pr/390'

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