startup: diagnose incomplete draw buffers and root SRV spans #3599

Manually merged
github merged 2 commits from github-bot/gh-3597 into gh-pr/3597/base 2026-11-30 17:24:07 +00:00 AGit
Owner

@⁠tedin7 on GitHub · 2026-11-30 12:27 UTC · original
tedin7:uppr23-diagnostic-span-incomplete-buffers → main · +118 −3 · 5 files · 2 commits · merged 2026-11-30 17:18 UTC

Add bounded per-key diagnostic logging (log_incomplete_buffer, capped per shader key) when indirect translated draws refuse due to an incomplete vertex, index, or buffer SRV range, reporting the requested address/size and the nearest registered desktop buffer span via a small header-only DiagnosticSpan helper (src/startup_stubs/diagnostic_span.h).

Read-only diagnostics on existing refusal paths — zero change to draw behavior.

Tests

  • Added tests/startup_diagnostic_span_check.cpp (registered via tests/cmake/startup_diagnostic_span.cmake as startup_diagnostic_span) covering containment, distance selection, and the 64 MiB span cutoff.
**@⁠tedin7** on GitHub · 2026-11-30 12:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597) `tedin7:uppr23-diagnostic-span-incomplete-buffers` → `main` · +118 −3 · 5 files · 2 commits · merged 2026-11-30 17:18 UTC Add bounded per-key diagnostic logging (`log_incomplete_buffer`, capped per shader key) when indirect translated draws refuse due to an incomplete vertex, index, or buffer SRV range, reporting the requested address/size and the nearest registered desktop buffer span via a small header-only `DiagnosticSpan` helper (`src/startup_stubs/diagnostic_span.h`). Read-only diagnostics on existing refusal paths — zero change to draw behavior. ## Tests - Added `tests/startup_diagnostic_span_check.cpp` (registered via `tests/cmake/startup_diagnostic_span.cmake` as `startup_diagnostic_span`) covering containment, distance selection, and the 64 MiB span cutoff.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 12:28:09 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 12:27 UTC · original · edited 2026-11-30 12:31 UTC

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-30T12:31:44.286052Z 77e6891 PR opened
ℹ️ 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 12:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597#issuecomment-7278458386) · edited 2026-11-30 12:31 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"77e689167f71ad07c9c43122b77e36fdc07804bc","has_any_findings":true,"has_unresolved_findings":true,"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-30T12:31:44.286052Z">2026-11-30T12:31:44.286052Z</relative-time> | `77e6891` | PR opened | <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>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 12:31 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77e689167f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 12:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597#pullrequestreview-6112207428) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `77e689167f` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
@ -3765,6 +3822,8 @@ bool draw_translated(Wrapper* self, bool indexed, UINT count, UINT instances, UI
: "translated draw requires a complete GPU-backed table buffer range",
srv.source == 1 ? indirect_refusal_code::incomplete_vertex_stream
: indirect_refusal_code::incomplete_table_buffer);
log_incomplete_buffer(tr->key, i, srv.source, srv.a, address, bytes, "incomplete GPU-backed buffer range");
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 12:31 UTC · original

P2 Badge Log the decoded table range on indirect-buffer refusals

For an indirect descriptor-table SRV (srv.source == 0), address and bytes are still zero here: only vertex/root bindings initialize these locals above, and the outer table-range decoding occurs below this early return. indirect_table_buffer decodes the descriptor internally but does not update those locals. Consequently, a non-null range that crosses its backing allocation is misleadingly logged as address 0x0 bytes 0, discarding the information this diagnostic is intended to expose. Populate the diagnostic fields from the descriptor or resolver before emitting both new early-refusal logs.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 12:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597#discussion_r4739196822) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Log the decoded table range on indirect-buffer refusals** For an indirect descriptor-table SRV (`srv.source == 0`), `address` and `bytes` are still zero here: only vertex/root bindings initialize these locals above, and the outer table-range decoding occurs below this early return. `indirect_table_buffer` decodes the descriptor internally but does not update those locals. Consequently, a non-null range that crosses its backing allocation is misleadingly logged as `address 0x0 bytes 0`, discarding the information this diagnostic is intended to expose. Populate the diagnostic fields from the descriptor or resolver before emitting both new early-refusal logs. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -0,0 +1,22 @@
#include "startup_stubs/diagnostic_span.h"
#include <cassert>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 12:31 UTC · original

P2 Badge Keep the diagnostic-span checks active in Release builds

With the release preset, NDEBUG disables every assertion in this test, so the new CTest reports success without checking any result in the Release suite run by .github/workflows/windows.yml. I verified this with a standalone build: changing diagnostic_span.h:11 from gap <= to gap < fails the Debug check but still exits successfully with -O2 -DNDEBUG. Undefine NDEBUG before including <cassert>, as the other assertion-based checks do, or use explicit failure checks so Release builds retain the regression coverage.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 12:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597#discussion_r4739196834) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Keep the diagnostic-span checks active in Release builds** With the `release` preset, `NDEBUG` disables every assertion in this test, so the new CTest reports success without checking any result in the Release suite run by `.github/workflows/windows.yml`. I verified this with a standalone build: changing `diagnostic_span.h:11` from `gap <=` to `gap <` fails the Debug check but still exits successfully with `-O2 -DNDEBUG`. Undefine `NDEBUG` before including `<cassert>`, as the other assertion-based checks do, or use explicit failure checks so Release builds retain the regression coverage. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
github-bot changed target branch from main to gh-pr/3597/base 2026-11-30 17:24:05 +00:00
github manually merged commit ad61238642 into gh-pr/3597/base 2026-11-30 17:24:07 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-30 17:17 UTC · original · approved these changes

Verified that the indirect-table decode now reports address and span back to the refusal log, including when backing lookup fails after decoding. The environment-gated root diagnostic uses the existing table and allocator locks. Built tests/startup_diagnostic_span_check.cpp with MSVC C++17 and ran it successfully on Windows, covering exact containment, both proximity bounds and overflow. This run covered the helper, not a live draw.

**@⁠R0Y00** on GitHub · 2026-11-30 17:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3597#pullrequestreview-6116957950) · **approved these changes** Verified that the indirect-table decode now reports address and span back to the refusal log, including when backing lookup fails after decoding. The environment-gated root diagnostic uses the existing table and allocator locks. Built `tests/startup_diagnostic_span_check.cpp` with MSVC C++17 and ran it successfully on Windows, covering exact containment, both proximity bounds and overflow. This run covered the helper, not a live draw.
This discussion has been locked. Commenting is limited to contributors.
No description provided.