Skip to content

startup: bind single-range RTVs, clear copied views, count unresolved - #1701

Merged
R0Y00 merged 7 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-p01-rtv
Nov 24, 2026
Merged

R0Y00 merged 7 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-p01-rtv

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • OMSetRenderTargets (command-list slot 50): RTsSingleHandleToDescriptorRange=TRUE is 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_bound stayed false and every later draw on the list was skipped.
  • Render target and depth handles that hold no view (and a count above 8) are logged (first six of each kind) and counted: x2w-render totals now reports target binds N (unresolved M).
  • ClearRenderTargetView (slot 52) resolves the view with resolve_view(desktop, 20) (which already falls back to view_target(desktop, 20) when no shadow record exists), so a descriptor copied with CopyDescriptors* clears the resource it now holds while a slot overwritten with a null RTV cannot resurrect a stale view_targets entry. list_clear_target moved below resolve_view for that, otherwise unchanged.
  • New 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 new x2w_d3d12_render_target_stats export, then a view copied with CopyDescriptorsSimple, cleared red and read back.
  • Docs: docs/startup-runtime.md and docs/experiments.md.

Verification

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit d23d8a6e1c356809517783de87a9d447143f0631:

  • Debug (--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_warp 0.06s, startup_rtv_bind_warp 0.07s, startup_stubs 0.47s, startup_stream_viewport_warp 1.07s, startup_stream_draw_warp 3.17s)
  • Release /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_warp 0.07s, d3d12x_graphics_list_warp 0.06s, startup_stubs 0.59s, startup_stream_viewport_warp 1.13s, startup_stream_draw_warp 3.02s)
  • Mutation check on Win2025 (local patch, not pushed): temporarily restoring if (!list || single_range) return; in list_targets caused startup_rtv_bind_warp to fail at step 2 (2 single range, count 1: binds +0 (expected +1)).
  • Linux checks: 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_range stride 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.

@tedin7 tedin7 changed the title startup: bind single-range render targets, clear copied views, count unresolved handles startup: bind single-range RTVs, clear copied views, count unresolved Nov 24, 2026
@tedin7
tedin7 marked this pull request as ready for review November 24, 2026 17:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T17:48:22.930875Z d23d8a6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/startup_stubs/d3d12_xs_device.cpp Resolved
…, count unresolved handles

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.
@tedin7
tedin7 force-pushed the x2w-frontier-p01-rtv branch from e56f2ea to 9f20c57 Compare November 24, 2026 18:11
@R0Y00

R0Y00 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Independently verified 9f20c57 in 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.

@R0Y00
R0Y00 merged commit f3649ec into R0Y00:main Nov 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants