startup: check the title heap allocation that succeeds #1549
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1556"
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 Asimmimx on 2026-11-24T13:53:37Z.
Change
Refs #1149. This extends
startup_title_heap, the check forsrc/startup_stubs/title_heap_memory.h. When a descriptor heap's desktop CPU start is not usable as an address (any CBV/SRV/UAV heap, or a heap whose start is tagged), the wrapper allocates plain memory ofNumDescriptors × incrementbytes. It gives that memory to the executable as the heap's CPU start.No existing test takes the path where this allocation succeeds:
startup_title_heapuses only an allocator that returns 0 and ignores the size it is asked for.startup_title_heap_device_warpcreates no view heap. On WARP the sampler, render-target and depth heaps have aligned starts.startup_view_heap_*andstartup_null_views_*pass memory of their own.d3d12x_descriptor_*_warpget a plain desktop device.So three mutants left all of these passing:
E_OUTOFMEMORY;allocate(1);allocate(bytes / 2).This adds four expectations to the existing
rule(). An allocator that succeeds returns0x20000and records the size it is asked for. Two cases use hand-worked sizes:0x8000bytes;0x1000bytes.Each call must return true, store
0x20000, ask for exactly that size, and advance the allocation count to 2 and then 3.Only
tests/startup_title_heap_check.cpp(+18 lines) and two sentences in the existing title-heap bullet ofdocs/startup-runtime.mdchange. There is no CMake change and no new CTest. The existingstartup_title_heap_tags_controlstill fails as intended.A behaviour I did not pin. WARP's
CreateDescriptorHeapacceptsNumDescriptors = 0for all four heap types; I checked this with a scratch probe that is not committed. Such a heap is therefore reachable from the real caller. When it needs memory and has none of its own,title_heap_memoryskips the allocation and returns false, so the wrapper returnsE_OUTOFMEMORYalthough the desktop call succeeded. Should a zero-count heap be refused, or accepted without memory? I left it untested; tell me which you want and I will add the case.Verification
Commit
309cfede(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to the header alone, rebuilt, and ran the following tests, then reverted. None of this is committed.
startup_title_heapstartup_title_heap_tags_controlstartup_title_heap_device_warpstartup_null_views_warpd3d12x_descriptor_{heap,table,negative}_warpCBV_SRV_UAVclausealignof(int) - 1||→&&in the ruleallocate(1)allocate(bytes / 2)if (bytes)guardreturn title_memory != 0 || !bytesChecklist
AI-assisted (Claude Code).