startup_stubs: guard window presenter surface and close state #1484

Merged
tedin7 merged 2 commits from upstream-pr/1491 into main 2026-11-24 13:28:28 +00:00
tedin7 commented 2026-11-24 12:51:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:51:01Z.


Summary

  • Add x2w_startup::present_surface_supported(const D3D12_RESOURCE_DESC&) in src/startup_stubs/present_view_format.h to reject non-2D, multisampled, D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE, and unsupported/unknown-format surfaces before creating an SRV.
  • Guard present_to_window in src/startup_stubs/d3d12_present.inl against queue == nullptr, surface == nullptr, and unsupported surface descriptors.
  • Mark window_presenter.failed = true when p.list->Close() fails in present_to_window (and propagate p.list->Close() failure in create_window_presenter) so subsequent frames do not repeatedly call Reset() on an unclosed command list.
  • Extend tests/startup_present_view_check.cpp with pure and WARP checks covering D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE, non-2D/MSAA/unknown-format refusal, and valid SRV-eligible surfaces, and document the guard in docs/startup-runtime.md.

Verification

  • git diff --check origin/main..HEAD
  • python3 tests/docs_links_check.py
  • python3 tests/bidi_controls_check.py
  • python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py preflight /root/wt/x2w-h-w3-present
  • Win2025 Debug & Release /O2: startup_present_view_check (^startup_present_view)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582183814 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1491). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:51:01Z. --- ## Summary - Add `x2w_startup::present_surface_supported(const D3D12_RESOURCE_DESC&)` in `src/startup_stubs/present_view_format.h` to reject non-2D, multisampled, `D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE`, and unsupported/unknown-format surfaces before creating an SRV. - Guard `present_to_window` in `src/startup_stubs/d3d12_present.inl` against `queue == nullptr`, `surface == nullptr`, and unsupported surface descriptors. - Mark `window_presenter.failed = true` when `p.list->Close()` fails in `present_to_window` (and propagate `p.list->Close()` failure in `create_window_presenter`) so subsequent frames do not repeatedly call `Reset()` on an unclosed command list. - Extend `tests/startup_present_view_check.cpp` with pure and WARP checks covering `D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE`, non-2D/MSAA/unknown-format refusal, and valid SRV-eligible surfaces, and document the guard in `docs/startup-runtime.md`. ## Verification - `git diff --check origin/main..HEAD` - `python3 tests/docs_links_check.py` - `python3 tests/bidi_controls_check.py` - `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py preflight /root/wt/x2w-h-w3-present` - Win2025 Debug & Release `/O2`: `startup_present_view_check` (`^startup_present_view`) AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 13:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:59:31Z.


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

  • Debug (--preset dev): ctest --preset dev -R '^startup_present_view' --no-tests=error --output-on-failure: 4 passed; startup_present_view_hardware skipped (capability, not a pass).
  • Release /O2 (--preset release): same command with --preset release: 4 passed; startup_present_view_hardware skipped (capability, not a pass).

Pre-promote review added a zero Width/Height refusal in present_surface_supported() with two negative controls (13 surface checks).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132196682 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1491#issuecomment-7132196682). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:59:31Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `b61a2359b980ecdc816ad4848dee9c4fa9eadc14`: - **Debug (`--preset dev`)**: `ctest --preset dev -R '^startup_present_view' --no-tests=error --output-on-failure`: 4 passed; `startup_present_view_hardware` skipped (capability, not a pass). - **Release `/O2` (`--preset release`)**: same command with `--preset release`: 4 passed; `startup_present_view_hardware` skipped (capability, not a pass). Pre-promote review added a zero Width/Height refusal in `present_surface_supported()` with two negative controls (13 surface checks). AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 13:00:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T12:59:40Z.


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-24T13:02:50.177067Z b61a235 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132200056 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1491#issuecomment-7132200056). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T12:59:40Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"b61a2359b980ecdc816ad4848dee9c4fa9eadc14","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T13:02:50.177067Z">2026-11-24T13:02:50.177067Z</relative-time> | `b61a235` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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. </details> </details>
upstream-sync closed this pull request 2026-11-24 14:02:55 +00:00
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!1484
No description provided.