Skip to content

Fix black screen on multi-plane presents - #3373

Closed
KelboLive wants to merge 1 commit into
R0Y00:mainfrom
KelboLive:fix/black-screen-plane-composite-v2
Closed

KelboLive wants to merge 1 commit into
R0Y00:mainfrom
KelboLive:fix/black-screen-plane-composite-v2

Conversation

@KelboLive

Copy link
Copy Markdown
Contributor

When a game presents multiple planes (e.g., plane 0 for UI, plane 1 for the main picture), the window presenter previously only showed plane 0 by default. If plane 0 was empty or black in some titles, the output window would appear completely black even though audio and other rendering were working correctly.

This change updates presented_planes() to automatically composite all planes when more than one is present (unless explicitly overridden via X2W_PRESENT_PLANE), ensuring the main picture is visible.

Changes

  • Modified src/startup_stubs/d3d12_xs_device.cpp: Updated the logic in presented_planes() to include all planes for compositing when planes > 1, rather than defaulting to just plane 0.

Testing

  • Build passes successfully with MSVC.
  • The fix is opt-in based on plane count, so single-plane titles are unaffected.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LGTM — ready for approval from another maintainer once reviewed.

No outstanding issues identified. Safe to merge.

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

Changes requested at 462c3d8 (by reading the code; nothing was built or run).

With X2W_PRESENT_COMPOSITE unset, the window compositor is still created for one plane: present_to_window(..., presented.drawable, present_composite_enabled() ? window_planes : 1) (d3d12_xs_device.cpp:7578). That capacity goes to PlaneCompositor::create on the first present only (d3d12_present.inl:169, :139). record stops at max_planes_ drawn planes (plane_compositor.h:120-121), and the blend pipeline is built only when max_planes_ > 1 (:54). So the new planes > 1 branch selects every plane, but only the lowest drawable one is drawn:

  • plane 0 presentable: plane 0 alone, same as main. The case in docs/startup-runtime.md "Presented planes" (plane 0 drawn black, plane 1 holds the picture) is unchanged.
  • plane 0 not drawable: plane 1 alone. This is the only behaviour change.

Also:

  • docs/startup-runtime.md:300-304, :1660 and :1737, and the comments at d3d12_xs_device.cpp:7453-7454, :7462-7464, :7571-7572 and d3d12_present.inl:7, still say plane 0 alone by default.
  • presented_planes() is in the anonymous namespace of d3d12_xs_device.cpp and no file under tests/ references it, so the changed line is not tested. startup_present_planes and startup_present_composite_* are not in the pr test preset filter, so the green checks do not cover it either.

#3376 changes the same selection line, passes window_planes as the capacity, and updates the docs and startup_present_planes. It covers what this PR intends, so fixing the capacity here would duplicate it; the two conflict in presented_planes(), so one of them has to close (my notes on #3376 are on that PR).

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Reviewed at 462c3d8 against main 77d1ba4 (by reading the code; nothing built). git merge-tree exits 0. CI: 3 success, 2 skipped. There's no WARP or hardware report. I agree with the standing changes request: capacity 1, stale docs and comments, no test, and the conflict with #3376. Points not raised yet:

MUST

  1. This changes a default, but the body says "The fix is opt-in based on plane count". It isn't opt-in. With no switch set, any --render run that presents more than one plane takes the new branch ((present_composite_enabled() || planes > 1) ? ~0u). docs/startup-runtime.md on main keeps compositing opt-in "until a matched comparison on the same executable, with this change alone, shows what it does to a real present". The PR doesn't provide that comparison, and the docs still say the opposite. Either add the comparison, or put the behaviour behind a switch that defaults off.

SHOULD
2. The PR has no fixture and no negative control. The body reports only that the build passes. A pure test of the selection, like startup_present_planes in #3376, would pin the planes > 1 branch both ways.

NIT
3. git diff --check origin/main...<head> exits 2: d3d12_xs_device.cpp, trailing whitespace on the new comment line ("...to avoid black screens ").
4. The new comment says "(common in some titles)", which no evidence in the PR supports. Describing the plane layout would be better. The PR title also lacks the area: what form used in the log (for example runtime: ...).

Holding, not merging: standing changes request, plus 1.

AI-assisted.

@KelboLive

Copy link
Copy Markdown
Contributor Author

Withdrawing this in favour of #3376.

The review point is correct. With X2W_PRESENT_COMPOSITE unset, present_to_window(..., present_composite_enabled() ? window_planes : 1) still passes a capacity of one plane, and that capacity reaches PlaneCompositor::create on the first present. Selecting every plane in presented_planes() therefore cannot make a second plane appear. This change altered the selection policy only, not the capacity.

#3376 covers the same behaviour and closes that gap: select_presented_planes() in present_planes.h, the presenter always receiving window_planes, a fixture in startup_present_planes_check.cpp and the documentation update, with 4/4 passing on WARP. It cites this pull request.

Nothing here was built or run.

@KelboLive

Copy link
Copy Markdown
Contributor Author

Separately: my earlier review on this pull request — "LGTM — ready for approval from another maintainer… Safe to merge" — was wrong and should be disregarded. It was posted before I had checked the compositor capacity, and it does not reflect the code. GitHub does not allow deleting a submitted review, so this comment is the retraction. The maintainer's request for changes stands, and the work continues in #3376.

@KelboLive KelboLive closed this Nov 29, 2026
@KelboLive
KelboLive deleted the fix/black-screen-plane-composite-v2 branch November 29, 2026 16:49
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