D3D12: anchor the placed-view regression to its backing buffer #2538
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2538"
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:20:08Z.
D3D12-DESCRIPTOR-VIEW-BACKING-TEST. Claim.
The placed-view test assumes its 456-byte structured element starts exactly one element into a backing buffer. It supplied only loose process memory. Aligning start to 4 KiB does not give the host window that origin, so the shared-buffer assertion could fail with the default LEONIDA_STRUCTURED_BYTES=0. Register a 4 KiB backing range for the existing fixture and release the registration before its memory drops, including on a panic. The same raw/structured resource-width and copy-span assertions still exercise the production path.
On Windows at
431ceba4f, running the single test separately failed with STRUCTURED_BYTES=0 and passed with =1. On this branch the single test passed in separate processes with each setting (cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib views_off_their_elements_get_a_copy_of_their_bytes -- --test-threads=1). In a local combined checkout with #2537 the full GPU library suite passed: 483 passed, 46 ignored. Diff whitespace and no-game-data checks passed.GPUs tested: Windows system with RTX 4070 Laptop GPU, driver 610.74. Synthetic descriptor test; retail rendering was not measured. Independent of #2537. AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:35Z.
Static review at head
243e536bd(Rust toolchain is not installed in this local environment, socargo testwas not executed locally).Notes
d3d12/crates/leonida-gpu/src/descriptor/host.rs:6405-6421) eliminates window-grid alignment drift in loose shadow lookups (shadow.rs:5913-5927,6033-6068,6125-6136), and the RAII guard unregisters the same key before the backing allocation drops (including on unwind).Approve.
AI-assisted static review.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T02:19:29Z.
Review: COMMENTED
Verified at head
243e536bdon Windows 11 with NVIDIA GeForce RTX 3090 (driver610.88) D3D12 (whereraw_views() == 0on the 1M-descriptor tier) and WARP (--features diagnostics,LEONIDA_D3D12_WARP=1), including negative control onmain(431ceba4f):start,shadow::find(start + 456, 4 * 456)resolved a loose-memory window whose cell origin isWINDOW-aligned; since4096 % 456 == 448 != 0,(start - window_origin) + 456was off-element (!offset.is_multiple_of(456)) for 56 of 57 4 KiB page offsets inside a cell, causingoff_elementsto requestshadow::exacteven underLEONIDA_STRUCTURED_BYTES=0.[start, start + 4096)covers every view range tested (max end = 32 + 4 * 456 = 1,856,456 + 4 * 456 = 2,280 <= 4,096within the 64 KiBmemoryallocation), anchorsshadow.offset(start + 456)to456(1 * 456), and declares_backingaftermemorysoBacking::dropcallsshadow::unregisterbeforememoryis freed (including on unwind).431ceba4f(LEONIDA_STRUCTURED_BYTES=0, RTX 3090): reproduced the panic atdescriptor/host.rs:6457(copy.span().0 == start + 456).243e536bd(views_off_their_elements_get_a_copy_of_their_bytes):LEONIDA_STRUCTURED_BYTES=0(elsebranch: stays on backing buffer copy):1 passed; 0 failed.LEONIDA_STRUCTURED_BYTES=1(raw_views() == 0 && structured_bytes()branch: gets exact[start + 456, +1824)copy):1 passed; 0 failed.--features diagnostics,LEONIDA_D3D12_WARP=1),LEONIDA_STRUCTURED_BYTES=0and=1:1 passed; 0 failedin both modes.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:20:48Z.
Review: APPROVED
Reviewed the diff and tested merged onto
main(493867366) on Windows 11 with Rust 1.100.1 (MSVC).Registering a 4 KiB backing range via
crate::shadow::registerwith aDropguard cleanly anchors the placed-view fixture for bothLEONIDA_STRUCTURED_BYTES=0and=1.Tests run
cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib views_off_their_elements_get_a_copy_of_their_bytes -- --test-threads=1:LEONIDA_STRUCTURED_BYTES=0: 1 passed, 0 failed (0.23 s).LEONIDA_STRUCTURED_BYTES=1: 1 passed, 0 failed (0.21 s).GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88).
AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:24:07Z.
VERIFY-2538-D3D12— verified head243e536bd8merged cleanly withmainc7f5330e0on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88), synthetic descriptor test inputs only.Red (
mainc7f5330e0) -> Green (c7f5330e0+243e536bd8)main:LEONIDA_STRUCTURED_BYTES=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib descriptor::host::tests:: -- --test-threads=1-> FAILED (45 passed; 1 failed; 1 ignored:descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytespanicked atd3d12/crates/leonida-gpu/src/descriptor/host.rs:6457withassertion 'left != right' failed: its buffer's copywheneverstartlands on one of the 15 non-64-KiB-aligned 4 KiB pages inside a loose 64 KiB host window, so(start % 65536 + 456) % 456 != 0).LEONIDA_STRUCTURED_BYTES=0 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib descriptor::host::tests:: -- --test-threads=1-> 46 passed; 0 failed; 1 ignored (0.85s).LEONIDA_STRUCTURED_BYTES=0andLEONIDA_STRUCTURED_BYTES=1isolated runs (--exact --test-threads=1) -> 1 passed; 0 failed in both modes.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:20:43Z.
Red/green: On main the views_off_their_elements test fails because its placed views have no shared backing buffer, and with the PR cargo test -p leonida-gpu --lib -- views_off_their_elements passes (2 OK) 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:34Z.
Verified by OreoFR
54d27d988+ PR head243e536bd; green run in a merge package of 5 PRs, no new ctest failure vs maincargo test -p leonida-gpu --lib --locked -- views_off_their_elementsAI-assisted (Claude Code, Claude Opus 5.5).