runtime: guard memory SRV wrapper allocation failures #2719
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2727"
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 R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-26T04:09:37Z.
AI-assisted backport patch from x2w-microlift.
Refs #2656. The two memory-SRV resource helpers now check the nullable wrapper allocation result before initializing wrapper metadata. Existing callers already refuse a missing resource; successful resource/backing ownership is unchanged. No other behavior is changed.
Verified at
1d04e4d1d8e3c340383d4d56ee4cc4b99bd93d58on upstream base2215c26d3019299764ba1b3149fcf6e2ee403916, macOS ARM64 with Homebrew Clang 23.1.6 and MinGW Windows-target headers:Exit 0; two pre-existing warnings. Windows D3D12 runtime tests were not run on this host. No game inputs.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T04:21:17Z.
Review: COMMENTED
Review of head
1d04e4d1against current main (comment only).Code: correct and minimal.
wrap()can return nullptr (fixture hookwraps_to_fail, and_aligned_mallocfailure), and both new guards sit right before the first dereference (unplaced_memory_buffer,publish_tiled_texture). Every caller already treats a null result as "unavailable" and refuses the SRV (d3d12_memory_srv.inllines ~687, 705, 734, 748), so no new contract. The native resource is held by a ComPtr in the first helper, so the early return does not leak.Gap: no test guards the change.
tests/startup_wrap_allocation.cppalready armsx2w_d3d12_fail_wrapsper slot, but it does not call the memory-SRV slot (buffer and tiled-texture paths), so reverting both lines would still pass. Please add one armed call for each of the two helpers (expect the refusal, no crash) to that existing fixture, so a mutation removing the guards fails it.Not exercised on a game; this only reviews code. No runtime result is claimed.
Commands run locally:
git diff --stat origin/main...HEAD(1 file, +2)git diff --check origin/main...HEAD(clean)python3 tests/docs_links_check.py(ok)python3 tests/bidi_controls_check.py(ok)rgover callers of both helpers and overwraps_to_failusersNot merged: waiting for the test above.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T04:33:05Z.
Review: APPROVED
I added focused coverage using the existing wrapper-failure hook. The unplaced buffer and new tiled texture each preserve the previous 32-byte descriptor on failure, then publish successfully on retry. Windows Release: cmake --build --preset release --target startup_stream_consumer; ctest --preset release --no-tests=error -j 1 -R "^startup_address_(buffer_srv|single_element)_(warp|hardware)$" -V passed 4/4 on WARP and RTX 4060 Laptop, with no skips. The caller refusals remain in place and the retries match their usual GPU pixel readbacks.
Imported from R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-26T04:21:56Z.
Thanks, agreed on extending the existing allocation-refusal fixture for both paths. I will add source-built checks for the expected refusal/normal retry contract; no game run is needed.
Imported from R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-26T04:32:27Z.
Thanks for adding the source-built fixture in
b630c8bc96. I will not duplicate your change; waiting for the exact new-head CI results.