d3d12: publish a descriptor write only to the tables that can hold it #361

Merged
Jerkin42 merged 1 commit from upstream-pr/361 into main 2026-11-28 09:22:22 +00:00
Jerkin42 commented 2026-11-28 02:54:52 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-28T02:54:52Z.


Summary

Arena::publish (runtime/d3d12/src/device/descriptor_paging.rs) copies a descriptor write into every resident table that holds the written slot. To find those tables it walked the whole ranges map on every call, and every descriptor write publishes. So one write cost as much as the full set of resident tables.

Tables now keeps longest, the length of the longest range ever inserted. A table that starts more than longest slots before the write cannot reach it, so publish visits only ranges.range((first - longest, 0)..(end, 0)). The tables it copies into are the same as before. longest only grows, so it stays a valid bound when tables are evicted.

Measured in ProjectScarlett's first world scene on AMD (Series S profile, ray tracing off), sampling the whole game process with perf for 10 s:

before after
Arena::publish share of the game's CPU 35% (6 submission threads, two of them >90% in it) not in the top functions
frame interval in the world 13–17 s about 6 s

The world is still CPU-bound after this, on the placed-texture refresh path (#292), which I am working on separately.

Tested

  • The checks relevant to this change passed (two Lanes cases that also fail on main here, see below)
  • 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.

The result is the same set of copies, so there is no new behaviour for a Lanes scenario to cover; the existing d3d12-* suites exercise descriptor publication.

GPU, driver and backend: AMD RX 9060 XT, Mesa RADV 26.1.8, Linux 7.3.1; checks on Proton Experimental, the game on GE-Proton 11-14

Commands run and their results:

python tuxbox.py check --proton ".../Proton - Experimental" --prefix <small check prefix> --windows-dxc <dxc 2505>
  passed   Build the shader compiler
  passed   Python tests
  passed   Shader compiler tests
  passed   DXBC tests
  passed   XG layout tests
  passed   Storage codec tests
  passed   D3D12 Windows typecheck
  passed   Build
  FAILED   Lanes and fixtures on the GPU   (2 FAIL: invalid-route, lanes-selftest-mesh-signature-none)
  passed   D3D12 regression controls
  passed   Shader translator on the GPU
cargo check --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --all-targets   passed
ProjectScarlett runs before/after with perf sampling                                 as in the table

Both Lanes failures happen on plain main (df4f27c) on this machine too: invalid-route checks route-game.exe's exit status and has failed here before, and python tuxbox.py verify --only lanes-selftest on main fails lanes-selftest-mesh-signature-none the same way. Neither involves the code this changes.

Checks

No evidence JSON changes.

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5535990570 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/361). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-28T02:54:52Z. --- ## Summary `Arena::publish` (`runtime/d3d12/src/device/descriptor_paging.rs`) copies a descriptor write into every resident table that holds the written slot. To find those tables it walked the whole `ranges` map on every call, and every descriptor write publishes. So one write cost as much as the full set of resident tables. `Tables` now keeps `longest`, the length of the longest range ever inserted. A table that starts more than `longest` slots before the write cannot reach it, so `publish` visits only `ranges.range((first - longest, 0)..(end, 0))`. The tables it copies into are the same as before. `longest` only grows, so it stays a valid bound when tables are evicted. Measured in ProjectScarlett's first world scene on AMD (Series S profile, ray tracing off), sampling the whole game process with `perf` for 10 s: | | before | after | | --- | --- | --- | | `Arena::publish` share of the game's CPU | 35% (6 submission threads, two of them >90% in it) | not in the top functions | | frame interval in the world | 13–17 s | about 6 s | The world is still CPU-bound after this, on the placed-texture refresh path (#292), which I am working on separately. ## Tested - [x] The checks relevant to this change passed (two Lanes cases that also fail on `main` here, see below) - [x] 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.** The result is the same set of copies, so there is no new behaviour for a Lanes scenario to cover; the existing `d3d12-*` suites exercise descriptor publication. GPU, driver and backend: AMD RX 9060 XT, Mesa RADV 26.1.8, Linux 7.3.1; checks on Proton Experimental, the game on GE-Proton 11-14 Commands run and their results: ```text python tuxbox.py check --proton ".../Proton - Experimental" --prefix <small check prefix> --windows-dxc <dxc 2505> passed Build the shader compiler passed Python tests passed Shader compiler tests passed DXBC tests passed XG layout tests passed Storage codec tests passed D3D12 Windows typecheck passed Build FAILED Lanes and fixtures on the GPU (2 FAIL: invalid-route, lanes-selftest-mesh-signature-none) passed D3D12 regression controls passed Shader translator on the GPU cargo check --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --all-targets passed ProjectScarlett runs before/after with perf sampling as in the table ``` Both Lanes failures happen on plain `main` (df4f27c) on this machine too: `invalid-route` checks `route-game.exe`'s exit status and has failed here before, and `python tuxbox.py verify --only lanes-selftest` on `main` fails `lanes-selftest-mesh-signature-none` the same way. Neither involves the code this changes. ## Checks No evidence JSON changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Jerkin42 commented 2026-11-28 04:20:07 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-28T04:20:07Z.


I only have an AMD card (RX 9060 XT, RADV), so the NVIDIA half of the checks is still open. If someone with an NVIDIA GPU can run python tuxbox.py check on this branch and post the summary, that would cover the vendor row. Thank you!

<!-- greyfinch-sync:brcly/TuxBox:comment:7233937335 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/361#issuecomment-7233937335). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-28T04:20:07Z. --- I only have an AMD card (RX 9060 XT, RADV), so the NVIDIA half of the checks is still open. If someone with an NVIDIA GPU can run `python tuxbox.py check` on this branch and post the summary, that would cover the vendor row. Thank you!
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!361
No description provided.