Fix black screen on multi-plane presents #3375

Closed
github-bot wants to merge 1 commit from github-bot/gh-3373 into main AGit
Owner

@⁠KelboLive on GitHub · 2026-11-28 15:43 UTC · original
KelboLive:fix/black-screen-plane-composite-v2 → main · +3 −1 · 1 files · 1 commits · closed without merging

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** on GitHub · 2026-11-28 15:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373) `KelboLive:fix/black-screen-plane-composite-v2` → `main` · +3 −1 · 1 files · 1 commits · closed without merging 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:48:36 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-28 21:59 UTC · original · reviewed

LGTM — ready for approval from another maintainer once reviewed.

No outstanding issues identified. Safe to merge.

**@⁠KelboLive** on GitHub · 2026-11-28 21:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373#pullrequestreview-6100260460) · **reviewed** LGTM — ready for approval from another maintainer once reviewed. No outstanding issues identified. Safe to merge.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 06:34 UTC · original · requested changes

Changes requested at 462c3d84 (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.

#3378 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 #3378 are on that PR).

**@⁠Leyukaka** on GitHub · 2026-11-29 06:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373#pullrequestreview-6101765658) · **requested changes** Changes requested at 462c3d84 (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. #3378 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 #3378 are on that PR).
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-29 12:53 UTC · original

Reviewed at 462c3d8425 against main 77d1ba4d (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 #3378. 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 #3378, 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.

**@⁠JohnConnorNPC** on GitHub · 2026-11-29 12:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7256131694) Reviewed at 462c3d84251ff15eff07d20caf013c455786aa71 against main 77d1ba4d (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 #3378. 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 #3378, 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.
github-bot closed this pull request 2026-11-29 16:16:55 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-29 16:16 UTC · original

Withdrawing this in favour of #3378.

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.

#3378 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** on GitHub · 2026-11-29 16:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7258757357) Withdrawing this in favour of #3378. 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. #3378 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.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-29 16:16 UTC · original

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 #3378.

**@⁠KelboLive** on GitHub · 2026-11-29 16:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7258759982) 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 #3378.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.