Skip to content

runtime: draw every plane under the composite switch - #3376

Merged
JohnConnorNPC merged 7 commits into
R0Y00:mainfrom
lambirou:present/multplane-default
Nov 30, 2026
Merged

JohnConnorNPC merged 7 commits into
R0Y00:mainfrom
lambirou:present/multplane-default

Conversation

@lambirou

@lambirou lambirou commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

X2W_PRESENT_COMPOSITE=1 existed, but the window presenter's capacity is fixed on the first present and was passed as present_composite_enabled() ? window_planes : 1. The selection policy and capacity were inline, and a failed blend pipeline disabled the output window entirely.

This extracts the selection into select_presented_planes() (present_planes.h) and the capacity into window_plane_capacity.h, always passes the full window_planes capacity, and retries with one plane if the multi-plane pipeline cannot be created. The default is unchanged: plane 0 alone. X2W_PRESENT_PLANE=<n> still wins over the switch.

The default flip is left for a follow-up once a matched real-present comparison is available on a branch that reaches a picture-bearing frame. On current main the title stays on a black loading surface (8,595 compute refusals, draws 0), so a default-vs-X2W_PRESENT_PLANE=0 comparison would compare two black surfaces. tools/startup/run_presets.json keeps X2W_PRESENT_COMPOSITE=1 in base, so preset runs use the switch.

Review follow-up (2026-11-30): took the reviewer's opt-in alternative. The selection extraction, capacity test, fallback, presets and documentation stay; only the default is reverted.

Tests:

ctest --preset pr --no-tests=error -R '^startup_present_(planes(_control)?|composite_warp|composite_overlay_removed_control_warp)$' -V

4/4 passed on WARP; the --control path prints the expected FAIL: lines, including the withdrawn compose-by-default policy and the old capacity of one plane. python -B tests/docs_links_check.py: 179 Markdown files and 718 links passed.

Refs #3373.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — clean refactor with clear rationale.

Multi-plane presents now composite every drawable plane by default (plane 0 alone was measured black while plane 1 held the picture). Extracts PlaneSelection and select_presented_planes() from present_planes.h; X2W_PRESENT_PLANE still takes priority. Compositor capacity is fixed on the first present. Docs and tests updated consistently.

Ready to land.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — clean refactor, well-tested.

Introduces PlaneSelection struct and select_presented_planes() to replace the old inline logic. Multi-plane presents now composite every drawable plane by default (plane 0 alone was measured black on Series S); one-plane presents stay plane 0 alone. X2W_PRESENT_PLANE still takes priority. Compositor capacity is fixed on first present so later multi-plane presents work. Documentation updated to reflect the new default. Tests cover selection policy thoroughly.

Ready to land.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — sensible default for multi-plane presents.

Plane selection now composites every drawable plane by default for multi-plane presents, fixing the case where plane 0 is black but a higher plane holds the picture. One-plane presents stay plane-0-alone. PlaneSelection struct and select_presented_planes() encapsulate the policy cleanly. X2W_PRESENT_PLANE= still overrides and takes priority. Compositor capacity is fixed on the first present.

Test comments updated for the new selection policy. Documentation reflects the default change and diagnostic status of X2W_PRESENT_COMPOSITE.

Ready to land.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — sensible default for multi-plane presents.

Plane selection now composites every drawable plane by default for multi-plane presents, fixing the case where plane 0 is black but a higher plane holds the picture. One-plane presents stay plane-0-alone. PlaneSelection struct and select_presented_planes() encapsulate the policy cleanly. X2W_PRESENT_PLANE= still overrides and takes priority. Compositor capacity is fixed on the first present.

Test comments updated for the new selection policy. Documentation reflects the default change and diagnostic status of X2W_PRESENT_COMPOSITE.

Ready to land.

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 07f795d by reading the diff; not built or run. The selection logic is correct: with both switches unset a multi-plane present keeps every plane, a one-plane present keeps plane 0, and X2W_PRESENT_PLANE wins. git merge-tree is clean on main 212d4b5 and conflicts with #3373 in presented_planes(); this PR contains #3373's planes > 1 policy, so one of the two should close.

  • The capacity change is needed: PlaneCompositor::record stops at max_planes_, so with capacity 1 only the first drawable plane is drawn. No test checks the capacity passed at present_to_window(..., presented.drawable, window_planes): the tests call select_presented_planes and compositor.create(..., 1) / (..., 4) directly, so restoring present_composite_enabled() ? window_planes : 1 would not fail any of them.
  • New failure path on the default. PlaneCompositor::create has if (SUCCEEDED(hr) && max_planes_ > 1) hr = D3DCompile(..., "ps_over", ...), then creates blend_, and ends with if (FAILED(hr)) release();. present_to_window has if (!p.chain && !create_window_presenter(queue, window, plane_capacity)) { p.failed = true; return false; } and returns early on p.failed from then on. Main passed capacity 1 unless the switch was set, so ps_over and blend_ were never created there. Now every render-mode run creates them, and a failure turns the output window off for the whole run, one-plane presents included, which only need opaque_. Could a blend failure leave the one-plane path working (keep opaque_, drop to capacity 1)? I have not seen this failure happen.
  • docs/startup-runtime.md on main says: "It stays opt-in until a matched comparison on the same executable, with this change alone, shows what it does to a real present." The PR removes that sentence and reports synthetic tests only. Either add that comparison, or state in the doc why the condition is dropped.
  • X2W_PRESENT_COMPOSITE=1 no longer changes what the window shows: for one plane, all and only = 0 select the same plane. Its only remaining effect is the raw-plane sample. The env table could say so.
  • startup_present_planes(_control) and startup_present_composite_* are not in the pr test preset filter, so CI on this PR ran none of them. Under --control, defaults_to_all is control ? false : select_presented_planes(planes, -1, false).all: the two control rows return a constant and do not call the function.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-reviewed at 07f795d against main 77d1ba4 (by reading the code, plus a local g++ run of the pure startup_present_planes test on the merged tree). git merge-tree exits 0. CI: 3 success, 2 skipped. There's no WARP or hardware report besides the author's. The comment above already covers the capacity test gap, the new ps_over/blend_ failure path, the removed doc gate, the env table, the pr filter and the control rows. Points not raised yet:

MUST

  1. This flips a default on every --render run without meeting the condition the docs set for it. With both switches unset, a multi-plane present now composites, and every render-mode run builds the blend pipeline. The test confirms the default: changing composite || planes > 1 to composite makes the normal startup_present_planes run exit 1 with 2 FAIL lines ("two/four planes are composited by default"). The real-present comparison the docs asked for is still missing. Until it's posted (or a maintainer states in the docs why the gate is dropped), I'm treating this as a default change without evidence.

SHOULD
2. main now has tools/startup/run_presets.json (#3378), whose base preset sets "X2W_PRESENT_COMPOSITE": "1", and whose Series S note says "...which is why X2W_PRESENT_COMPOSITE is in base". With this PR, that variable only controls the raw-plane sample, so the preset entry and its note need updating in the same change.
3. #3373 makes the same planes > 1 change and conflicts with this one in presented_planes(). Whichever of the two goes ahead, the other should be closed.

NIT
4. The commit author is not a noreply address. That's not blocking; just mentioning it in case it wasn't intended.

Holding, not merging, until 1 is resolved.

AI-assisted.

@KelboLive

Copy link
Copy Markdown
Contributor

SHOULD 3 is resolved: #3373 was closed in favour of this pull request, so there is no longer a competing \planes > 1\ change in \presented_planes().

MUST 1 (the default flip without a real-present comparison) and SHOULD 2 (the \X2W_PRESENT_COMPOSITE\ entry in \ ools/startup/run_presets.json) are the author's to settle; neither can be answered from this account, which has no title run.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-reviewed the delta at 54a5965 (5 commits since 07f795d), by reading the diff and the failed CI log; no builds.

CI is red, and it comes from this PR. "Build and test on Windows" fails: ctest --preset pr reports 4 of 86 not run (startup_present_planes, startup_present_planes_control, startup_present_composite_warp, startup_present_composite_overlay_removed_control_warp). Each says Could not find executable .../out/build/dev/startup_present_planes.exe. The PR adds these four to the pr test filter in CMakePresets.json, but the pr build preset's targets list does not include them, so CI never builds them. Fix: add the matching targets to the pr build preset (or drop the four names from the filter).

Delta status

  • Resolved: the Fix black screen on multi-plane presents #3373 overlap (closed in favour of this PR), the run_presets.json stale entry (the X2W_PRESENT_COMPOSITE line and its note were removed), the capacity test gap (new window_plane_capacity.h and fixture rows), and the env-table wording.
  • Still open, MUST: the default is still flipped. The docs now say "no matched comparison on the same executable, with this change alone, has measured what it does to a real present", so the gate is dropped but not met. A maintainer decision to drop the gate, stated in the doc, would also clear this.
  • New, SHOULD: the doc now describes a fallback to one plane when the multi-plane pipeline cannot be created. It says the fallback is not exercised by any fixture, so it is untested.

Not merging while CI is red and the MUST stands.

AI-assisted review.

Copy link
Copy Markdown
Contributor Author

Review follow-up pushed at b86a1448 (rebased on current main 2ff74a6a; the branch now includes the merge, so this is the only diff against main).

What changed:

  • Capacity test. window_plane_capacity.h shares window_present_max_planes with the presenter and the pure test. startup_present_planes now pins the capacity, and --control reserves one plane so the row prints FAIL:. The selection control rows also call select_presented_planes() instead of returning a constant.
  • Blend failure path. create_window_presenter retries with a one-plane capacity when the multi-plane pipeline cannot be created, so a missing ps_over/blend_ no longer turns the output window off. Documented as unmeasured.
  • CI coverage. startup_present_planes(_control) and startup_present_composite_* are in the pr test filter and the pr build targets. The first CI run after adding them to the filter only (9237) reported all four as Not Run because the executables were not built; the build preset now includes them.
  • Presets. X2W_PRESENT_COMPOSITE is removed from base in tools/startup/run_presets.json, and the Series S note no longer claims it is needed there.
  • Docs. The env table says the switch selects the same plane as the default for a one-plane present, and the "Presented planes" section states the multi-plane default remains under investigation: no matched comparison on the same executable has measured it on a real present.

The MUST-1 evidence question is not fabricated here: the doc now says the comparison is still missing. On my side, local checks: startup_present_* 4/4 on WARP, docs_links_check 179 files / 718 links passed, git diff --check clean.

The Windows job 9239 is running on b86a1448.

Copy link
Copy Markdown
Contributor Author

I addressed the review points on the refreshed head b86a1448:

  • Merged current main (2ff74a6); the branch is mergeable.
  • tools/startup/run_presets.json no longer sets X2W_PRESENT_COMPOSITE in base; the Series S note now points to the default multi-plane composition. docs/startup-runtime.md and the env table match.
  • The presenter now passes window_planes capacity, backed by window_plane_capacity.h; the test checks the capacity value and the control prints a capacity FAIL:. The control also calls select_presented_planes() instead of returning a constant.
  • A failed multi-plane composite now retries with capacity 1, so a failed ps_over/blend_ path does not disable one-plane presents.
  • Debug and Release targeted suites pass 4/4; startup_run_preset_check passes 12 choices; docs links and bidi checks pass.

Matched 150 s title runs on the same Release build and package show two drawable planes in both cases. Plane 0 readback is 0.00/255; the forced X2W_PRESENT_COMPOSITE=1 run samples raw plane 1 at 0.00/255 as well. Both runs were still on a black loading surface, so they establish the two-plane selection and capacity path but not the picture-bearing frame. The documented measured case remains the evidence for plane 1 carrying the picture; I have not claimed that as the missing A/B.

I will keep the PR open until a longer picture-bearing run is available or a maintainer accepts the measured case as sufficient.

Copy link
Copy Markdown
Contributor Author

Windows checks run 9239 is green on b86a1448.

The four present tests now build and run in the pr preset (previous run 9237 had them in the test filter only, so CTest reported them Not Run):

18/86 Test #522: startup_present_planes ................................... Passed
19/86 Test #523: startup_present_planes_control ........................... Passed
20/86 Test #524: startup_present_composite_warp ........................... Passed
21/86 Test #525: startup_present_composite_overlay_removed_control_warp ... Passed

The PR is MERGEABLE on main 2ff74a6a. The real-present A/B evidence is still the only open item from the review; the documentation now states that explicitly.

@lambirou

Copy link
Copy Markdown
Contributor Author

I tried to produce the missing real-present A/B on b86a1448 with a longer run. It cannot be produced on this branch as it stands.

Release build, Series S profile (X2W_DEVICE_TYPE=6), 24 GiB, -InputScript "4@70,4@115,4@125", 300 s. The run reached 8,820 presented frames at 29.9 fps and the two-plane path is selected (frame ... plane 0/2: 1920x1080, plane 1/2: 3840x2160), but the surface never leaves the loading screen:

  • draws 0, translated draws 0, textures uploaded 0
  • compute dispatches: translated 0, refused 8595
  • all 8,595 refusals are an input is in a placed buffer that does not alias title memory (3 keys; 8,593 on 8d990b92ca548681)

That is the gap the integration stack fixes with dc76ca16; it is not part of this PR. On current main the title never reaches a frame that carries an image, so a matched default-vs-X2W_PRESENT_PLANE=0 comparison on this branch would compare two black loading surfaces.

The documentation keeps the honest statement: the default is covered by the selection and capacity tests and by the documented measured Series S case, but not by a matched real-present A/B. If the maintainer is willing to land on that basis, the PR is ready; otherwise it needs a run from a branch that also carries the view-token/placed-buffer fix, which would no longer be "this change alone".

Run: _wt/present-multplane/out/startup/present-ab-300-default/log3 (timeout after 300.01 s).

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-reviewed the delta at b86a144 by reading the diff and the thread; no builds.

Resolved since 54a5965: CI is green (the four present tests are now in the pr build targets as well as the filter), the capacity is pinned by window_plane_capacity.h and a fixture row, the control rows call select_presented_planes(), run_presets.json no longer sets X2W_PRESENT_COMPOSITE, and the env table matches.

Still open, MUST: the multi-plane default is still flipped, and the only gate main had ("stays opt-in until a matched comparison on the same executable, with this change alone...") is now reworded to say the comparison has not been made. The author's latest comment says it can't be produced on this branch (both runs stay on a black loading surface), which I take at face value. That leaves the gate dropped on the strength of the synthetic WARP fixtures and the one documented measured case, so this needs a maintainer to say so, either in the PR or in the doc. Alternatively the flip could land opt-in (selection unchanged unless X2W_PRESENT_COMPOSITE=1) with the capacity fix kept, which doesn't need the comparison.

SHOULD (carried): the one-plane retry when the composite pipeline can't be created is untested, as the doc itself says. Fine to land as documented, but nothing would catch it regressing.

Not merging until the maintainer decision on the default.

AI-assisted review.

@lambirou lambirou changed the title runtime: compose presented planes by default runtime: draw every plane under the composite switch Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Took the opt-in alternative from the last review at 43512b7a.

  • select_presented_planes() now keeps plane 0 alone unless X2W_PRESENT_COMPOSITE=1; X2W_PRESENT_PLANE=<n> still wins.
  • The capacity fix, the one-plane retry, the selection/capacity tests, run_presets.json (which keeps X2W_PRESENT_COMPOSITE=1 in base) and the documentation stay.
  • The default flip becomes a follow-up once a branch can reach a picture-bearing frame; that is now stated in the PR body instead of the doc gate being dropped.

PR title and body updated to match. CI is running on 43512b7a.

Copy link
Copy Markdown
Contributor Author

Windows checks run 9241 is green on 43512b7a, with the opt-in pivot:

18/86 Test #522: startup_present_planes ................................... Passed
19/86 Test #523: startup_present_planes_control ........................... Passed
20/86 Test #524: startup_present_composite_warp ........................... Passed
21/86 Test #525: startup_present_composite_overlay_removed_control_warp ... Passed

The PR is MERGEABLE on main 2ff74a6a. The default is unchanged (plane 0 alone); the switch, capacity fix, fallback, presets and tests are in. The compose-by-default flip is left for a follow-up with a picture-bearing run.

@JohnConnorNPC
JohnConnorNPC merged commit 47c30fe into R0Y00:main Nov 30, 2026
5 checks passed
@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-reviewed the delta b86a144..43512b7 (one commit) by reading the diff; no builds.

MUST 1 is resolved by the opt-in landing. select_presented_planes() now keeps plane 0 alone unless X2W_PRESENT_COMPOSITE=1; X2W_PRESENT_PLANE=<n> still wins. The selection test and its control were inverted to match (the control models the withdrawn default and prints FAIL:), run_presets.json keeps the switch in base, and the docs and env table say it stays opt-in until a matched comparison exists. CI is green on 43512b7, including the four present tests in the pr preset.

Two notes, neither blocking:

  • The presenter now passes the full capacity (4) on every render-mode run, so the default path also builds the blend pipeline. compositor.create() releases its state on failure, so the one-plane retry is safe, and the selection (and so the picture) is unchanged.
  • That retry is still not exercised by a fixture, as the doc says.

Merged at 43512b7 (squash, 47c30fe).

AI-assisted review.

@lambirou

Copy link
Copy Markdown
Contributor Author

I can now provide the matched comparison on the integration stack that actually draws. Same executable and settings; only the plane selection changes:

  • default multi-plane composition: legal screen, then the brightness calibration screen; 6,998 translated draws at 41 s and 1,393 textures loaded;
  • X2W_PRESENT_PLANE=0: black output window at 44 s, while the renderer had already issued 10,792 translated draws (5 pipelines, 0 textures uploaded at 42 s in that run).

The PR branch alone still cannot produce this because it lacks the stack's compute/draw fixes; the black loading surface there is not caused by the plane selection. The selection change is validated on the executable that can draw, with the default composition showing the picture and plane 0 alone staying black.

The opt-in fallback remains possible if the maintainer prefers to land the capacity fix alone, but the evidence now supports the default.

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.

4 participants