gpu: defer CreateCommittedResource for untouched read-only slot 133 textures #2764
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#2764
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@triggered02 on GitHub · 2026-11-26 06:46 UTC · original
Problem
In
src/startup_stubs/d3d12_xs_device.cpp(device_place_resource_x, slot 133), every placed texture call immediately callsCreateCommittedResourceonD3D12_HEAP_TYPE_DEFAULT. In heavy startup workloads that create thousands of read-only textures (!(Flags & (ALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS))) ahead of first sampling (textures uploaded 0), those un-sampled textures consume ~4+ GiB of bothLocalVRAM and Windows process/system commit (PagefileUsage/CommitTotal), pushing 16 GiB hosts into commit exhaustion (#1199).Empirical evidence (GTX 1660 SUPER, Windows 11, D3D12 micro-probe)
512 MiB) committedD3D12_HEAP_TYPE_DEFAULT2D textures chargesLocal +512.00 MiB,Pagefile +514.93 MiB,SysCommit +519.47 MiB.ID3D12Device::Evict()dropsLocalto+0.00 MiBbut leavesPagefile +514.93 MiBandSysCommit +519.47 MiBunchanged.D3D12_HEAP_FLAG_CREATE_NOT_RESIDENTlikewise charges+513.01 MiBPagefile/+513.68 MiBSysCommitatCreateHeaptime.wrap(nullptr)lazy-materialization pattern already used bypublish_tiled_texture/sampled_address_texture(src/startup_stubs/d3d12_memory_srv.inl:526-576) keeps VRAM and commit at0until first GPU touch (andCreateReservedResourcewith 0 tiles mapped also keepsLocal +0.00 MiB,SysCommit +0.00 MiB,Pagefile +0.12 MiBonTiledResourcesTier >= 1formats).Proposed solution (opt-in
X2W_D3D12_LAZY_TEXTURES=1)Add an opt-in
X2W_D3D12_LAZY_TEXTURES=1switch (leaving default behavior and existingstartup_resource_budget/startup_resource_retire*contracts untouched):slot 133, for textures withoutALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS, wrapnullptrwith the stored sanitizedD3D12_RESOURCE_DESC, format, andtitle_memory, preservingnote_resourceandretire_set_classeligibility without chargingx2w_budget::committedor callingCreateCommittedResourceyet.view_slot<18>, record the tracked view (note_view, keeping#2379design Bretire_view_refsaccounting intact) and create a null SRV placeholder whenreal == nullptr.CreateCommittedResource(and refresh any bound SRV descriptor) on first actual GPU use (draw_translatedsampling /upload_texture,list_copy_*,WriteToSubresource,Map,view_slot<19..21>).Acceptance
New source-built WARP + hardware CTest
startup_slot133_lazy_textures_{warp,hardware}verifying:X2W_D3D12_LAZY_TEXTURES=1, creatingslot 133read-only textures +slot 18SRVs leavesx2w-budgettextureat0/0and avoids commit growth;Release();X2W_D3D12_LAZY_TEXTURES=0, creation remains eager.Command:
ctest --preset dev --no-tests=error -R '^(startup_slot133_lazy_textures|startup_resource_retire(_title|_views)?_|startup_resource_budget)'NOT established
draw_translatedorlist_copy_*.Refs #2379, #1199.
@R0Y00 on GitHub · 2026-11-26 07:04 UTC · original
The measurements justify a focused lazy-materialization fixture. Please include the descriptor lifetime case from #2379 and #2468 in that first slice: publish an SRV, copy the descriptor, release the guest resource, then bind the copied slot on a fresh list. Its first GPU use must produce a nonzero reference readback and materialize exactly one backing. Use a new list after explicit overwrite as the retirement control. Test one native or non-translated consumer as well, or scope the opt-in to proven consumers and keep the remaining path eager. Report the fixture separately from the #1199 startup memory numbers.