gpu: slot 133 texture replacement for #2773 #3349
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!3349
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3347"
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?
@romn4rch on GitHub · 2026-11-28 11:23 UTC · original
romn4rch:copilot/pr-2773-review-9bab5832→main· +1551 −35 · 10 files · 4 commits · openThis is the replacement review PR for #2773, synchronized with upstream
mainat24fcd0b5742abb2fcaba8066093d70829df956a3. The merge exposed a fixture-only mismatch: current main requires anativecompiler-revision marker on synthetic compute manifests, so the slot-133 fixture now writesx2w::native_compute_output_revision. No slot-133 runtime behavior was changed to accommodate the test.The original PR remains open and overlaps this revision. Please keep only one and mark #2773 as superseded if this replacement is selected; this PR does not close it.
Validation
cmake --build out\build\release --target startup_slot133_lazy_textures_check startup_stream_consumer d3d12_xs_shim— passed in Release.ctest --test-dir out\build\release --no-tests=error -R '^(startup_resource_retire_title_(warp_debug0|off_warp|hardware_debug0|off_hardware)|startup_resource_retire_views_(warp_debug0|keep_warp|noretire_warp)|startup_slot133_lazy_textures_(warp_debug0|hardware_debug0|noretire_warp|off_warp)|startup_view_census_(warp|off_warp|vary_warp)|startup_view_alloc_(records|materialized|ids)(_control)?_warp|startup_title_heap_device_warp)$' --output-on-failure— 21/21 passed, including all slot-133 cases and the reported Release retirement cases.$env:X2W_D3D12_PERMISSIVE='1'; $env:X2W_D3D12_DEBUG='1'; python -B tests\startup_sampler_heap_check.py wrapped out\build\release\d3d12_xs.dll warp— passed; descriptor-token copies matched.$env:X2W_FXC='C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\fxc.exe'; python -B tests\startup_frame_copy_check.py out\build\release\startup_stream_consumer.exe warp— passed; 32 pixels exact, one refresh for changed contents and none for unchanged contents.startup_slot133_lazy_textures_hardware_debug0and both resource-retirement hardware cases passed on NVIDIA GeForce RTX 3050 6GB Laptop GPU, driver32.0.16.2140, Windows 10 Pro 26H2 build26300.10075, debug layer off; tested commit02182842cc3d0c7b5ebaec9c46077d9b6dfe8f23./O2job was skipped.gpu: slot 133 texture review follow-upto gpu: slot 133 texture replacement for #2773@KelboLive on GitHub · 2026-11-28 21:27 UTC · original · approved these changes
LGTM — clean opt-in lazy materialization of slot-133 read-only textures.
The approach is consistent with existing slot-133 and retired-resource patterns.
@KelboLive on GitHub · 2026-11-28 21:57 UTC · original · approved these changes
LGTM — clean opt-in lazy materialization of slot-133 read-only textures.
The approach is consistent with existing slot-133 and retired-resource patterns.
@Leyukaka on GitHub · 2026-11-29 06:49 UTC · original · requested changes
Changes requested on
02182842. Evidence: reading the diff, the head blobs and main212d4b5f, plusgit merge-tree. Nothing was built or run; the race and the surviving mutations below are found by reading, not reproduced.Blocking:
forward_slotmaterializes underif constexpr (N == 12 || N == 13 || N == 14)(d3d12_xs_device.cpp:762-763), butbuild_tablesinstalls resource slots 8-11 only (:8133-8136; :8137-8138 "Desktop Resource 12-14 ... are not installed until a call site confirms them") andenable_objectforwards 3-6 (:7985-7988). docs/startup-runtime.md lists these three calls as materialization triggers. Fix: remove the branch and the doc entry, or install the slots with a test.N == 17 ? 12; main :5267N == 17 ? 16). It came in with9bab5832, is not in #2773 (7986f2ad), is not gated by the switch and is not mentioned in the PR body.note_viewhashes the stored bytes, so slot-17 views that differ only in bytes 12-15 now share one id, and every slot-17 record reportsdesc_bytes12. The new fixture creates no slot-17 view. Fix: move it to its own PR with a test, or drop it.resource_mapmaterializes only when the resource has no guest memory pointer yet (:4878-4880), and the lazy path sets that pointer to the placement address (:5868). For a non-null address, Map returns that address and never materializes, same as the eager path (:5910). Both docs list Map as a trigger. Fix: drop it from the trigger lists, or say it applies to no slot-133 texture.Refresh ordering (read from the code):
view_slotwrites the desktop descriptor at :5383 and updates the shadow afterwards, inrecord_view->note_view(:5389).materialize_lazy_textureruns its refresh after releasinglazy_texture_mutex(:6156), checksshadow[slot] == record_idunder note_lock shared and writes T's SRV (:6190-6211). If another thread's desktop write for view X lands before that check and itsnote_viewafter it, the slot holds T while its record names X. The comment at :6188-6189 does not cover this, because the desktop write is outside note_lock.copy_descriptor_runhas the same window: CopyDescriptorsSimple at :5489,note_copyat :5490.refresh_copied_lazy_viewsthen repairs the slot only if the copied record names a lazy texture (:5459-5461).Applies with the switch off; the
offcontrol returns after the creation checks (test :491-520) and reaches none of it:forward_slotreturns 0, S_OK, DXGI_ERROR_NOT_FOUND or E_FAIL for any wrapper with a nullreal(:760-771), on slots 3-6 of every kind. main dereferences it (:765).record_translated_dispatchcallsretire_holdfor every non-tiled sampled input (d3d12_compute_dispatch.inl:798), which changes X2W_D3D12_RELEASE_RETIRED=1 for textures that are not lazy.device_residencydrops null entries and returns S_OK when none remain (:1417-1420).offcontrol to run them.Error reporting: the eager path returns the CreateCommittedResource failure (:5902); the lazy path returns S_OK for any description (:5879-5880) and the failure shows only at first use. Worth a line in the docs.
Tests:
cmake --build --preset prandctest --preset pr(windows.yml:489-493). Neither theprtargets nor its test filter in CMakePresets.json includestartup_slot133_lazy_textures_*, so run 46140793329 did not build or run the fixture. docs/experiments.md reports the debug1 cases skipped (77). Fix: add the target and the WARP cases to theprpreset.lazy_null_srv_desc(:5118-5137), reached only without a described dimension;view_slot(:5306-5308);create_lazy_srv(:5422-5433);Rebase:
git merge-tree --write-tree origin/mainreports two conflicts, both with main'strace_compute_output_uselines:list_copy_buffer_regionin list_copy.inl andresource_unmapin d3d12_xs_device.cpp. #2773 is still open at7986f2ad, an ancestor of this head.@JohnConnorNPC on GitHub · 2026-11-29 13:24 UTC · original
Review of head
02182842againstmainc04e0dd6. I read the diff, the head andmainblobs and thegit merge-treeresult. Nothing was built or run.This needs a rebase.
git merge-tree --write-tree origin/main 02182842exits 1 with conflicts indocs/startup-runtime.md,src/startup_stubs/d3d12_xs_device.cppandsrc/startup_stubs/list_copy.inl. The docs conflict is new since the changes request. #3431 (X2W_D3D12_INLINE_DESCRIPTORS, opt-in) added its table row and section at the same place. #3431 also brings two semantic overlaps that git does not flag:SHOULD
retire_holdchanged meaning onmain. In2130dcec(#3431 review) it returnsbool. A nullown().realnow means the drain has claimed the object: it logsreads found their texture already freed; bound nulland returns false, and the draw and compute callers bind null (if (texture && ... && !retire_hold(self, wrapper)) texture = nullptr;). A lazy slot-133 texture also has a nullrealuntil it materializes. The auto-mergedd3d12_compute_dispatch.inlkeeps bothmain's checked hold on the sampled-texture path and this PR's uncheckedretire_hold(self, view.wrapper)inrecord_translated_dispatch. After the rebase, keep one hold per site, and make sure every hold of a lazy texture runs aftermaterialize_lazy_texture. Otherwise a not-yet-used texture is bound null and reported as freed. A fixture case withX2W_D3D12_RELEASE_RETIRED=1, where the first use is a translated dispatch, would show it.X2W_D3D12_INLINE_DESCRIPTORS=1turns off for CBV/SRV/UAV heaps.main's switch row says the title then "copies CBV/SRV/UAV descriptors itself instead of calling device slots 17 and 24". This PR refreshes copied placeholders only insidecopy_descriptor_run, which is reached from device slots 23 and 24. A copy the title makes itself never reachesrefresh_copied_lazy_views. Please state whetherX2W_D3D12_LAZY_TEXTURES=1may be combined with it. Then either refuse the combination at startup, or add a fixture case with both switches set.MUST
3. Rebase onto current
main, resolving the three conflicts and the two overlaps above.I won't repeat the blocking points of the open changes request on this head, or the duplicate with #2773. Both still apply.
Held: conflicting, with a standing changes request.
AI-assisted.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.