d3d12: publish textures stored through a table beside the heap write bitmap #563

Closed
NickStallman wants to merge 3 commits from upstream-pr/563 into main
NickStallman commented 2026-11-30 00:18:34 +00:00 (Migrated from github.com)

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


Fixes a gap left beside #462's heap write bitmap.

The bitmap names the heap slots a program stored through. A store through a table descriptor sets no bit. When the resource index map is also bound, the whole heap counts as only read, including the program's own tables, so a texture it stores through a table is never published to title memory. Without the map those tables already count as written. This does the same with it; the rest of the heap stays read-only.

Three commits: the decision about the view sets moved into one function (no behaviour change intended), a Lanes scenario, then the fix with unit tests.

Measured, AMD iGPU (1002:13c0, RADV, GE-Proton11-14), verify --only lanes-bindless-compute:

Tree Result
Before the fix (with the new scenario) 24 pass, 2 fail, in 2 of 2 runs: only lanes-bindless-table-heap-store-wide and -constrained. The table store's word is in title memory 0 times of 65,536
With the fix 26 pass, 0 fail, in 2 of 2 runs
  • RTX 5090 (10de:2b85, 620.70.10, GE-Proton11-14), one run each: before 24 pass, 2 fail (the same two); with the fix 26 pass, 0 fail.
  • RX 5700 XT (RDNA 1, @Claudineijoseprill): the two new tests pass; 16 other failures are the same on unchanged main there (no ray tracing, mesh shaders or barycentrics on that card).
  • check --no-gpu: 10 passed, 0 failed.
  • The translator is unchanged, so nothing recompiles.

Cost: up to 4 more published textures per dispatch in the programs below, counted from what their tables declare; not measured at run time. If a table lies outside the bound heap, the whole heap counts as written.

In ProjectScarlett: 9 recorded compute programs have the map, the bitmap and table image stores. I don't know yet which are dispatched or whether their targets are placed in title memory, so the effect on the picture is a guess. The game hasn't run with this.

Not fixed: heap image atomics set no bit either; I found none in recorded requests that carry the bitmap.

  • Full python tuxbox.py check of bd8015d4 (rebased onto e5d2e913; main's reformat and one Miri-ignore marker on a test; range-diff in the PR's history): RTX 5090 (10de:2b85, 620.70.10) 202 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 201 pass, 0 fail. GE-Proton11-14.

Not run: the game for a change in the picture. Integration builds with it reached the story's loading on an RTX 5090, and then ended in a different crash.

Evidence: TuxBox check of bd8015d438, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run
Evidence: TuxBox check of bd8015d438, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5556730343 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/563). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T00:18:34Z. --- Fixes a gap left beside #462's heap write bitmap. The bitmap names the heap slots a program stored through. A store through a *table* descriptor sets no bit. When the resource index map is also bound, the whole heap counts as only read, including the program's own tables, so a texture it stores through a table is never published to title memory. Without the map those tables already count as written. This does the same with it; the rest of the heap stays read-only. Three commits: the decision about the view sets moved into one function (no behaviour change intended), a Lanes scenario, then the fix with unit tests. **Measured**, AMD iGPU (`1002:13c0`, RADV, GE-Proton11-14), `verify --only lanes-bindless-compute`: | Tree | Result | |---|---| | Before the fix (with the new scenario) | 24 pass, 2 fail, in 2 of 2 runs: only `lanes-bindless-table-heap-store-wide` and `-constrained`. The table store's word is in title memory 0 times of 65,536 | | With the fix | 26 pass, 0 fail, in 2 of 2 runs | - RTX 5090 (`10de:2b85`, 620.70.10, GE-Proton11-14), one run each: before 24 pass, 2 fail (the same two); with the fix 26 pass, 0 fail. - RX 5700 XT (RDNA 1, @Claudineijoseprill): the two new tests pass; 16 other failures are the same on unchanged `main` there (no ray tracing, mesh shaders or barycentrics on that card). - `check --no-gpu`: 10 passed, 0 failed. - The translator is unchanged, so nothing recompiles. **Cost:** up to 4 more published textures per dispatch in the programs below, counted from what their tables declare; not measured at run time. If a table lies outside the bound heap, the whole heap counts as written. **In ProjectScarlett:** 9 recorded compute programs have the map, the bitmap and table image stores. I don't know yet which are dispatched or whether their targets are placed in title memory, so the effect on the picture is a guess. The game hasn't run with this. **Not fixed:** heap image atomics set no bit either; I found none in recorded requests that carry the bitmap. - Full `python tuxbox.py check` of bd8015d4 (rebased onto e5d2e913; main's reformat and one Miri-ignore marker on a test; range-diff in the PR's history): RTX 5090 (`10de:2b85`, 620.70.10) 202 pass, 0 fail; AMD iGPU (`1002:13c0`, RADV) 201 pass, 0 fail. GE-Proton11-14. **Not run:** the game for a change in the picture. Integration builds with it reached the story's loading on an RTX 5090, and then ended in a different crash. Evidence: TuxBox check of bd8015d438e9, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run Evidence: TuxBox check of bd8015d438e9, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claudineijoseprill commented 2026-11-30 03:17:51 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Claudineijoseprill on 2026-11-30T03:17:51Z.


AMD discrete RDNA 1 run, on 0d219279: Radeon RX 5700 XT (1002:731f, RADV, Mesa 25.2.8, GE-Proton11-14, Ubuntu 24.04), full python tuxbox.py check with --proton, --prefix and --windows-dxc: 186 pass, 16 fail.

Against unchanged main (f482572a) on the same machine: 184 pass, the same 16 fail. The only difference is the two new gates, lanes-bindless-table-heap-store-wide and -constrained, which pass. No regressions.

The 16 failures are all features this card or driver lacks, and fail the same on main:

  • 7 lanes-selftest-ray-tracing-*, bvh64-query, bvh32-query: no ray tracing on RDNA 1
  • 5 lanes-mesh-*, the mesh D3D12 control, translated-mesh: no mesh shaders
  • pixel-interp (flat and half cases, pipeline E_INVALIDARG; smooth passes): RADV doesn't expose VK_KHR_fragment_shader_barycentric on this card

Not run: a game.

Evidence: TuxBox check of 0d219279c5, no uncommitted changes, GPU default adapter: 11 passed, 3 failed, 0 not run

<!-- greyfinch-sync:brcly/TuxBox:comment:7267765458 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/563#issuecomment-7267765458). Originally posted by [Claudineijoseprill](https://github.com/Claudineijoseprill) on 2026-11-30T03:17:51Z. --- AMD discrete RDNA 1 run, on 0d219279: Radeon RX 5700 XT (`1002:731f`, RADV, Mesa 25.2.8, GE-Proton11-14, Ubuntu 24.04), full `python tuxbox.py check` with `--proton`, `--prefix` and `--windows-dxc`: **186 pass, 16 fail**. Against unchanged `main` (f482572a) on the same machine: 184 pass, the same 16 fail. The only difference is the two new gates, `lanes-bindless-table-heap-store-wide` and `-constrained`, which pass. No regressions. The 16 failures are all features this card or driver lacks, and fail the same on `main`: - 7 `lanes-selftest-ray-tracing-*`, `bvh64-query`, `bvh32-query`: no ray tracing on RDNA 1 - 5 `lanes-mesh-*`, the `mesh` D3D12 control, `translated-mesh`: no mesh shaders - `pixel-interp` (`flat` and `half` cases, pipeline `E_INVALIDARG`; `smooth` passes): RADV doesn't expose `VK_KHR_fragment_shader_barycentric` on this card Not run: a game. Evidence: TuxBox check of 0d219279c578, no uncommitted changes, GPU default adapter: 11 passed, 3 failed, 0 not run
brcly commented 2026-11-30 04:12:06 +00:00 (Migrated from github.com)

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


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:7268558754 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/563#issuecomment-7268558754). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:06Z. --- 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!
brcly commented 2026-11-30 09:31:59 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:31:59Z.


Merged into main as 539b8cb3 (squashed and credited to you), thanks! The Lanes scenario failing on both vendors before the fix makes it easy to trust. On the squashed result, d3d12's unit tests pass under Wine (four more than before), and clippy, formatting and the Lanes Python tests are clean. Thanks also to @Claudineijoseprill for the RDNA 1 run.

<!-- greyfinch-sync:brcly/TuxBox:comment:7274336182 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/563#issuecomment-7274336182). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T09:31:59Z. --- Merged into main as 539b8cb3 (squashed and credited to you), thanks! The Lanes scenario failing on both vendors before the fix makes it easy to trust. On the squashed result, d3d12's unit tests pass under Wine (four more than before), and clippy, formatting and the Lanes Python tests are clean. Thanks also to @Claudineijoseprill for the RDNA 1 run.

Pull request closed

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!563
No description provided.