runtime: guard memory SRV wrapper allocation failures #2727
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2727
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2727/head"
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?
@chadhyatt on GitHub · 2026-11-26 04:09 UTC · original
chadhyatt:backport/memory-srv-wrap-allocation→main· +25 −4 · 3 files · 2 commits · merged 2026-11-26 04:36 UTCAI-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.
@tedin7 on GitHub · 2026-11-26 04:21 UTC · original · reviewed
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.
@chadhyatt on GitHub · 2026-11-26 04:21 UTC · original
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.
@chadhyatt on GitHub · 2026-11-26 04:32 UTC · original
Thanks for adding the source-built fixture in
b630c8bc96. I will not duplicate your change; waiting for the exact new-head CI results.@R0Y00 on GitHub · 2026-11-26 04:33 UTC · original · approved these changes
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.