startup: bind single-range RTVs, clear copied views, count unresolved #1701
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!1701
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1701/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?
@tedin7 on GitHub · 2026-11-24 17:23 UTC · original
tedin7:x2w-frontier-p01-rtv→main· +478 −37 · 6 files · 7 commits · merged 2026-11-24 18:40 UTCWhat
OMSetRenderTargets(command-list slot 50):RTsSingleHandleToDescriptorRange=TRUEis no longer dropped silently. The first handle is expanded at the title's descriptor stride (title_descriptor_stride), for a count of one and for several, with explicit 64-bit handle-overflow protection. Before,targets_boundstayed false and every later draw on the list was skipped.x2w-render totalsnow reportstarget binds N (unresolved M).ClearRenderTargetView(slot 52) resolves the view withresolve_view(desktop, 20)(which already falls back toview_target(desktop, 20)when no shadow record exists), so a descriptor copied withCopyDescriptors*clears the resource it now holds while a slot overwritten with a null RTV cannot resurrect a staleview_targetsentry.list_clear_targetmoved belowresolve_viewfor that, otherwise unchanged.startup_rtv_bind_{warp,hardware}(tests/startup_rtv_bind.cpp, no draw): bind forms (array, single range with 1 and 2 handles, count 0 with null handles, count above 8, range reaching an empty view, empty view alone, clear on an empty view) checked through the newx2w_d3d12_render_target_statsexport, then a view copied withCopyDescriptorsSimple, cleared red and read back.docs/startup-runtime.mdanddocs/experiments.md.Verification
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
d23d8a6e1c356809517783de87a9d447143f0631:--preset dev):cmake --build --preset dev --target d3d12_xs_shim startup_rtv_bind startup_stream_consumer startup_stub_consumer startup_stub_acphal startup_stub_chad startup_stub_gameinput startup_stub_xapu startup_stub_xcrdapi startup_stub_xg_xs d3d12x_graphics_list_check -- -j 6(3.66s)ctest --preset dev -R '^(startup_rtv_bind_warp|startup_stream_draw_warp|startup_stream_viewport_warp|startup_stubs|d3d12x_graphics_list_warp)$' --parallel 4 --no-tests=error --output-on-failure: 5/5 passed (3.25s:d3d12x_graphics_list_warp0.06s,startup_rtv_bind_warp0.07s,startup_stubs0.47s,startup_stream_viewport_warp1.07s,startup_stream_draw_warp3.17s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_shim startup_rtv_bind startup_stream_consumer startup_stub_consumer startup_stub_acphal startup_stub_chad startup_stub_gameinput startup_stub_xapu startup_stub_xcrdapi startup_stub_xg_xs d3d12x_graphics_list_check -- -j 6(1.16s)ctest --preset release -R '^(startup_rtv_bind_warp|startup_stream_draw_warp|startup_stream_viewport_warp|startup_stubs|d3d12x_graphics_list_warp)$' --parallel 4 --no-tests=error --output-on-failure: 5/5 passed (3.10s:startup_rtv_bind_warp0.07s,d3d12x_graphics_list_warp0.06s,startup_stubs0.59s,startup_stream_viewport_warp1.13s,startup_stream_draw_warp3.02s)if (!list || single_range) return;inlist_targetscausedstartup_rtv_bind_warpto fail at step 2 (2 single range, count 1: binds +0 (expected +1)).git diff --check origin/main...HEAD,tests/docs_links_check.py(17 files / 365 links),tests/bidi_controls_check.py(1288 files): clean.Behavior changes to review: a depth pointer whose handle maps to no descriptor still binds no depth, now with a count and a log line; a count above 8 is now counted and logged (still refused). The
single_rangestride comes from the RTV increment of the device; if no device is known the bind is refused and counted.Not covered: physical hardware adapters (
*_hardware), and the draw-level effect of a single-range bind (a pixel check after a draw).AI-assisted; commands listed were executed locally.
OMSetRenderTargets with RTsSingleHandleToDescriptorRange true is expanded at the title descriptor stride (one handle or several) instead of being dropped silently. ClearRenderTargetView reads the view through its shadow record, so a copied descriptor clears its resource. Render target and depth handles that hold no view are logged and counted in the x2w-render totals line. Adds startup_rtv_bind_{warp,hardware}; syntax-checked with MinGW only, not run on a desktop device.@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 17:43 UTC · original · edited 2026-11-24 17:48 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
d23d8a6ℹ️ 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.
@ -1829,0 +1835,4 @@if (!self->own().list_open || !colour) return;const u64 desktop = desktop_cpu_handle(handle);const ResolvedView view = resolve_view(desktop, 20);ID3D12Resource* target = view.resource;@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 17:48 UTC · original
When
view_slot<20>rejects an RTV, such as the packed-format controls intests/startup_packed_target_draw_check.py:127-128, it has already callednote_view, so a shadow record exists even though no desktop descriptor was created.resolve_viewreturns that record's non-null resource, causing this new lookup to proceed toClearRenderTargetViewwith an uninitialized or stale descriptor instead of skipping the clear as before.tests/startup_stream_draw.cpp:289already exercises this sequence, which can issue invalid D3D12 work and trigger device removal. Track whether the shadow RTV was actually materialized before allowing it to be cleared, while preserving support for valid copied descriptors.Useful? React with 👍 / 👎.
@ -1829,0 +1835,4 @@if (!self->own().list_open || !colour) return;const u64 desktop = desktop_cpu_handle(handle);const ResolvedView view = resolve_view(desktop, 20);ID3D12Resource* target = view.resource;@tedin7 on GitHub · 2026-11-24 18:01 UTC · original
Fixed in
e56f2eaecfe3a1c038250b2c27b35fdcd5c7a736.d3d12_capture.inlnow tracks desktop view materialization (view_materialized(), keyed by view record id and mixed into the dedup hash, keepingViewRecordlayout unchanged for capture dumps). Becausenote_copycopies shadow ids, materialization status propagates acrossCopyDescriptorsandCopyDescriptorsSimple.view_slot<N, D>insrc/startup_stubs/d3d12_xs_device.cpprecordsmaterialized=falseon the skipped/refused paths (including refused packed formats) andmaterialized=trueonly after desktop view creation.resolve_viewrejects unmaterialized shadow records (out.skipped = true,out.resource = nullptr), soClearRenderTargetViewandOMSetRenderTargets(both array andsingle_range=TRUE, plus depth views) skip the desktop call and count the handle as unresolved instead of passing an uninitialized or stale descriptor.tests/startup_rtv_bind.cppadds regression coverage for (a) clearing/binding a refused packed-format RTV directly and viasingle_range=TRUE, (b) clearing valid RTVs copied via bothCopyDescriptorsSimpleandCopyDescriptors, and (c) clearing/binding a copied refused RTV viaCopyDescriptors, confirming the refused target remains untouched.Verification:
git diff --check origin/main...HEAD,python3 tests/docs_links_check.py(17 files, 365 links),python3 tests/bidi_controls_check.py(1288 files) — all passed.e56f2eaecfe3a1c038250b2c27b35fdcd5c7a736:--preset dev):cmake --build --preset dev --target startup_rtv_bind startup_stream_consumer+ctest --preset dev -R '^(startup_rtv_bind|startup_packed_target_draw|startup_stream_draw)'— 6/6 passed (3.24s)./O2(--preset release):cmake --build --preset release --target startup_rtv_bind startup_stream_consumer+ctest --preset release -R '^(startup_rtv_bind|startup_packed_target_draw|startup_stream_draw)'— 6/6 passed (3.23s).if (!materialized)guard inresolve_viewvia--patchon Win2025 Debug):startup_rtv_bind_warpfailed as expected at step6e clear on a refused view: binds +0 (expected +0), unresolved +0 (expected +1).AI-assisted; commands listed were executed locally.
@R0Y00 on GitHub · 2026-11-24 18:40 UTC · original
Independently verified
9f20c573in Windows Release. The RTV binder, packed-target draw and heap-indexed root checks passed 6/6 across WARP and RTX 4060 Laptop, no skips. Refused original and copied RTVs remain unbound; valid copied RTVs clear and read back as expected. This covers the shadow-view materialization finding.@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 17:48 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
d23d8a6e1cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".