D3D12 shader: reach mixed typed table reads in the D16 round-trip test #2540

Merged
leonida/mandy
kirigayakazima merged 1 commit from codex/d3d12-table-d16-regression into main 2026-11-28 20:20:18 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-28 01:23:56 +00:00

D3D12-TABLE-D16-REGRESSION. Claim.

The typed D16 table test on main stops before the first dispatch. Its source and destination table slots were used exclusively for D16 accesses, so the translator correctly picked unsigned twin views and omitted SLOT_TABLE_STRIDES. Give both slots a whole-channel read too. These mixed-use slots retain their declared formats, so the original root-binding assertions and bit-exact readbacks now cover the intended typed path, including a nonzero table base.

Windows base 431ceba4f: the full leonida-shader library suite reported 347 passed, 1 failed (this test), 4 ignored. After the change cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-shader --lib typed_d16_table_uav_roundtrip -- --test-threads=1 passed. A separate local verification run required both hardware and WARP device creation to succeed and passed the UINT, SINT and FLOAT readbacks on both. No executable shader code or retail data is included in this PR; the test extends its existing hand-authored source fixture. Diff whitespace and no-game-data checks passed.

GPUs tested: Windows D3D12 hardware adapter on an RTX 4070 Laptop GPU system (NVIDIA 610.74), plus WARP. No in-game image or performance measurement. Independent PR. AI-assisted with OpenAI Codex (GPT-6).

D3D12-TABLE-D16-REGRESSION. [Claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231617930). The typed D16 table test on main stops before the first dispatch. Its source and destination table slots were used exclusively for D16 accesses, so the translator correctly picked unsigned twin views and omitted SLOT_TABLE_STRIDES. Give both slots a whole-channel read too. These mixed-use slots retain their declared formats, so the original root-binding assertions and bit-exact readbacks now cover the intended typed path, including a nonzero table base. Windows base 431ceba4f: the full leonida-shader library suite reported 347 passed, 1 failed (this test), 4 ignored. After the change `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-shader --lib typed_d16_table_uav_roundtrip -- --test-threads=1` passed. A separate local verification run required both hardware and WARP device creation to succeed and passed the UINT, SINT and FLOAT readbacks on both. No executable shader code or retail data is included in this PR; the test extends its existing hand-authored source fixture. Diff whitespace and no-game-data checks passed. GPUs tested: Windows D3D12 hardware adapter on an RTX 4070 Laptop GPU system (NVIDIA 610.74), plus WARP. No in-game image or performance measurement. Independent PR. AI-assisted with OpenAI Codex (GPT-6).
timbot103 commented 2026-11-28 02:02:34 +00:00

Static review at head 698d1cceb (Rust toolchain is not installed in this local environment, so cargo test was not executed locally).

Notes

  • Adding two ordinary buffer_load_format_x instructions referencing the same descriptor sources (d3d12/crates/leonida-shader/src/emit/valu_tests.rs:2205-2225) cleanly disqualifies those slots from the half-only set during pre-lowering classification (halves.rs:17-25, 67-146; lower.rs:3136, 13063-13079), even if dead-code elimination later drops the unused results.
  • Both D16 operations now exercise integer_view and request SLOT_TABLE_STRIDES (lower.rs:8871-8918, 13331-13355, 13514-13537), and the test verifies the root SRV presence alongside UINT/SINT/FLOAT round-trip comparisons.

Approve.

AI-assisted static review.

Static review at head `698d1cceb` (Rust toolchain is not installed in this local environment, so `cargo test` was not executed locally). ### Notes - Adding two ordinary `buffer_load_format_x` instructions referencing the same descriptor sources (`d3d12/crates/leonida-shader/src/emit/valu_tests.rs:2205-2225`) cleanly disqualifies those slots from the half-only set during pre-lowering classification (`halves.rs:17-25`, `67-146`; `lower.rs:3136`, `13063-13079`), even if dead-code elimination later drops the unused results. - Both D16 operations now exercise `integer_view` and request `SLOT_TABLE_STRIDES` (`lower.rs:8871-8918`, `13331-13355`, `13514-13537`), and the test verifies the root SRV presence alongside UINT/SINT/FLOAT round-trip comparisons. Approve. AI-assisted static review.
zmasi left a comment
No description provided.
Verified at head `698d1cceb` on Windows 11 with **NVIDIA GeForce RTX 3090 (driver `610.88`)** D3D12 and **WARP**, including negative control on `main` (`431ceba4f`): - **Code check**: - In `Lower::places_read_as_halves()` (`crates/leonida-shader/src/emit/halves.rs`), table slots `s[8:11]` and `s[12:15]` were previously touched only by `buffer_load_format_d16_xyzw` / `buffer_store_format_d16_xyzw`, placing both in `halves_only` (`HostShader::half_views` unsigned twins) so `SLOT_TABLE_STRIDES` was not requested. - Emitting `buffer_load_format_x` into otherwise-unused `v6` and `v7` (`read_only_as_halves` returns `false` when `used == false`, disjoint from `v0`, `v[2:3]`, and `v4`) inserts both table places into `other`, keeping both slots on their declared `UINT`/`SINT`/`FLOAT` UAV formats and exercising `SLOT_TABLE_STRIDES` format-bit unpacking/packing (including at dynamic `base_slot = 3`). - **Negative control on `431ceba4f`**: reproduced `typed_d16_table_uav_roundtrip_uint_sint_and_float` panicking at `valu_tests.rs:2235` (`table typed d16 shader should request SLOT_TABLE_STRIDES`). - **Positive runs on `698d1cceb`**: - `cargo test -p leonida-shader typed_d16_table_uav_roundtrip -- --test-threads=1`: `1 passed; 0 failed` across all 4 `UINT`/`SINT`/`FLOAT`/dynamic-offset cases on both `"hardware"` (RTX 3090 D3D12) and `"warp"` (WARP). - `cargo test -p leonida-shader emit::valu_tests:: -- --test-threads=4`: `37 passed; 0 failed; 1 ignored`. AI-assisted.
lixonik approved these changes 2026-11-28 09:28:53 +00:00
lixonik left a comment

Reviewed the diff and tested merged onto main (493867366) on Windows 11 with Rust 1.100.1 (MSVC).

Adding a whole-channel mubuf_idxen(0x00, ...) read on both typed UAV table slots keeps their declared formats instead of lowering to unsigned twins, so the shader requests SLOT_TABLE_STRIDES and exercises the intended typed D16 round-trip path on both hardware D3D12 and WARP.

Tests run

  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-shader --lib typed_d16_table_uav_roundtrip -- --test-threads=1 (with LEONIDA_DXIL unset/skipped for the old 10.0.19041 inbox dxil.dll): 1 passed, 0 failed (0.21 s, covering hardware D3D12 + WARP UINT/SINT/FLOAT readbacks).

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88) + WARP.

AI-assisted (Antigravity, Gemini).

Reviewed the diff and tested merged onto `main` (`493867366`) on Windows 11 with Rust 1.100.1 (MSVC). Adding a whole-channel `mubuf_idxen(0x00, ...)` read on both typed UAV table slots keeps their declared formats instead of lowering to unsigned twins, so the shader requests `SLOT_TABLE_STRIDES` and exercises the intended typed D16 round-trip path on both hardware D3D12 and WARP. ### Tests run - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-shader --lib typed_d16_table_uav_roundtrip -- --test-threads=1` (with `LEONIDA_DXIL` unset/skipped for the old 10.0.19041 inbox `dxil.dll`): **1 passed, 0 failed** (0.21 s, covering hardware D3D12 + WARP UINT/SINT/FLOAT readbacks). GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88) + WARP. AI-assisted (Antigravity, Gemini).
zmasi commented 2026-11-28 11:24:06 +00:00

VERIFY-2540-D3D12 — verified head 698d1ccebc merged cleanly with main c7f5330e0 on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88) + D3D12 WARP, synthetic shader test inputs only.

Red (main c7f5330e0) -> Green (c7f5330e0 + 698d1ccebc)

  • Red on main:
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::valu_tests::typed_d16_table_uav_roundtrip_uint_sint_and_float -- --exact --test-threads=1 -> FAILED (table typed d16 shader should request SLOT_TABLE_STRIDES at d3d12/crates/leonida-shader/src/emit/valu_tests.rs:2235, because D16-only table slots now use unsigned twin views and omit SLOT_TABLE_STRIDES).
  • Green on merged PR:
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::valu_tests::typed_d16_table_uav_roundtrip_uint_sint_and_float -- --exact --test-threads=1 -> 1 passed; 0 failed (0.49s, exercising both RTX 3090 D3D12 hardware and WARP UINT, SINT, and FLOAT readbacks).
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib -- --test-threads=4 -> 348 passed; 0 failed; 4 ignored.

AI-assisted.

`VERIFY-2540-D3D12` — verified head `698d1ccebc` merged cleanly with `main` `c7f5330e0` on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88) + D3D12 WARP, synthetic shader test inputs only. ### Red (`main` `c7f5330e0`) -> Green (`c7f5330e0` + `698d1ccebc`) - **Red on `main`**: - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::valu_tests::typed_d16_table_uav_roundtrip_uint_sint_and_float -- --exact --test-threads=1` -> **FAILED** (`table typed d16 shader should request SLOT_TABLE_STRIDES` at `d3d12/crates/leonida-shader/src/emit/valu_tests.rs:2235`, because D16-only table slots now use unsigned twin views and omit `SLOT_TABLE_STRIDES`). - **Green on merged PR**: - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::valu_tests::typed_d16_table_uav_roundtrip_uint_sint_and_float -- --exact --test-threads=1` -> **1 passed; 0 failed** (`0.49s`, exercising both RTX 3090 D3D12 hardware and WARP `UINT`, `SINT`, and `FLOAT` readbacks). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib -- --test-threads=4` -> **348 passed; 0 failed; 4 ignored**. AI-assisted.
MoonEyes commented 2026-11-28 20:20:12 +00:00

Red/green: On main typed_d16_table_uav_roundtrip fails, and with the PR's two whole-channel reads keeping the typed slots' formats cargo test -p leonida-shader --lib -- typed_d16_table_uav_roundtrip passes on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

Red/green: On main typed_d16_table_uav_roundtrip fails, and with the PR's two whole-channel reads keeping the typed slots' formats cargo test -p leonida-shader --lib -- typed_d16_table_uav_roundtrip passes on Windows 11 at OreoFR's (RTX 4070). Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 22:04:40 +00:00

Verified by OreoFR

  • Base: main 54d27d988 + PR head 698d1cceb; green run in a merge package of 5 PRs, no new ctest failure vs main
  • Test: cargo test -p leonida-shader --lib --locked -- typed_d16_table_uav_roundtrip
  • Red on main: 1 failure on main ("table typed d16 shader should request SLOT_TABLE_STRIDES")
  • Green with the PR: OK
  • Verdict: READY (test-only PR: main is the red)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `54d27d988` + PR head `698d1cceb`; green run in a merge package of 5 PRs, no new ctest failure vs main - Test: `cargo test -p leonida-shader --lib --locked -- typed_d16_table_uav_roundtrip` - Red on main: 1 failure on main ("table typed d16 shader should request SLOT_TABLE_STRIDES") - Green with the PR: OK - Verdict: READY (test-only PR: main is the red) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.