d3d12: support multi-slice R16/R32 depth-UAV pairs #519

Merged
glovepost merged 2 commits from upstream-pr/519 into main 2026-12-01 14:57:15 +00:00
glovepost commented 2026-11-29 19:04:05 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T19:04:05Z.


Summary

Narrowed #519 to multi-slice R16/R32 depth-UAV pairs only (split out per @brcly's review; the opt-in memory-wait stall release change has been moved off this PR to glovepost/TuxBox:feat/d3d12-opt-in-memory-wait-release until ProjectScarlett game evidence is collected):

  • runtime/d3d12/src/device/depth.rs & device/views/creation.rs: Pairs multi-slice DXGI_FORMAT_R16_TYPELESS / DXGI_FORMAT_R32_TYPELESS (including Texture2DArray UAV views with slice bounds validation) alongside R32G8X24_TYPELESS / D16_UNORM_S8_UINT, mapping initial UNORDERED_ACCESS states appropriately for single-plane pairs.
  • runtime/d3d12/src/commands/depth.rs, commands/barriers.rs, device/resources.rs: Extends subresource validation (subresource < pair.slices * pair.planes) and per-slice depth-UAV copy/synchronization across array slices.
  • runtime/d3d12/src/tests/commands/depth.rs & tests/device/depth.rs: Adds unit tests covering pair_primary, host_uav_desc, initial_uav_maps_to_copy_source_only_for_single_plane_pairs, and command-side multi-slice depth sync.

Verification

  • Host (DXC=<dxc> python3 tuxbox.py check --no-gpu on rebased origin/main 6bab5478): 9/9 passed (739 Python tests OK with 1 skipped, 648 lib + 3 bin + 2 integration shader compiler, 120 DXBC, 24 XG layout with 1 ignored, 7 XG entry point, 22 storage codec, 9 ACP HAL, D3D12 Windows typecheck).
  • Windows tests typecheck (cargo check --tests --target x86_64-pc-windows-msvc --manifest-path runtime/d3d12/Cargo.toml): passed cleanly.
  • GPU: Not re-run after splitting on 6bab5478. Prior combined commit (f1c5e681) passed 10/10 check_d3d12_gpu.py and 126/126 tuxbox.py verify on both NVIDIA RTX 2070 SUPER (10de:1e84) and AMD RX 9070 XT (1002:13c0).
  • ProjectScarlett: Not run with this split PR yet.

AI-assistance disclosure

Prepared and verified with AI-assisted coding tools (submitting contributor verified builds, diffs, and test runs).

<!-- greyfinch-sync:brcly/TuxBox:issue:5554059610 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T19:04:05Z. --- ### Summary Narrowed #519 to **multi-slice `R16`/`R32` depth-UAV pairs** only (split out per `@brcly`'s review; the opt-in memory-wait stall release change has been moved off this PR to `glovepost/TuxBox:feat/d3d12-opt-in-memory-wait-release` until ProjectScarlett game evidence is collected): - **`runtime/d3d12/src/device/depth.rs` & `device/views/creation.rs`:** Pairs multi-slice `DXGI_FORMAT_R16_TYPELESS` / `DXGI_FORMAT_R32_TYPELESS` (including `Texture2DArray` UAV views with slice bounds validation) alongside `R32G8X24_TYPELESS` / `D16_UNORM_S8_UINT`, mapping initial `UNORDERED_ACCESS` states appropriately for single-plane pairs. - **`runtime/d3d12/src/commands/depth.rs`, `commands/barriers.rs`, `device/resources.rs`:** Extends subresource validation (`subresource < pair.slices * pair.planes`) and per-slice depth-UAV copy/synchronization across array slices. - **`runtime/d3d12/src/tests/commands/depth.rs` & `tests/device/depth.rs`:** Adds unit tests covering `pair_primary`, `host_uav_desc`, `initial_uav_maps_to_copy_source_only_for_single_plane_pairs`, and command-side multi-slice depth sync. ### Verification - Host (`DXC=<dxc> python3 tuxbox.py check --no-gpu` on rebased `origin/main` `6bab5478`): **9/9 passed** (`739` Python tests OK with `1` skipped, `648` lib + `3` bin + `2` integration shader compiler, `120` DXBC, `24` XG layout with `1` ignored, `7` XG entry point, `22` storage codec, `9` ACP HAL, D3D12 Windows typecheck). - Windows tests typecheck (`cargo check --tests --target x86_64-pc-windows-msvc --manifest-path runtime/d3d12/Cargo.toml`): passed cleanly. - GPU: Not re-run after splitting on `6bab5478`. Prior combined commit (`f1c5e681`) passed `10/10` `check_d3d12_gpu.py` and `126/126` `tuxbox.py verify` on both NVIDIA RTX 2070 SUPER (`10de:1e84`) and AMD RX 9070 XT (`1002:13c0`). - ProjectScarlett: **Not run** with this split PR yet. ### AI-assistance disclosure Prepared and verified with AI-assisted coding tools (submitting contributor verified builds, diffs, and test runs).
brcly commented 2026-11-29 21:41:55 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T21:41:55Z.


Thanks. Two separate things here, and one holds it:

  • The memory-wait release. On main, a GPU memory wait that nothing is going to write is released after the stall timeout, because, in main's own words, "a queue held forever trips the title's GPU watchdog". This PR makes that release opt-in (TUXBOX_MEMORY_WAIT_RELEASE_SECS), so by default such a queue is held forever. ProjectScarlett hits these waits (the frame log counts memory_waits_released), so this would need game runs showing it doesn't end in the title's watchdog. Without that evidence, we'd keep main's default.
  • The multi-slice and R16/R32 depth-UAV pairing is unrelated and looks reasonable.

Could you split them? The depth-UAV part can then be reviewed on its own, and the release change can come with game evidence.

<!-- greyfinch-sync:brcly/TuxBox:comment:7263079464 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519#issuecomment-7263079464). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T21:41:55Z. --- Thanks. Two separate things here, and one holds it: - **The memory-wait release.** On `main`, a GPU memory wait that nothing is going to write is released after the stall timeout, because, in `main`'s own words, "a queue held forever trips the title's GPU watchdog". This PR makes that release opt-in (`TUXBOX_MEMORY_WAIT_RELEASE_SECS`), so by default such a queue is held forever. ProjectScarlett hits these waits (the frame log counts `memory_waits_released`), so this would need game runs showing it doesn't end in the title's watchdog. Without that evidence, we'd keep `main`'s default. - **The multi-slice and `R16`/`R32` depth-UAV pairing** is unrelated and looks reasonable. Could you split them? The depth-UAV part can then be reviewed on its own, and the release change can come with game evidence.
glovepost commented 2026-11-29 22:37:42 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T22:37:42Z.


@brcly Updated #519 on main (6bab5478, commit ac493db5), narrowed to multi-slice R16/R32 depth-UAV pairs only:

  • Kept only the depth-UAV files (barriers.rs, commands/depth.rs, device/depth.rs, device/resources.rs, device/views/creation.rs, and tests/{commands,device}/depth.rs).
  • Moved the opt-in memory-wait release change (TUXBOX_MEMORY_WAIT_RELEASE_SECS, memory_wait.rs, release_timeout.rs, memory_wait_regressions.rs) out to glovepost/TuxBox:feat/d3d12-opt-in-memory-wait-release without opening a PR yet until we collect ProjectScarlett TUXBOX_FRAME_LOG / watchdog evidence.
  • Verified with tuxbox.py check --no-gpu (9/9) and cargo check --tests --target x86_64-pc-windows-msvc on tuxbox-d3d12. ProjectScarlett was not re-run since splitting.
<!-- greyfinch-sync:brcly/TuxBox:comment:7263824421 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519#issuecomment-7263824421). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T22:37:42Z. --- @brcly Updated #519 on `main` (`6bab5478`, commit `ac493db5`), narrowed to **multi-slice `R16`/`R32` depth-UAV pairs** only: - Kept only the depth-UAV files (`barriers.rs`, `commands/depth.rs`, `device/depth.rs`, `device/resources.rs`, `device/views/creation.rs`, and `tests/{commands,device}/depth.rs`). - Moved the opt-in memory-wait release change (`TUXBOX_MEMORY_WAIT_RELEASE_SECS`, `memory_wait.rs`, `release_timeout.rs`, `memory_wait_regressions.rs`) out to `glovepost/TuxBox:feat/d3d12-opt-in-memory-wait-release` without opening a PR yet until we collect ProjectScarlett `TUXBOX_FRAME_LOG` / watchdog evidence. - Verified with `tuxbox.py check --no-gpu` (`9/9`) and `cargo check --tests --target x86_64-pc-windows-msvc` on `tuxbox-d3d12`. ProjectScarlett was not re-run since splitting.
glovepost commented 2026-11-30 01:12:58 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-30T01:12:58Z.


Rebased onto main (f482572a, commit 0d767e3a3a03) with no functional changes from ac493db5, and ran the changed GPU checks on NVIDIA (headless xvfb-run with WAYLAND_DISPLAY=""):

  • Command: WAYLAND_DISPLAY="" TUXBOX_CHECK_JOBS=2 DXC=<dxc> xvfb-run -a -s "-screen 0 2560x1440x24" python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc>
  • GPU / driver / backend: NVIDIA GeForce RTX 2070 SUPER (10de:1e84), driver 620.73.04, GE-Proton11-14
  • Results: Lanes and fixtures on the GPU (d3d12-*, guest-frame, present, lanes, lanes-*) and all D3D12 regression controls (22/22) passed (13 passed, 0 failed, 0 not run).
  • Still missing: AMD GPU checks. ProjectScarlett was not run on this commit.

Evidence: TuxBox check of 0d767e3a3a03, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run

<!-- greyfinch-sync:brcly/TuxBox:comment:7265944062 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519#issuecomment-7265944062). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-30T01:12:58Z. --- Rebased onto `main` (`f482572a`, commit `0d767e3a3a03`) with no functional changes from `ac493db5`, and ran the changed GPU checks on NVIDIA (headless `xvfb-run` with `WAYLAND_DISPLAY=""`): - **Command:** `WAYLAND_DISPLAY="" TUXBOX_CHECK_JOBS=2 DXC=<dxc> xvfb-run -a -s "-screen 0 2560x1440x24" python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc>` - **GPU / driver / backend:** NVIDIA GeForce RTX 2070 SUPER (`10de:1e84`), driver `620.73.04`, `GE-Proton11-14` - **Results:** `Lanes and fixtures on the GPU` (`d3d12-*`, `guest-frame`, `present`, `lanes`, `lanes-*`) and all `D3D12 regression controls` (`22/22`) passed (**13 passed, 0 failed, 0 not run**). - **Still missing:** AMD GPU checks. ProjectScarlett was not run on this commit. `Evidence: TuxBox check of 0d767e3a3a03, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run`
NickStallman commented 2026-11-30 01:46:59 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T01:46:59Z.


The AMD check you were missing, on 0d767e3a: AMD iGPU (1002:13c0, RADV, Mesa 26.0.8, GE-Proton11-14, Linux), full python tuxbox.py check: 199 pass, 0 fail. A game was loading on the other card for part of it. ProjectScarlett was not run on this commit.

Evidence: TuxBox check of 0d767e3a3a, no uncommitted changes, GPU 1002:13c0: 14 passed, 0 failed, 0 not run

<!-- greyfinch-sync:brcly/TuxBox:comment:7266436070 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519#issuecomment-7266436070). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T01:46:59Z. --- The AMD check you were missing, on 0d767e3a: AMD iGPU (`1002:13c0`, RADV, Mesa 26.0.8, GE-Proton11-14, Linux), full `python tuxbox.py check`: 199 pass, 0 fail. A game was loading on the other card for part of it. ProjectScarlett was not run on this commit. Evidence: TuxBox check of 0d767e3a3a03, no uncommitted changes, GPU 1002:13c0: 14 passed, 0 failed, 0 not run
brcly commented 2026-11-30 04:12:23 +00:00 (Migrated from github.com)

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


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:7268563326 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/519#issuecomment-7268563326). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:23Z. --- 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!
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!519
No description provided.