D3D12 shader: reach mixed typed table reads in the D16 round-trip test #2540
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2540"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T01:23:56Z.
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 changecargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-shader --lib typed_d16_table_uav_roundtrip -- --test-threads=1passed. 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).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:34Z.
Static review at head
698d1cceb(Rust toolchain is not installed in this local environment, socargo testwas not executed locally).Notes
buffer_load_format_xinstructions 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.integer_viewand requestSLOT_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.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T02:19:31Z.
Review: COMMENTED
Verified at head
698d1ccebon Windows 11 with NVIDIA GeForce RTX 3090 (driver610.88) D3D12 and WARP, including negative control onmain(431ceba4f):Lower::places_read_as_halves()(crates/leonida-shader/src/emit/halves.rs), table slotss[8:11]ands[12:15]were previously touched only bybuffer_load_format_d16_xyzw/buffer_store_format_d16_xyzw, placing both inhalves_only(HostShader::half_viewsunsigned twins) soSLOT_TABLE_STRIDESwas not requested.buffer_load_format_xinto otherwise-unusedv6andv7(read_only_as_halvesreturnsfalsewhenused == false, disjoint fromv0,v[2:3], andv4) inserts both table places intoother, keeping both slots on their declaredUINT/SINT/FLOATUAV formats and exercisingSLOT_TABLE_STRIDESformat-bit unpacking/packing (including at dynamicbase_slot = 3).431ceba4f: reproducedtyped_d16_table_uav_roundtrip_uint_sint_and_floatpanicking atvalu_tests.rs:2235(table typed d16 shader should request SLOT_TABLE_STRIDES).698d1cceb:cargo test -p leonida-shader typed_d16_table_uav_roundtrip -- --test-threads=1:1 passed; 0 failedacross all 4UINT/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.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:28:53Z.
Review: APPROVED
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 requestsSLOT_TABLE_STRIDESand 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(withLEONIDA_DXILunset/skipped for the old 10.0.19041 inboxdxil.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).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:24:06Z.
VERIFY-2540-D3D12— verified head698d1ccebcmerged cleanly withmainc7f5330e0on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88) + D3D12 WARP, synthetic shader test inputs only.Red (
mainc7f5330e0) -> Green (c7f5330e0+698d1ccebc)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_STRIDESatd3d12/crates/leonida-shader/src/emit/valu_tests.rs:2235, because D16-only table slots now use unsigned twin views and omitSLOT_TABLE_STRIDES).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 WARPUINT,SINT, andFLOATreadbacks).cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib -- --test-threads=4-> 348 passed; 0 failed; 4 ignored.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:20:12Z.
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.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:04:40Z.
Verified by OreoFR
54d27d988+ PR head698d1cceb; green run in a merge package of 5 PRs, no new ctest failure vs maincargo test -p leonida-shader --lib --locked -- typed_d16_table_uav_roundtripAI-assisted (Claude Code, Claude Opus 5.5).