Fix black screen on multi-plane presents #3373

Closed
KelboLive wants to merge 1 commit from upstream-pr/3373 into main
KelboLive commented 2026-11-28 15:43:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T15:43:36Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5541868933 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-28T15:43:36Z. --- 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 commented 2026-11-28 21:59:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T21:59:28Z.

Review: COMMENTED


LGTM — ready for approval from another maintainer once reviewed.

No outstanding issues identified. Safe to merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6100260460 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373#pullrequestreview-6100260460). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-28T21:59:28Z. **Review:** COMMENTED --- LGTM — ready for approval from another maintainer once reviewed. No outstanding issues identified. Safe to merge.
Leyukaka commented 2026-11-29 06:34:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T06:34:26Z.

Review: CHANGES_REQUESTED


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.

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6101765658 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373#pullrequestreview-6101765658). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T06:34:26Z. **Review:** CHANGES_REQUESTED --- 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. #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 commented 2026-11-29 12:53:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:53:03Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256131694 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7256131694). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T12:53:03Z. --- 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 #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 commented 2026-11-29 16:16:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-29T16:16:36Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7258757357 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7258757357). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-29T16:16:36Z. --- 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 commented 2026-11-29 16:16:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-29T16:16:48Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7258759982 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3373#issuecomment-7258759982). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-29T16:16:48Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3373
No description provided.