gpu: defer CreateCommittedResource for read-only slot 133 textures #2765
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2773"
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 triggered02 on 2026-11-26T07:38:00Z.
Adds opt-in lazy desktop materialization (
X2W_D3D12_LAZY_TEXTURES=1) for read-onlyslot 133textures (!(Flags & (ALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS))). Fixes #2764. Refs #2379, #1199.What changed
src/startup_stubs/d3d12_xs_device.cpp:X2W_D3D12_LAZY_TEXTURES=1,device_place_resource_x(slot 133) defersCreateCommittedResourceandx2w_budget::committedfor read-only 2D/3D textures by wrappingnullptr(lazy_slot133_texture = true), recording the sanitizedD3D12_RESOURCE_DESC, format, andtitle_memory, and preservingnote_resourceandretire_set_classeligibility.view_slot<18>records tracked SRV views (note_view, keeping#2379design Bretire_view_refsintact) and creates a valid null placeholder SRV (null_srv_desc) whilereal == nullptr.view_slot<19..21>andforward_slot<resource_kind, 12/13/14>materialize first if needed.materialize_lazy_texture(Wrapper*)materializes idempotently viaCreateCommittedResource(D3D12_HEAP_TYPE_DEFAULT), chargesx2w_budget::committed, checksretired_refsunderretire_lock, publishesw->own().real, releaseslazy_texture_mutex, snapshots{heap_wrapper, slot_index, record_id}undernote_lockShared, and re-acquiresnote_lockShared to revalidate heap lifetime inheap_infos(),h.shadow[slot_index] == record_id, andvr.resource == wwhile callingCreateShaderResourceView(blocking concurrentnote_viewoverwrites andretire_drop_heap_viewsheap retirement).retire_unmaterialized_lazy_texturecleans up untouched lazy side records andresource_address_index()entries at final guestRelease()without allocating or leaking VRAM.x2w_d3d12_lazy_texture_count()andx2w_d3d12_set_lazy_refresh_hook()for fixture verification.src/startup_stubs/d3d12_compute_dispatch.inl: addsretire_hold(self, view.wrapper)for sampled texture inputs indispatch_translatedso in-flight compute submissions keep released textures alive behind their fence.src/startup_stubs/d3d12_capture.inl,src/startup_stubs/d3d12_memory_srv.inl,src/startup_stubs/list_copy.inl,src/startup_stubs/list_copy_texture.inl: materialize on sampled/copy/subresource-copy endpoints and capture/recordlazy_view_created/lazy_texture_desc.tests/startup_slot133_lazy_textures_check.cpp&tests/cmake/startup_slot133_lazy_textures.cmake: WARP + hardware CTests (_debug0,_debug1,noretire,off) covering0/0budget & ~20-40 KiBPagefileUsagedelta vs ~16.2 MiBeager, selective materialization, prepare/overwrite/resume SRV refresh & retired-heap safety (4b), the#2764order (copy SRV -> overwrite -> last guest Release() -> fresh-list dispatch_translated through still-live descriptor -> in-flight overwrite behind fence -> open gate -> verify distinct nonzero texel & clean retirement) (4c), andoffcontrol.docs/startup-runtime.md,docs/experiments.md: documentedX2W_D3D12_LAZY_TEXTURES=1, lock order, revalidated SRV refresh,dispatch_translatedretire_hold, and retirement.Verified on the current head (
a70fa1db)Continuous integration, all jobs green on this head:
Local cross-compile check (Linux host, clang-cl 19 + an xwin SDK splat, Release):
startup_resource_retire_*andstartup_view_census_*now run in theprpreset and pass, so theCI coverage this PR needed is in place.
startup_slot133_lazy_textures_*is deliberately out ofthe
prpreset for now (see "Since the review"); its build target is wired, so restoring the testsis a one-line filter change.
Earlier "Verified (
92db6d4e)" numbers and fail-first mutants are no longer quoted here: they weremeasured before the review fixes and before the merge with
main, so they say nothing about thishead. The mutants themselves were temporary and reverted.
Since the review
#2902UAV checks still namedresource_desc, which thisbranch renamed; they now use
resource_desc_for_check.view_slotno longer reads a description fromargs[0]for every slot. TheGetDesc()is guarded to slots 18–21, so slots 17 and 22 stop reading a description as aresource, with the switch off as well.
published now writes the real view into the destination instead of keeping the native null
descriptor; the fixture copies the descriptor mid-publication and checks it samples the texture's
own seed texel.
startup_resource_retire_titleDebug/Release re-runs need a Windows host. I am not claiming they pass.
!tiled_address_srvretire-hold carve-out should not apply to lazy textures, and answered it myself: it should, and
the carve-out is not this fixture's problem — commit
2130dcecrecords the premise, and a lazytexture never carries
tiled_address_srv(d3d12_xs_device.cpp:7145). No retire-semanticschange is needed here.
NOT established
_debug1cases were skipped (77) without D3D12 SDK Layers on the earlier host; not re-checkedon this head.
startup_slot133_lazy_textures_*WARP cases are not run in CI yet. On the last run thatdid execute them they failed with
dispatch_translated did not materialize released tex_rel (retained=0, expected=1); the leading candidate is the dispatch being refused before binding(the placed-buffer alias refusal), which needs a WARP run to confirm. That is why they are out of
the
prpreset rather than the assertion being edited.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T07:53:24Z.
Review: CHANGES_REQUESTED
Independent Windows Release ran all 8 existing lazy texture CTests on WARP and RTX 4060 Laptop, including both debug1 variants. Those pass, but the new refresh path needs two additional checks before merge.
These are descriptor correctness checks; the commit savings are separately measurable.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T07:38:08Z.
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
We couldn’t complete this review. Comment
@codex reviewto try again.3cdc4abℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T07:38:10Z.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T07:43:20Z.
Win2025 WARP receipt for head
3cdc4ab6.--preset dev):ctest -R 'startup_slot133_lazy_textures_(warp|noretire_warp|off_warp)'ran 4 tests: 3 passed (warp_debug0,noretire_warp,off_warp), 1 skipped (warp_debug1, exit 77, no debug layer on the VM). 0 failed.--preset release): same 4 tests, same result (3 passed, 1 skipped).startup_slot133_lazy_textures_check, so I reran with--targets startup_slot133_lazy_textures_check.*_hardwarevariants were not run (WARP-only VM).Review of this head (code + fixture tests only):
X2W_D3D12_LAZY_TEXTURES=1), default path unchanged; theoffcontrol test passes.lazy_texture_count == 0).git diff --check,tests/docs_links_check.py,tests/bidi_controls_check.pyall clean.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T08:20:57Z.
Addressed both points of R0Y00's review at
92db6d4e(rebased ontomain624f5927):src/startup_stubs/d3d12_xs_device.cppmaterialize_lazy_texture):lazy_texture_mutexright after publishingw->own().real,mark_packed_stand_in, andbudget.{heap_wrapper, slot_index, record_id}undernote_lockShared, then re-acquiresnote_lockShared around revalidating thatheap_wrapperis still live inheap_infos(),h.shadow[slot_index] == record_id, andvr.slot == 18 && vr.resource == w, and callingCreateShaderResourceViewwhile holdingnote_lockShared (blocking concurrentnote_viewoverwrites andretire_drop_heap_viewsheap destruction, which both takenote_lockExclusive).x2w_d3d12_set_lazy_refresh_hookand added Step4bintests/startup_slot133_lazy_textures_check.cpp: snapshotstex_race(seed 12) invis_heap[3]anddoomed_heap, pauses before publication, overwritesvis_heap[3]withtex_rep(seed 19) and destroysdoomed_heap, then resumes — verifyingvis_heap[3]still samplestex_rep(seed 19) anddoomed_heapis untouched.#2764order (copy SRV -> last guest Release() -> fresh-list first use through still-live descriptor) +dispatch_translatedretire_hold:if (view.wrapper && !view.wrapper->own().tiled_address_srv) retire_hold(self, view.wrapper);todispatch_translatedinsrc/startup_stubs/d3d12_compute_dispatch.inlso in-flight compute dispatches keep released textures alive behind their queue fence.4cintests/startup_slot133_lazy_textures_check.cpp: creates lazytex_rel(seed 11) ->slot 18SRV ->CopyDescriptorsSimpleintovis_heap[4]-> overwrites the originalcpu_heapslot -> calls last guestRelease()while still unmaterialized (verified0extra textures committed) -> executesdispatch_translatedon a fresh guest command list throughvis_heap[4]behind a gated fence -> overwritesvis_heap[4]and resets the list while in flight -> opens the fence -> verifiesuav_memmatchesseed 11's distinct nonzerotexel(0,0)and retires cleanly to0(retire_on).list_set_descriptor_heaps,list_table,list_compute_table,list_copy*,list_resolve_subresource,forward_slot,draw_translated, anddispatch_translated: nativelist_draw/list_dispatchnever bind guest descriptor heaps/tables (refused/unforwarded); all copy/resolve/subresource/translated paths reachmaterialize_lazy_texture.Verified on
92db6d4e(devpreset):ctest --preset dev --no-tests=error -R '^(startup_slot133_lazy_textures|startup_resource_retire(_title|_views|_reasons)?_|startup_resource_budget)' --output-on-failure: 42 tests: 30 passed (100% of runnable), 0 failed, 12 skipped (*_debug1: SDK Layers not installed).tests/docs_links_check.py: 23 Markdown files, 541 links;tests/bidi_controls_check.py: 2018 files clean;git diff --check: clean.target_heap->shadow[item.slot_index] != item.record_idrevalidation: failsFAIL: vis_heap[3] overwritten mid-refresh texel(0,0)[0]=0.89020 expected=0.35294.retire_hold(self, view.wrapper)indispatch_translated: failsFAIL: tex_rel retired while dispatch_translated submission was still in flight.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T09:19:56Z.
I reran the unmodified
92db6d4efixture and adjacent descriptor-retirement cases: 16/16 each in MSVC Debug and Release, including the overwrite/heap-destruction and first-use-after-final-Release controls.One descriptor-copy ordering still produces a null SRV. In the existing 4b refresh hook, also call guest slot 24 to copy the lazy texture's original CPU descriptor (the same
cpu_heap[tex_count]feeding the existing three heaps) to unused shader-visible slot 6. This is after the refresh snapshot and before it publishes the real descriptor. Once the original materialization and guest copy finish, sample slot 6 with the fixture's native GPU probe. Both WARP and RTX 4060 Laptop returned (0,0,0,0), while immediately copying the now-refreshed CPU slot to the same destination and sampling returned the full seed-12 texel. Windows 11 26200, debug enabled, same candidate DLL, fixture-only addition.The destination gets the logical view record but copies the native null descriptor, and the snapshot never included it. Please make a copy during publication carry the real view (or wait for the source's publication safely) and keep this as a deterministic control. The current live-slot revalidation still needs to stay in place for the overwrite/heap-destruction cases.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:26:38Z.
Review: COMMENTED
Win2025 check of the resource retire tests on this head (
92db6d4eb):startup_resource_retire_title_*andstartup_resource_retire_views_*pass (14/14).startup_resource_retire_titletests end in SEGFAULT:title_warp_debug0,title_off_warp,title_hardware_debug0,title_off_hardware. Thestartup_resource_retire_viewstests pass.main(8c9f168f4) the same 14 tests pass in dev and release, so the crash is specific to this head in the release build.A possible fix: commit
5ad90a328("a guest descriptor copy made during a lazy texture's publication carries the real view") on the branchtedin7:fix-2773. Only that one commit is relevant; the rest of that branch is unrelated and should not be merged. On a build that includes it, the 14 retire tests pass in dev and release. You are welcome to cherry-pick it onto this branch, or tell us if you would rather we open it as a small PR against this branch.Commands (Windows Server 2025, WARP,
devandreleasepresets): build thestartup_resource_retire_titleandstartup_resource_retire_viewstargets, thenctest --preset <preset> -R '^startup_resource_retire_(title|views)'. CTest prints only SEGFAULT, no stack yet.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T10:30:30Z.
Independent startup A/B of
X2W_D3D12_LAZY_TEXTURESon head7986f2ad, for evidence.Build note: at
7986f2ad,view_slotno longer declaresresource_desc(it is nowresource_desc_for_check), but the two UAV checks from #2902 (f5204690) still use it, so MSVC stops with C2065 at both lines. That is probably the failing Windows CI job. Locally I changed those two uses toresource_desc_for_check:Setup: release build of
maine446b072+ this PR (with the fix above) + #3028. Windows 10 22H2 (19045), i7-4790K, 16 GB RAM, RTX 3080 Ti (NVIDIA 32.0.16.1047). Startup run of the main executable (#870): warm shader cache, scripted input, 250 s.X2W_D3D12_RING_RELEASE_AT_SUBMIT=1,X2W_D3D12_TABLE_ALIAS=1andX2W_D3D12_ROOT_SRV_AT_DRAW=1were set in every run. One build; onlyX2W_D3D12_LAZY_TEXTURESdiffers. Two pairs, the second in reverse order (off, on, on, off). Aggregates only.buffer/token/wrapper0x00000000(1920x1080 and 3840x2160 textures, format 61, one mip). Null-binding counts are about the same in both arms. The end screenshots show the same frame in one run of each arm and are black in the other (screenshot timing).Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:37:47Z.
I tried merging
main(86beae95) into this branch to clear the conflict, but I haven't pushed it. The merge builds, but it breaks 12 tests that pass onmain.What the merge needs.
src/startup_stubs/d3d12_compute_dispatch.inlhas one textual conflict. Since #3223,mainstores the SRV description in a union, so this branch's call becomesview.described ? &view.desc.srv : nullptrfollowed by itsretire_hold(self, view.wrapper).src/startup_stubs/d3d12_xs_device.cpphas no textual conflict, but it stops with C2065 at the two UAV range checks from #2902. lukaslw-lab noted the same thing on7986f2ad. Those checks useresource_desc, which this branch renamed toresource_desc_for_checkinview_slot. With that rename, the merge builds indevandrelease.What then fails. I ran
ctest --test-dir out/build/dev --no-tests=error -j 6 -E '(_hardware$|startup_audio_)', then reran each failure alone with-j 1. All 12 pass onmain86beae95in the same tree:startup_view_census{,_off,_vary}_warp,startup_view_alloc_{records,materialized,ids}{,_control}_warpandstartup_title_heap_device_warpcrash (SEGFAULT). It happens straight after the firstCreateDescriptorHeap, at the first view creation.startup_sampler_heap_wrapped_warpfails atcreate_sampler(device, desc, src + 16 * slot, 0, 0)withOSError: exception: access violation reading 0x0000000100000050.startup_frame_copy_warpfails afterCreateDescriptorHeap type=0 count=1 flags=0x1.This branch's own tests pass on the merge:
startup_slot133_*andstartup_compute_dispatch_*, 21 of 21 inrelease(thenative_warpone skips), and 7 of 7 hardware variants in each preset.The crashes look like this branch's
view_slotand lazy-record changes clashing withmain's view allocation and census code. The fix isn't obvious from the merge, so I've left it to you. R0Y00's earlier request on92db6d4ealso still needs an answer.Environment: AMD Ryzen 7 9800X3D, NVIDIA GeForce RTX 5090 driver 32.0.16.1088, WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.
This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:56:13Z.
Thanks for this, and for addressing both points of the first review in
92db6d4e. I reviewed head7986f2adagainst currentmain(c3204a9c, 266 commits ahead;git merge-treeexits 1 with one conflicting hunk ind3d12_compute_dispatch.inl). The only change since92db6d4eis a merge ofmain. Four things need fixing before this can land:resource_desc, which this PR renamed inview_slot. The Windows CI job fails on exactly those lines:_xs_device.cpp(4956): error C2065: 'resource_desc'(also at 4962). Usingresource_desc_for_checkthere, as lukaslw-lab and pigalot did, would fix it.view_slotcallsGetDesc()onargs[0]for every slot. The line(args[0] ? reinterpret_cast<ID3D12Resource*>(args[0])->GetDesc() : D3D12_RESOURCE_DESC{})runs for slot 17 (CreateConstantBufferView) and slot 22 (CreateSampler) as well, whereargs[0]is the description and not a resource.mainguards this withif (N >= 18 && N <= 21 && args[0]). This would explain pigalot's crash:startup_sampler_heap_check.pypacks'<4If2I6f', 0, 1, ..., so the first qword is0x0000000100000000, andGetDescsits at vtable +0x50, which gives the reportedaccess violation reading 0x0000000100000050. The line is already in92db6d4e, so this is not a merge problem. Computing the description only for N 18–21, then runningstartup_sampler_heap_wrapped_warpandstartup_view_census*_warp, would confirm it. I derived this from source and didn't run it.grep -ci 'mid-publication' tests/startup_slot133_lazy_textures_check.cppgives 0 on the head, and tedin7's5ad90a32isn't on the branch (git merge-base --is-ancestor 5ad90a32 7986f2adexits 1).startup_resource_retire_titlehaven't been answered (title_warp_debug0,title_off_warp,title_hardware_debug0,title_off_hardware; they pass onmain). They need a re-run on the new head in both Debug and Release.Non-blocking:
doomed_heap) andretire_unmaterialized_lazy_texturehave no listed mutant.92db6d4e)" block predates the merge, so nothing has been verified on7986f2adyet. The CIprpreset filter also matches none ofslot133,resource_retireorview_census, so CI wouldn't run these tests even once the build passes.Environment: Linux, static review,
git merge-treeand the CI job log only. I did no build, WARP or GPU run.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:11:01Z.
The head is still
7986f2ad, so the four points from my 11-28 comment are still open. I haven't re-reviewed it in depth. Two things have changed since then:main(c04e0dd6),git merge-tree --write-tree c04e0dd6 7986f2adexits 1 with conflicts in four files:docs/startup-runtime.md,src/startup_stubs/d3d12_compute_dispatch.inl,src/startup_stubs/d3d12_xs_device.cppandsrc/startup_stubs/list_copy.inl. Last time it was one hunk. Could you rebase (or mergemain) and fix the four points in the same push?X2W_D3D12_LAZY_TEXTURES. Inview_slot,resource_desc_for_checkis computed asis_unmaterialized_lazy ? lazy_rec.desc : (args[0] ? ...->GetDesc() : D3D12_RESOURCE_DESC{}), with no slot check and no switch check. Onlylazy_wrapperis limited toN >= 18 && N <= 21. So every CreateConstantBufferView (slot 17) and CreateSampler (slot 22) would callGetDesc()on a description pointer, with the switch off as well. That is the default path every title run takes, not only lazy-texture runs. Limiting the description to slots 18–21, asmaindoes, would fix it.Environment: Linux only: git objects and
git merge-tree. I did no build, WARP or GPU run.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T17:59:09Z.
Rebased onto current
main(158ef794) and fixed three of the four points in0ceac44b.Merge. Four conflicted files resolved by hand:
docs/startup-runtime.md(kept both the lazy-slot-133 and inline-descriptor sections),d3d12_compute_dispatch.inl(main'sview.desc.srvplus this branch'sretire_hold),d3d12_xs_device.cpp(this branch's lazy texture state alongside main'sIndirectCopyTracker; main's trace call kept, this branch'srealnull check kept),list_copy.inl(this branch'scopy_endpoint(..., false)plus main's trace calls).Point 1 — head compiles. The #2902 UAV checks still named
resource_desc; they now useresource_desc_for_check. Verified:d3d12_xs_shimbuilds, 15.8 MBd3d12_xs.dll, zero errors.Point 2 —
view_slotreads a description only for slots 18–21.c0ceac44bguards theGetDesc()withN >= 18 && N <= 21 && args[0], so slots 17 and 22 no longer read a description as a resource, with the switch off as well.Point 3 — guest-descriptor-copy control. Ported tedin7's
5ad90a32behaviour (their commit is not on this branch and does not apply cleanly, so it is re-implemented here):lazy_publishing/lazy_published_totalcounters,create_lazy_srvextracted from the inline refresh,refresh_copied_lazy_viewscalled fromcopy_descriptor_runwhen a copy overlapped a publication, and aPublishScopearound materialization. Fixture: the race hook now copies the descriptor mid-publication intovis_heap[6]and the case checks it samples the texture's own seed-12 texel;grep -ci mid-publication tests/startup_slot133_lazy_textures_check.cppis 2.Point 4 — not answered, and I cannot answer it here. This host is Linux and has no Windows, D3D12, WARP or GPU runner, so
startup_resource_retire_titlecannot be run in Debug or Release. Someone with a Windows machine needs to re-run those four cases on0ceac44b; I am not claiming they pass.Scope of what I verified: a static Linux build of
d3d12_xs_shimand the source-level checks above. No Windows build, no WARP, no GPU run, and the fixture was not executed. Other shim targets (xapu) do not link on this host because the xwin SDK splat has no MSVC math library; that is a local toolchain gap unrelated to this change.Also still open from your note: the CI
prpreset filter matches none ofslot133,resource_retireorview_census, so these fixtures would not run even once the build passes. Happy to add them to the filter here or in a follow-up if you prefer.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T18:30:49Z.
Added the CI coverage you flagged, in
fb6225af.The
prpreset filter matched none of the fixtures this branch adds, so they would never have run even with a green build. The warp variants are now in the filter:The
_hardwarevariants stay out of theprpreset, as the other hardware fixtures do.Checked locally, Linux only: the merged regex compiles, matches all ten warp names, and does not match the hardware variants, unrelated names, or suffixed names.
tests/bidi_controls_check.pypasses (2879 tracked files, no bidirectional controls) andgit diff --checkis clean. No Windows or GPU run.Head is now
fb6225af. Point 4 from your review (thestartup_resource_retire_titleDebug/Release re-runs) is still unanswered — that needs a Windows host and I have none here, so I am not claiming it.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T18:44:59Z.
My previous push (
fb6225af) broke the Windows job — thanks to CI for catching it, and apologies for the noise. Fixed indeb7d080.What went wrong: adding the tests to the
prtest filter was only half the job. Theprbuild preset builds an explicit target list, so those tests were selected but their executables were never built, and ctest reported all seven asNot Run:There was a second, quieter mistake: my
view_censusalternatives were spelledstartup_view_census_warp_(on|off|vary), but the tests are actually namedstartup_view_census_{backend},startup_view_census_off_{backend}andstartup_view_census_vary_{backend}— so that pattern matched nothing at all.deb7d080:startup_slot133_lazy_textures_check,startup_resource_retire,startup_resource_retire_viewsandstartup_view_censusto theprbuild targets.view_censusnames tostartup_view_census_(warp|off_warp|vary_warp).startup_resource_retire_warp_debug[01]fixtures, which use thestartup_resource_retiretarget just added.Checked here (Linux only, no Windows run): the merged filter compiles, matches all twelve expected warp names, and matches none of the hardware variants, the reversed-order spelling or suffixed names. Every added target has an
add_executableinCMakeLists.txtortests/cmake/. The Windows job ondeb7d080is the real check and I am not claiming it passes until it does.Point 4 from your review is still open — it needs a Windows host for the
startup_resource_retire_titleDebug/Release runs.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T19:00:25Z.
Progress and a real finding from
deb7d080, plus a scoping change ina70fa1db.The build-target fix worked. Windows went from 7
Not Runfailures to 3 real failures:startup_resource_retire_*,startup_view_census_*andstartup_resource_retire_off_warpall pass now, so adding them to the preset is worth keeping.What the failure looks like from here. The fixture dispatches after the final guest
Release()and expects the dispatch's retire hold to keeptex_relalive (retained+1). It gets 0. Currentmainmoved that hold tod3d12_compute_dispatch.inl:1163:with the comment "An input of a tiled address SRV is a separate texture outside the class." That deliberately skips the hold for an address-only SRV input, which is the binding this fixture uses. The fixture was written before that landed, so either the fixture's expectation is now wrong or that carve-out should not apply to a lazy texture — I cannot tell which without executing it, and this host has no Windows, WARP or GPU. I am not going to edit the assertion to match code I cannot run; that is how a real regression gets hidden.
a70fa1dbtherefore takes the three slot133 tests back out of theprpreset and leaves a comment explaining why. Thestartup_slot133_lazy_textures_checkbuild target stays, so putting them back later is a one-line filter change. No test was modified or deleted, and both PRs of this branch still build.What I need from you: whether a lazy (address-only) SRV input should hold across a dispatch. If yes, the carve-out at
:1163needs an exception for lazy textures and I will write it. If no, the fixture's expectation moves to the output/UAV case and I will rewrite that step. Either way this is your call, not mine to guess.Still open: point 4 (
startup_resource_retire_titleDebug/Release re-runs) needs a Windows host.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T19:15:26Z.
CI is fully green on
a70fa1db— closing the loop on my earlier "not claiming it passes until it does":So the review points 1–3 hold on Windows too, and
startup_resource_retire_*/startup_view_census_*now run in theprpreset and pass.Two things are still yours to decide:
d3d12_memory_srv.inl:580:sampled_address_texture()tests the lazy flag beforetiled_address_srv, and returns the wrapper's own materialized resource for a lazy texture rather than the separatesampled.desktop. That reading says the carve-out atd3d12_compute_dispatch.inl:1163is right for tiled address SRVs but should not apply to lazy ones — i.e. the fixture is right and the code needs the exception. I have that one-line change ready but have not pushed it, because it needs a WARP run I cannot do here.startup_resource_retire_titleDebug/Release re-runs still need a Windows host.The three
startup_slot133_lazy_textures_*tests stay out of theprpreset until (1) is settled; the build target is already there, so restoring them is one line.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T21:40:09Z.
Correction to my own analysis from earlier tonight, before anyone acts on it.
I had argued in comment 7322488779 that the carve-out at
d3d12_compute_dispatch.inl:1163is right for tiled address SRVs but wrong for lazy textures, and that the fixture was therefore right. Checking the tree properly instead of trusting that reasoning:!tiled_address_srvguard is at three independent sites:d3d12_compute_dispatch.inl:1163(main's dispatch),:1621(this branch's older path) andd3d12_draw.inl:3758(the draw path, which this PR does not touch). Three sites agreeing makes it an established rule rather than an oversight, and my "the carve-out forgot lazy textures" story loses most of its force.tiled_address_srvis only set ind3d12_memory_srv.inl:573, inside the tiled-publish path. A lazy slot133 texture need not enter that path at all. If a lazy wrapper never carries the flag, the guard passes,retire_holdis called, andretained=0has to come from somewhere else — most plausibly the dispatch being refused earlier (the placed-buffer alias refusal that fires 11,648 times in package runs), in which case no hold is taken and the fixture fails for an unrelated reason.So there are two candidate causes and I cannot separate them without running
startup_slot133_lazy_textures_checkunder WARP, which this host cannot do. I am not applying the one-line patch I had prepared, because if the second cause is the real one, that patch would change retire semantics on a wrong diagnosis — the worst possible outcome for a correctness fix.The question to settle is still the same one from comment 7321984149: should an address-only SRV input hold a released lazy texture across a dispatch? If you say yes, I will write it deliberately and note that the three existing sites then disagree with each other. If the answer is that the fixture's expectation is stale, I will move the case to the output/UAV binding instead.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T21:56:17Z.
I can close my own question from comments 7321984149 and 7326607795, and the answer is that no code change is needed for the carve-out. This supersedes both.
git log -S "output || !wrapper->own().tiled_address_srv"finds the guard introduced by2130dcec(lukaslw-lab, #3429 review). Its message states the premise: "An input of a tiled address SRV is a separate texture outside the class."d3d12_xs_device.cpp:7145setstitle_memory,lazy_slot133_textureandretire_set_class, and does not settiled_address_srvanywhere.(output || !wrapper->own().tiled_address_srv)is true,retire_holdis called, and the carve-out cannot be the reason the fixture seesretained=0.I was wrong in 7322488779 when I said the carve-out should not apply to lazy textures, and I am glad I did not push the one-line patch I had prepared. Nothing about retire semantics needs changing for this PR.
What is left unexplained is only why the fixture still observes 0, and the leading candidate is that its dispatch is refused before binding — the placed-buffer alias refusal that appears 11,648 times in package runs. That needs
startup_slot133_lazy_textures_checkrun under WARP to confirm, which this host cannot do. So the fixture stays out of theprpreset and point 4 still needs a Windows host; I am not claiming either.I will stop commenting on this PR now unless you reply — the open items are yours and I have nothing further I can verify from Linux.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T22:29:53Z.
I can now reproduce the failing case locally, which should save a Windows CI round trip.
Repro (Linux host, cross-compiled, Wine + vkd3d-proton — not WARP, but the failure is identical):
Result, deterministic over two runs (exit 5):
And the cause is visible in the stand-in's own log, just before the assertion:
So the dispatch is refused before it binds anything, which is why no retire hold is taken and
retainedstays 0. The!tiled_address_srvcarve-out is not involved — consistent with what I withdrew in comment 7327034998.That refusal comes from
d3d12_compute_dispatch.inl:358: the compute manifest is present but unmarked and has no sibling<key>.cs.hlsl. The fixture deliberately starts from a fresh cache (temp_directory_path()/x2w-lazytex-cache-<pid>, removed and recreated at the start), so nothing in that directory can carry a revision, and no step in the test translatesc95980e7e8bace4dfirst.So the fixture appears to depend on a translated compute program that nothing provides, which would make the last part of case
4cfail regardless of platform. Two ways out, and it is your call which:I have not changed the test to make it pass — that would be exactly the "edit the assertion until green" move your review warned about. The tests stay out of the
prpreset and this stays unexplained on my side.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T22:35:58Z.
One addendum to the two options in 7327938996 — I checked the code path, and it makes option 2 unnecessary while making option 1 the right fix. Short version: the fixture is asserting a hold from a dispatch that is correctly refused, so the test needs a program that actually translates.
What the code does:
d3d12_compute_dispatch.inlreturnsreasonat:1601and only then reaches the bind loop, whose hold is at:1621. So a dispatch refused for an untranslated program takes no retire hold — and that is correct, not a bug: nothing is bound and nothing is read, so there is nothing to keep alive. Moving the hold before the translation check would retain textures for dispatches that never touch them, which is the opposite of what the switch is for.So option 2 from my previous comment should be dropped, and the remedy is on the test side: give case
4ca compute program that translates — pre-seeded with a manifest carrying the current revision, or translated as part of the fixture — so that the dispatch reaches binding and the hold is genuinely exercised. As it stands the fresh empty cache means the program can never translate, soretainedcannot become 1 and the assertion cannot pass on WARP, hardware or Wine alike.That is where I stop: I am not going to rewrite the fixture around a translated-program dependency on a guess about how you want that seeded. If you tell me which seeding you prefer, it is a small change and I will do it.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T22:44:03Z.
Ran the whole
startup_slot133_lazy_textures_checkmatrix under Wine + vkd3d-proton, so you can see which failures are the untranslated-program problem and which are just this host. All withX2W_D3D12_BUDGET=1 X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_RESOURCE_INDEX_CHECK=1 X2W_D3D12_DEBUG=0, adapterNVIDIA GeForce GTX 1660 SUPER,debug_layer=off.warpLAZY_TEXTURES=1 RELEASE_RETIRED=1dispatch_translated did not materialize released tex_rel (retained=0, expected=1)warp no-retireLAZY_TEXTURES=1… (retained=2, expected=3)warp offRELEASE_RETIRED=1, lazy unsetcontrol WARP PagefileUsage delta=159744 expected >= 12 MiBTwo distinct causes, and neither is retire semantics:
retainedis short by one in both (0/1and2/3), so every other hold in the case is taken. That is the refused dispatch from comment 7327938996: the program never translates from a fresh cache, so the bind loop is never reached.offcontrol fails onPagefileUsage, not on any texture or retire assertion. Under Wine the delta is ~156 KiB where Windows reports ≥12 MiB, so that control measures a Windows-only accounting value. I would treat this as an environment limitation of running the fixture under Wine, not as a defect in the control.So under Wine, case
4cand theoffcontrol are both unachievable for reasons unrelated to this PR's logic — which also means a Wine run cannot substitute for the Windows result on point 4.Still not editing the fixture. The remaining question is the same narrow one from 7328077500: how do you want
4c's compute program seeded with a translated manifest?Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T13:16:07Z.
The Windows job failed in 2m14s on run 47091491645 — my fault, and it never reached a test:
My merge resolution added the new cases to the
prtest filter as nested groups, which took it to 32 parenthesised subexpressions. CTest's engine refuses that many, so CTest could not compile the filter at all and reported no tests.Fixed in
9657e2a1: the cases are spelled out as plain alternatives (startup_view_census_warp|startup_view_census_off_warp|...), which needs no extra parentheses, so the filter is back tomain's count of 30. Checked against the registered names — all sevenstartup_view_census_*/startup_resource_retire_*cases match,startup_slot133_lazy_textures_warp_debug0stays out (held back pending the retain-hold decision) and the_hardwarevariants stay out.Worth knowing for anyone else touching that filter: the limit is the engine's, not CMake's, and it fails as "No tests were found" rather than as a filter error.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T15:33:40Z.
@R0Y00 This addresses the one ask still open from your review — "Add the #2764 order of copy SRV, last guest Release, and first use through that still-live descriptor on a fresh list … Native first use must reach a materializer or stay on the eager path."
Why case 4c never reached the materializer. It hand-writes a native publication — a
.txtmanifest plusD3DCompile.cs.cso, deliberately with no Python-translator.cs.hlslsidecar — but its manifest carried nonative <revision>line. The compute gate therefore read it as stale Python output and refused it withnative translation without a revision; rebuild it, so the dispatch never reached the texture and the case failed atdispatch_translated did not materialize released tex_rel (retained=0).Fix (
17119831): the manifest now ends with the samenative <revision>line the runtime writer emits (direct_compute_cache.cpp), taking the number fromnative_compute_output.hso a future revision bump updates the fixture automatically. The.cs.hlslsidecar would have been the wrong seam — it labels Python-translator output, which this is not.Result on WARP, with the case 4c ctest environment:
The materialize line sits between pipeline creation and the translated dispatch, so it comes from the released descriptor
vis_heap[4]used by the dispatch afterRelease(), not from a copy.retainedgoes 0 → 1 at the mid-flight assertion (temporarily instrumented, then reverted) and settles back to 0 when the gate fence opens.warp debug0andwarp no-retirepass. Two variants behave for host reasons, both documented in the fixture's own notes:debug1is a capability skip 77 (D3D12GetDebugInterfaceis unavailable under vkd3d), andoffreturns in its WARP-only PagefileUsage control before case 4c because vkd3d logsEnumWarpAdapter: WARP not supported, returning first hardware adapter.0bc00914puts the fourwarpcases back in theprpreset as flat alternatives (the filter stays at its 30-group CTest limit). That is the other half of whata70fa1dbdeferred; the Windows job is the check for the MSVC/WARP side.Separately,
9657e2a1fixed a CTest filter-parenthesis bug that made the previous Windows job fail before compiling anything, so that run carries no information about this branch.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T15:46:22Z.
Heads up on the two commits I just pushed: this branch had gone DIRTY, and a conflicted PR gets no
pull_requestrun at all — GitHub cannot build the merge ref — which is why the branch appeared to have no CI on0bc00914. Nothing was wrong with the change; the job simply never started.30aa267fmerges currentmainand resolves two conflicts, both additive:src/startup_stubs/d3d12_xs_device.cpp: main's newx2w_d3d12_fixture_wait_mesh57_targetsexport and this branch'sx2w_d3d12_lazy_texture_countsit side by side; no behaviour from either side dropped.CMakePresets.json: rebuilt from main's file and the branch's entries re-appended as flat alternatives (the filter is back at its CTest limit of 30 groups and verified to compile).991b707dre-pins the export catalog, which the merge moved from 87 to 89 entries (35 implemented + 54 unmeasured) — measured by runningtests/standin_exports_check.pyand reading what it reported, not computed. The check now passes:483 cases, 6/6 mutations killed.Build after the merge:
d3d12_xs_shimlinks with clang-cl/xwin once the worktree's staleDXC_EXECUTABLE(a Windowsdxc.exeleft in the build cache) is pointed at the Linux one — worth knowing if a maintainer builds this branch on Linux from an old build directory.Also in this branch now:
17119831seeds case 4c's native revision marker (that is the commit that makes native first use reach the materializer —retained0 → 1 on WARP) and0bc00914puts the fourwarpcases back in theprpreset.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T15:59:40Z.
Green on the merged head:
Build and test on Windowspassed, along with gfx1013 and the Linux Python checks, so the merge resolution and the re-pinned export catalog (89 entries) are both good.That also confirms the earlier diagnosis: the branch had no run at all because a conflicted PR cannot produce a merge ref, so nothing was ever queued. Once
mainwas merged in, CI started within two minutes.Case 4c now demonstrates the ask from your review — native first use reaches the materializer,
retained0 → 1 on WARP — and the fourwarpcases are back in theprpreset.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T16:12:11Z.
Release/O2 retest at
991b707don Windows 11 build 26300: MSVC build of startup_slot133_lazy_textures_check and startup_resource_retire_title, then ctest --test-dir out/build/review-release --no-tests=error -j 1 -V -R '^(startup_slot133_lazy_textures|startup_resource_retire_title)' passed 18/18 on WARP and RTX 4060 Laptop, including debug-layer variants, with no skips. I did not reproduce the prior Release retire crashes. The refresh now revalidates the heap and record under note_lock at publication. The required hosted Windows smoke check is green.After #3937 landed, the current main trial merge has one CMakePresets.json conflict. Please keep the new startup_indirect_translated_argument_snapshot_warp selector alongside the lazy-texture selectors and rerun the focused suite on the refreshed head.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T16:39:12Z.
Merged current
main(4324d81f) into the branch —89adb031. The one conflict wasCMakePresets.json, exactly as you predicted.Resolution. Your
prfilter now ends with the indirect argument snapshot selector; this branch adds twelve names (lazy-texture ×4, view-census ×3, resource-retire ×5). Both sides are flat alternatives in the same filter, so I kept your line and appended the twelve before the closing)$. No group is added, so the parenthesis budget is unchanged: 31(/ 31).Verified that the filter itself is still valid (the failure mode from
9657e2a1):ctest -Nmatches 104 tests and prints noToo many parentheses/No tests were found!!!. Bothstartup_indirect_translated_argument_snapshot_warp(from main) andstartup_slot133_lazy_textures_warp_debug0(from this branch) are registered and matched.Focused suite on the refreshed head, Linux host (clang-cl/xwin build, Wine + vkd3d-proton, GTX 1660 SUPER). I ran the eight selectors this branch owns plus the two indirect-snapshot selectors now in
pr:Neither indirect-snapshot failure is about the merge: both stop at the translated-HLSL compile with
which is
append_mesh_groupsin the fixture's shader string. I re-ran the same mode from a prebuilt binary of an older tree (x2w-3937-fixture, before this branch merged anything) and it fails identically, so this is the Linux DXC build here, not the head. A one-line repro in a standalone.hlslwith-T vs_5_1compiles cleanly on the same dxc, so I do not know why this entry set trips it — I am reporting it as a host limitation, not a property of the change. The hosted Windows job on89adb031is the check for those two, and the merged head's earlier Windows run was green.Two other notes:
tests/standin_exports_check.pystill reports 483 cases, 6/6 mutations killed with the pin at 89 entries, so the merge did not move the catalog; andd3d12_xs_shimlinks on the refreshed head with clang-cl/xwin (the staleDXC_EXECUTABLEin the build cache is the only local wrinkle, as before).Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T16:50:08Z.
The hosted jobs on
89adb031finished green: Build and test on Windows SUCCESS, gfx1013 SUCCESS, Linux Python checks SUCCESS. So the union filter and the merge resolution are confirmed by the Windows side too; the three Linux-only failures I listed above did not reproduce there.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T17:16:20Z.
Review: APPROVED
Re-reviewed
89adb031. The current main merge retains the indirect argument/index and draw controls alongside the four lazy-texture WARP selectors in the PR preset. Rebuilt startup_slot133_lazy_textures_check and startup_resource_retire_title with MSVC Release (/O2) and ran ctest --test-dir out/build/review-release --no-tests=error -j 1 -V -R '^(startup_slot133_lazy_textures|startup_resource_retire_title)'. All 18 passed on WARP and RTX 4060 Laptop on Windows 11 build 26300, including both debug-layer modes, 0 skips. The overwrite/heap-retirement control and the copied-SRV after final release on a fresh native dispatch remain in the source-built fixture. The earlier Release retirement failures did not recur. Hosted required Windows CI passed.