startup: wire per-reason refusal census into translated indirect draws #2325

Merged
stan495 merged 2 commits from upstream-pr/2333 into main 2026-11-25 13:31:15 +00:00
stan495 commented 2026-11-25 12:41:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T12:41:48Z.


Refs #2274 (runtime follow-up to #2301).

Summary

  • Wire x2w_startup::PerReasonRefusalCensus (indirect-draw) into src/startup_stubs/d3d12_xs_device.cpp and src/startup_stubs/d3d12_draw.inl for translated ExecuteIndirect draw refusals (draw_translated_indirect):
    • Add a short, space-free refusal_code tag alongside the existing prose refusal message on TranslatedIndirectDraw for every refusal path in draw_translated (missing_guest_root, sampled_texture_mismatch, unsupported_resource_or_entry, incomplete_table_buffer, incomplete_vertex_stream, live_compute_pipeline, indexed_rect_unavailable, sampled_texture_unbindable, indexed_validation_failed, translation_not_ready, d16_srv_not_ready, pipeline_unavailable, sampler_heap_unavailable).
    • Record (shader_key, refusal_code) in indirect_draw_refusal_census.note(...) and keep logging the first occurrence of each of the first 8 distinct (key, reason) pairs even after the 32-call refusal log budget is spent, while leaving the existing per-call log line format unchanged.
    • Emit delta summaries and rows from indirect_draw_refusal_census.report(..., true) in the five-second heartbeat report.
    • Emit the full x2w-d3d12 indirect-draw refusals: block from x2w_d3d12_census_report(...) whenever indirect_draw_refusal_census.total() != 0, preserving the existing 4-line output contract for zero-refusal memory-SRV fixtures (startup_memory_srv_diag_*).
  • Add end-to-end WARP, hardware, and negative-control runtime tests in tests/startup_indirect_draw_indexed.cpp and CMakeLists.txt:
    • startup_indirect_translated_refusal_census_{warp,hardware} interleaves missing_guest_root (x2) and sampled_texture_mismatch (x1) on one translated pipeline key alongside unsupported_resource_or_entry (x1) and incomplete_table_buffer (x2) on two other keys plus a valid draw, verifying exact x2w_d3d12_census_report totals (total 6; distinct keys 3, distinct pairs 4 (overflow calls 0)), all four per-(key, reason) rows, both per-call log lines for the shared key, and zero D3D12 debug layer errors.
    • startup_indirect_translated_refusal_census_control_warp replaces the second refusal on key 1 with a valid draw and asserts the mismatch reports the real counts (total 5; distinct keys 3, distinct pairs 3 (overflow calls 0)).
  • Update docs/startup-runtime.md to document the runtime wiring and exact ctest commands.

Verification

  • Commit under test: ad3cf6cf
  • Environment: Windows 11 25H2 Build 26200.9974, MSVC 19.44.35228.0 (Debug preset)
    • WARP: Microsoft Basic Render Driver, driver 10.0.26100.9818, D3D12 debug layer enabled (0 errors)
    • Hardware: AMD Radeon RX 7900 XTX, driver 32.0.32029.2010, D3D12 debug layer enabled (0 errors)
.\tools\dev.ps1
cmake --preset dev "-DINTAKE_PYTHON=E:\02_Workspace\Xbox2Windows\out\pe-env\Scripts\python.exe"
cmake --build --preset dev --target startup_indirect_draw_indexed startup_stream_consumer offscreen_check startup_per_reason_refusal_census_check startup_per_reason_refusal_census_keep_last_control startup_per_reason_refusal_census_keep_first_control --parallel
ctest --preset dev --no-tests=error -R '^(startup_indirect_translated_refusal_census_(warp|hardware|control_warp)|startup_indirect_translated_draw_(warp|hardware)|startup_indirect_draw_indexed_warp|startup_indirect_counts_control_warp|startup_per_reason_refusal_census(_keep-(last|first)_control)?|startup_memory_srv_diag_(warp|hardware|supported_control_warp))$' -V
ctest --preset dev --no-tests=error -R '^startup_indirect_(translated_indexed|copy_provenance).*(warp|hardware)$' --output-on-failure
.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py
.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py
git diff --check

Observed results:

  • Core + negative-control + memory-SRV compatibility suite: 13/13 passed, 0 failed, 0 skipped (both WARP and AMD Radeon RX 7900 XTX hardware passed with debug layer enabled; startup_indirect_translated_refusal_census_control_warp reported the expected mismatch total 5; distinct keys 3, distinct pairs 3 (overflow calls 0); startup_memory_srv_diag_{warp,hardware,supported_control_warp} preserved the 4-line contract).
  • Additional translated-indexed and copy-provenance indirect suite: 14/14 passed, 0 failed, 0 skipped.
  • offscreen_check: built cleanly with no errors.
  • tests/docs_links_check.py: passed (18 Markdown files, 453 links).
  • tests/bidi_controls_check.py: passed (1621 tracked files).
  • git diff --check: clean.

Scope note

These synthetic source-built fixtures verify per-(key, reason) refusal counting, detail-budget preservation, heartbeat/export reporting, and negative controls in d3d12_xs_shim on WARP and an RX 7900 XTX. They do not establish full-game startup or execution of title CPU code.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6604717024 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333). Originally posted by [stan495](https://github.com/stan495) on 2026-11-25T12:41:48Z. --- Refs #2274 (runtime follow-up to #2301). ## Summary - Wire `x2w_startup::PerReasonRefusalCensus` (`indirect-draw`) into `src/startup_stubs/d3d12_xs_device.cpp` and `src/startup_stubs/d3d12_draw.inl` for translated `ExecuteIndirect` draw refusals (`draw_translated_indirect`): - Add a short, space-free `refusal_code` tag alongside the existing prose `refusal` message on `TranslatedIndirectDraw` for every refusal path in `draw_translated` (`missing_guest_root`, `sampled_texture_mismatch`, `unsupported_resource_or_entry`, `incomplete_table_buffer`, `incomplete_vertex_stream`, `live_compute_pipeline`, `indexed_rect_unavailable`, `sampled_texture_unbindable`, `indexed_validation_failed`, `translation_not_ready`, `d16_srv_not_ready`, `pipeline_unavailable`, `sampler_heap_unavailable`). - Record `(shader_key, refusal_code)` in `indirect_draw_refusal_census.note(...)` and keep logging the first occurrence of each of the first 8 distinct `(key, reason)` pairs even after the 32-call refusal log budget is spent, while leaving the existing per-call log line format unchanged. - Emit delta summaries and rows from `indirect_draw_refusal_census.report(..., true)` in the five-second heartbeat report. - Emit the full `x2w-d3d12 indirect-draw refusals:` block from `x2w_d3d12_census_report(...)` whenever `indirect_draw_refusal_census.total() != 0`, preserving the existing 4-line output contract for zero-refusal memory-SRV fixtures (`startup_memory_srv_diag_*`). - Add end-to-end WARP, hardware, and negative-control runtime tests in `tests/startup_indirect_draw_indexed.cpp` and `CMakeLists.txt`: - `startup_indirect_translated_refusal_census_{warp,hardware}` interleaves `missing_guest_root` (x2) and `sampled_texture_mismatch` (x1) on one translated pipeline key alongside `unsupported_resource_or_entry` (x1) and `incomplete_table_buffer` (x2) on two other keys plus a valid draw, verifying exact `x2w_d3d12_census_report` totals (`total 6; distinct keys 3, distinct pairs 4 (overflow calls 0)`), all four per-`(key, reason)` rows, both per-call log lines for the shared key, and zero D3D12 debug layer errors. - `startup_indirect_translated_refusal_census_control_warp` replaces the second refusal on key 1 with a valid draw and asserts the mismatch reports the real counts (`total 5; distinct keys 3, distinct pairs 3 (overflow calls 0)`). - Update `docs/startup-runtime.md` to document the runtime wiring and exact `ctest` commands. ## Verification - Commit under test: `ad3cf6cf` - Environment: Windows 11 25H2 Build 26200.9974, MSVC 19.44.35228.0 (Debug preset) - WARP: `Microsoft Basic Render Driver`, driver `10.0.26100.9818`, D3D12 debug layer enabled (0 errors) - Hardware: `AMD Radeon RX 7900 XTX`, driver `32.0.32029.2010`, D3D12 debug layer enabled (0 errors) ```powershell .\tools\dev.ps1 cmake --preset dev "-DINTAKE_PYTHON=E:\02_Workspace\Xbox2Windows\out\pe-env\Scripts\python.exe" cmake --build --preset dev --target startup_indirect_draw_indexed startup_stream_consumer offscreen_check startup_per_reason_refusal_census_check startup_per_reason_refusal_census_keep_last_control startup_per_reason_refusal_census_keep_first_control --parallel ctest --preset dev --no-tests=error -R '^(startup_indirect_translated_refusal_census_(warp|hardware|control_warp)|startup_indirect_translated_draw_(warp|hardware)|startup_indirect_draw_indexed_warp|startup_indirect_counts_control_warp|startup_per_reason_refusal_census(_keep-(last|first)_control)?|startup_memory_srv_diag_(warp|hardware|supported_control_warp))$' -V ctest --preset dev --no-tests=error -R '^startup_indirect_(translated_indexed|copy_provenance).*(warp|hardware)$' --output-on-failure .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py git diff --check ``` Observed results: - Core + negative-control + memory-SRV compatibility suite: **13/13 passed, 0 failed, 0 skipped** (both WARP and `AMD Radeon RX 7900 XTX` hardware passed with debug layer enabled; `startup_indirect_translated_refusal_census_control_warp` reported the expected mismatch `total 5; distinct keys 3, distinct pairs 3 (overflow calls 0)`; `startup_memory_srv_diag_{warp,hardware,supported_control_warp}` preserved the 4-line contract). - Additional translated-indexed and copy-provenance indirect suite: **14/14 passed, 0 failed, 0 skipped**. - `offscreen_check`: built cleanly with no errors. - `tests/docs_links_check.py`: passed (18 Markdown files, 453 links). - `tests/bidi_controls_check.py`: passed (1621 tracked files). - `git diff --check`: clean. ## Scope note These synthetic source-built fixtures verify per-`(key, reason)` refusal counting, detail-budget preservation, heartbeat/export reporting, and negative controls in `d3d12_xs_shim` on WARP and an RX 7900 XTX. They do not establish full-game startup or execution of title CPU code.
tedin7 commented 2026-11-25 13:00:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:45:33Z.

Review: COMMENTED


Review of head ad3cf6cf3136742e81c2eb04cfd8318704b2768e (comment only).

What I checked

  • git diff --stat origin/main...HEAD: 5 files, +160/-12 (CMakeLists, docs, d3d12_draw.inl, d3d12_xs_device.cpp, startup_indirect_draw_indexed.cpp).
  • python3 tests/docs_links_check.py -> self-test passed, 18 Markdown files, 453 links OK.
  • python3 tests/bidi_controls_check.py -> 1621 files, no bidirectional controls.
  • git diff --check origin/main...HEAD -> clean.
  • CI on this head: Linux Python checks, gfx1013 fixtures, Windows build+test all pass. Mergeable, title neutral, no clean-room concerns seen.

Logic read-through

  • Every return false path in draw_translated that sets refusal now also sets a stable refusal_code. The ternary paths (translation_not_ready/d16_srv_not_ready, pipeline_unavailable/sampler_heap_unavailable, incomplete_vertex_stream/incomplete_table_buffer) pick the right code. The indexed_rect && !pipeline case is excluded from the second assignment so it is not overwritten. Correct.
  • census.note() is called only when shader_key != 0, then logs on first (key, reason) pair OR the old 32-call budget. This keeps the old log budget and adds a line for each new reason. Good.
  • The census is registered in the 5-second report and in x2w_d3d12_census_report (only when total > 0, so existing consumers see no change).
  • Test: the positive case checks the summary line, 4 detail rows (order, key identity, reason, calls) and the two log lines. A negative control (...-control, expects a total of 5) is registered with PASS_REGULAR_EXPRESSION. This is a real GPU-path test on WARP and hardware backends, not a string check.

Findings

  • P1: none.
  • P2: none.
  • nit: refusals with no resolved translated pipeline (shader_key == 0, !tr) are not counted in the census. That is the same gating as the old log, but the docs could say so in one sentence so the "total" is not read as "all indirect-draw refusals".
  • nit: refusal_code strings are bare literals repeated at each site. A small constexpr list would prevent typos, but the test pins the three most important ones, so this is optional.

Mutation

  • The new tests are Windows-only D3D12 executables (__declspec(dllimport), WARP/hardware), so I could not build or mutate them on Linux. I did not run Win2025 for this review. The Windows CI job built and ran the new CTest entries and passed. I make no claim about a mutation result.

No blocking issues found.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057847892 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#pullrequestreview-6057847892). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:45:33Z. **Review:** COMMENTED --- Review of head `ad3cf6cf3136742e81c2eb04cfd8318704b2768e` (comment only). **What I checked** - `git diff --stat origin/main...HEAD`: 5 files, +160/-12 (CMakeLists, docs, d3d12_draw.inl, d3d12_xs_device.cpp, startup_indirect_draw_indexed.cpp). - `python3 tests/docs_links_check.py` -> self-test passed, 18 Markdown files, 453 links OK. - `python3 tests/bidi_controls_check.py` -> 1621 files, no bidirectional controls. - `git diff --check origin/main...HEAD` -> clean. - CI on this head: Linux Python checks, gfx1013 fixtures, Windows build+test all pass. Mergeable, title neutral, no clean-room concerns seen. **Logic read-through** - Every `return false` path in `draw_translated` that sets `refusal` now also sets a stable `refusal_code`. The ternary paths (`translation_not_ready`/`d16_srv_not_ready`, `pipeline_unavailable`/`sampler_heap_unavailable`, `incomplete_vertex_stream`/`incomplete_table_buffer`) pick the right code. The `indexed_rect && !pipeline` case is excluded from the second assignment so it is not overwritten. Correct. - `census.note()` is called only when `shader_key != 0`, then logs on first (key, reason) pair OR the old 32-call budget. This keeps the old log budget and adds a line for each new reason. Good. - The census is registered in the 5-second report and in `x2w_d3d12_census_report` (only when total > 0, so existing consumers see no change). - Test: the positive case checks the summary line, 4 detail rows (order, key identity, reason, calls) and the two log lines. A negative control (`...-control`, expects a total of 5) is registered with `PASS_REGULAR_EXPRESSION`. This is a real GPU-path test on WARP and hardware backends, not a string check. **Findings** - P1: none. - P2: none. - nit: refusals with no resolved translated pipeline (`shader_key == 0`, `!tr`) are not counted in the census. That is the same gating as the old log, but the docs could say so in one sentence so the "total" is not read as "all indirect-draw refusals". - nit: `refusal_code` strings are bare literals repeated at each site. A small `constexpr` list would prevent typos, but the test pins the three most important ones, so this is optional. **Mutation** - The new tests are Windows-only D3D12 executables (`__declspec(dllimport)`, WARP/hardware), so I could not build or mutate them on Linux. I did not run Win2025 for this review. The Windows CI job built and ran the new CTest entries and passed. I make no claim about a mutation result. No blocking issues found. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 13:00:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:52:10Z.

Review: COMMENTED


Review of head 1c431de9560d24bdf4f0a7361e49790ebc959a7d (comment only, no approval).

Scope read: git diff --stat origin/main...HEAD = 5 files, +182/-12 (CMakeLists.txt, docs/startup-runtime.md, d3d12_draw.inl, d3d12_xs_device.cpp, tests/startup_indirect_draw_indexed.cpp). Title is neutral, PR is MERGEABLE. CI at review time: Linux Python job pass, Windows jobs still pending.

Commands executed locally (Linux):

  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 453 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls
  • git diff --check origin/main...HEAD -> clean
  • g++ -std=c++17 -Isrc tests/startup_per_reason_refusal_census_check.cpp + run -> PASS (distinct keys=2, pairs=4, detail=8, max=128) (the census header this PR wires in)

Not run: the new startup_indirect_translated_refusal_census_{warp,hardware} tests and the ..._control_warp negative control need D3D12, so they cannot run on Linux. I did not queue Win2025 here; the Windows CI jobs / a Stage-2 WARP run should confirm them. For the same reason I could not do a runtime mutation of the new logic; I checked it by reading instead.

Findings

  • P1: none.
  • P2: none.
  • Nit 1, src/startup_stubs/d3d12_draw.inl (draw_translated, the indexed_rect && !pipeline branch): it dereferences indirect without a null check. This was already the case before the PR and the new line keeps it. Guarding with indirect && would be a cheap hardening.
  • Nit 2, d3d12_draw.inl draw_translated_indirect: note() now takes the census mutex on every refused indirect draw once shader_key != 0, even after the 32-call log budget. The header comment says it is sized for refusal paths, which is fine. A storm of refusals per frame would contend on that lock, so it is worth keeping in mind.
  • Nit 3: the 14 refusal_code names and the prose refusal strings are set at separate sites. A future refusal path that sets only the prose string would be counted as pipeline_or_target_unavailable (the default). A short comment at the struct, or a test that walks every code, would catch that drift.

Checked by reading (OK):

  • Every refusal return path in draw_translated sets a matching code. The !tr path leaves shader_key == 0, so it is correctly not counted.
  • The ordering tr->state != 1 -> translation_not_ready, otherwise d16_srv_not_ready, is correct for the guarded condition.
  • The !pipeline vs sampler_heap_unavailable split is correct, and the indexed_rect case keeps its own code.
  • The 4-line zero-refusal output contract is preserved by the total() != 0 guard in x2w_d3d12_census_report.
  • The CMake wiring adds the test with TIMEOUT 60 and SKIP 77, like its sibling translated tests, plus a negative control with an exact PASS_REGULAR_EXPRESSION.
  • Clean-room: no third-party code or names seen.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057949937 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#pullrequestreview-6057949937). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:52:10Z. **Review:** COMMENTED --- Review of head `1c431de9560d24bdf4f0a7361e49790ebc959a7d` (comment only, no approval). **Scope read:** `git diff --stat origin/main...HEAD` = 5 files, +182/-12 (CMakeLists.txt, docs/startup-runtime.md, d3d12_draw.inl, d3d12_xs_device.cpp, tests/startup_indirect_draw_indexed.cpp). Title is neutral, PR is MERGEABLE. CI at review time: Linux Python job pass, Windows jobs still pending. **Commands executed locally (Linux):** - `python3 tests/docs_links_check.py` -> `Checked 18 Markdown files and 453 links.` - `python3 tests/bidi_controls_check.py` -> `no bidirectional controls` - `git diff --check origin/main...HEAD` -> clean - `g++ -std=c++17 -Isrc tests/startup_per_reason_refusal_census_check.cpp` + run -> `PASS (distinct keys=2, pairs=4, detail=8, max=128)` (the census header this PR wires in) **Not run:** the new `startup_indirect_translated_refusal_census_{warp,hardware}` tests and the `..._control_warp` negative control need D3D12, so they cannot run on Linux. I did not queue Win2025 here; the Windows CI jobs / a Stage-2 WARP run should confirm them. For the same reason I could not do a runtime mutation of the new logic; I checked it by reading instead. **Findings** - P1: none. - P2: none. - Nit 1, `src/startup_stubs/d3d12_draw.inl` (`draw_translated`, the `indexed_rect && !pipeline` branch): it dereferences `indirect` without a null check. This was already the case before the PR and the new line keeps it. Guarding with `indirect &&` would be a cheap hardening. - Nit 2, `d3d12_draw.inl` `draw_translated_indirect`: `note()` now takes the census mutex on every refused indirect draw once `shader_key != 0`, even after the 32-call log budget. The header comment says it is sized for refusal paths, which is fine. A storm of refusals per frame would contend on that lock, so it is worth keeping in mind. - Nit 3: the 14 `refusal_code` names and the prose `refusal` strings are set at separate sites. A future refusal path that sets only the prose string would be counted as `pipeline_or_target_unavailable` (the default). A short comment at the struct, or a test that walks every code, would catch that drift. **Checked by reading (OK):** - Every refusal return path in `draw_translated` sets a matching code. The `!tr` path leaves `shader_key == 0`, so it is correctly not counted. - The ordering `tr->state != 1` -> `translation_not_ready`, otherwise `d16_srv_not_ready`, is correct for the guarded condition. - The `!pipeline` vs `sampler_heap_unavailable` split is correct, and the `indexed_rect` case keeps its own code. - The 4-line zero-refusal output contract is preserved by the `total() != 0` guard in `x2w_d3d12_census_report`. - The CMake wiring adds the test with TIMEOUT 60 and SKIP 77, like its sibling translated tests, plus a negative control with an exact `PASS_REGULAR_EXPRESSION`. - Clean-room: no third-party code or names seen. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 14:04:47 +00:00
tedin7 commented 2026-11-25 14:04:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:11:38Z.

Review: COMMENTED


Review of head 7d355dd18b (comment only, no approval).

Scope: 5 files, +198/-20. Wires PerReasonRefusalCensus into draw_translated_indirect, replaces ad-hoc refusal prose with a set_refusal(message, code) pair, adds a report line in queue_present and x2w_d3d12_census_report, plus a new translated-refusal-census test and a negative control.

Commands run locally (Linux, in a clean worktree of the PR head):

  • git diff --stat origin/main...HEAD: 5 files changed, 198 insertions, 20 deletions
  • git diff --check origin/main...HEAD: clean
  • python3 tests/docs_links_check.py: Self-test passed. Checked 19 Markdown files and 455 links.
  • python3 tests/bidi_controls_check.py: Checked 1637 tracked files: no bidirectional controls.
  • gh pr checks 2333: Linux Python checks, Windows build/test and gfx1013 fixtures were still pending when I looked, so I have no CI verdict. The Windows test is the only real proof for this C++ change.
  • Not run: Windows WARP/hardware tests and the mutation check. The new code is Windows-only D3D12 (__declspec(dllimport), x2w_d3d12_census_report), so it does not build on Linux. I did not queue the Windows VM.

Findings

P1: none.

P2-1 src/startup_stubs/d3d12_draw.inl (draw_translated_indirect): the log condition is now first_pair || first_calls(refused, 32). Because of short-circuit evaluation, first_calls only advances on non-first-pair refusals. The old code spent a 32-line budget on every refusal. The new behaviour looks intended, since every new (key, reason) pair gets a line and repeats keep the cap. Please say so in the PR text. Also confirm that a long run with many distinct pairs cannot flood the log. It is bounded by the census max_entries, but overflow calls still return first_pair == false, so that part is fine.

P2-2 d3d12_draw.inl, early return at !tr || tr->state != 1 || !d16_srvs_ready: here refusal_code is set but refusal prose is not (it keeps the default "translated pipeline or target unavailable"). The log line therefore shows the same text for translation_not_ready and d16_srv_not_ready. The census row tells them apart, so this is not a bug. A short prose message would make the log match the census.

P2-3 indirect_refusal_code::pipeline_or_target_unavailable is also the default for any early refusal that never calls set_refusal (!tr with shader_key == 0 is not counted at all, as documented). Fine, but a comment next to the default would help.

Nit: in the indexed_rect && !pipeline branch, set_refusal is guarded by the new indirect && check. The old code dereferenced indirect unconditionally there, so this also fixes a latent null dereference for non-indirect indexed-rect draws. Good catch; mention it in the PR body.

Nit: the test parses with %63s and %16[0-9a-f]. A longer reason string would fail the parse with a clear "malformed" message, which is fine.

Correctness notes

  • Each refusal site pairs a unique code with its prose. I checked all 13 codes against the sites in the diff and found no duplicates or mismatches.
  • refusal_code is set before ReleaseSRWLockExclusive on every path, and note() runs outside draw_lock. The census has its own lock.
  • Test design: the 6-refusal scenario covers 3 keys and 4 pairs with exact counts, checks that a valid draw does not count, and checks the log lines. The control test (replace one refusal with a valid draw, expecting total 5 and 3 pairs) proves the check can fail.
  • Mutation: not run, see above. For the Windows run, the useful mutations are swapping missing_guest_root and sampled_texture_mismatch in draw_translated, and dropping the indirect && guard. Both should make the exact row assertions fail.

Recommendation: wait for the Windows CI and a Win2025 WARP/hardware run of startup_indirect_translated_refusal_census_* before merge.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058231617 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#pullrequestreview-6058231617). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:11:38Z. **Review:** COMMENTED --- Review of head 7d355dd18b0ad02fd4d8af2e9b4404c0fb1b148b (comment only, no approval). Scope: 5 files, +198/-20. Wires `PerReasonRefusalCensus` into `draw_translated_indirect`, replaces ad-hoc refusal prose with a `set_refusal(message, code)` pair, adds a report line in `queue_present` and `x2w_d3d12_census_report`, plus a new `translated-refusal-census` test and a negative control. Commands run locally (Linux, in a clean worktree of the PR head): - `git diff --stat origin/main...HEAD`: 5 files changed, 198 insertions, 20 deletions - `git diff --check origin/main...HEAD`: clean - `python3 tests/docs_links_check.py`: Self-test passed. Checked 19 Markdown files and 455 links. - `python3 tests/bidi_controls_check.py`: Checked 1637 tracked files: no bidirectional controls. - `gh pr checks 2333`: Linux Python checks, Windows build/test and gfx1013 fixtures were still pending when I looked, so I have no CI verdict. The Windows test is the only real proof for this C++ change. - Not run: Windows WARP/hardware tests and the mutation check. The new code is Windows-only D3D12 (`__declspec(dllimport)`, `x2w_d3d12_census_report`), so it does not build on Linux. I did not queue the Windows VM. Findings P1: none. P2-1 `src/startup_stubs/d3d12_draw.inl` (`draw_translated_indirect`): the log condition is now `first_pair || first_calls(refused, 32)`. Because of short-circuit evaluation, `first_calls` only advances on non-first-pair refusals. The old code spent a 32-line budget on every refusal. The new behaviour looks intended, since every new (key, reason) pair gets a line and repeats keep the cap. Please say so in the PR text. Also confirm that a long run with many distinct pairs cannot flood the log. It is bounded by the census `max_entries`, but overflow calls still return `first_pair == false`, so that part is fine. P2-2 `d3d12_draw.inl`, early return at `!tr || tr->state != 1 || !d16_srvs_ready`: here `refusal_code` is set but `refusal` prose is not (it keeps the default "translated pipeline or target unavailable"). The log line therefore shows the same text for `translation_not_ready` and `d16_srv_not_ready`. The census row tells them apart, so this is not a bug. A short prose message would make the log match the census. P2-3 `indirect_refusal_code::pipeline_or_target_unavailable` is also the default for any early refusal that never calls `set_refusal` (`!tr` with `shader_key == 0` is not counted at all, as documented). Fine, but a comment next to the default would help. Nit: in the `indexed_rect && !pipeline` branch, `set_refusal` is guarded by the new `indirect &&` check. The old code dereferenced `indirect` unconditionally there, so this also fixes a latent null dereference for non-indirect indexed-rect draws. Good catch; mention it in the PR body. Nit: the test parses with `%63s` and `%16[0-9a-f]`. A longer reason string would fail the parse with a clear "malformed" message, which is fine. Correctness notes - Each refusal site pairs a unique code with its prose. I checked all 13 codes against the sites in the diff and found no duplicates or mismatches. - `refusal_code` is set before `ReleaseSRWLockExclusive` on every path, and `note()` runs outside `draw_lock`. The census has its own lock. - Test design: the 6-refusal scenario covers 3 keys and 4 pairs with exact counts, checks that a valid draw does not count, and checks the log lines. The control test (replace one refusal with a valid draw, expecting total 5 and 3 pairs) proves the check can fail. - Mutation: not run, see above. For the Windows run, the useful mutations are swapping `missing_guest_root` and `sampled_texture_mismatch` in `draw_translated`, and dropping the `indirect &&` guard. Both should make the exact row assertions fail. Recommendation: wait for the Windows CI and a Win2025 WARP/hardware run of `startup_indirect_translated_refusal_census_*` before merge. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:04:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:29:58Z.

Review: COMMENTED


Review of head 46fbcbdfeb9b95a37914d8ec901d0acdee03496f.

Verdict: no blocking findings (P1=0, P2=0). The census wiring is correct and the new tests guard it.

What I checked

  • Every refusal path in draw_translated that can run with indirect set now records a short refusal_code. The prose refusal text is unchanged, and set_refusal keeps the two in sync.
  • The old if (indexed_rect && !pipeline) indirect->refusal = ... could dereference a null indirect. It is now guarded with indirect &&. That is a good fix.
  • Census calls happen only on the refusal path, and the census uses its own mutex.
  • x2w_d3d12_census_report appends the block only when total() != 0, so the 4-line output of zero-refusal fixtures stays the same.
  • CI on this head is green: Linux Python checks, gfx1013 fixtures, and Windows build and test.
  • The PR is mergeable. The title is neutral. The docs now match the code.

Commands executed locally (Linux)

  • git diff --stat origin/main...HEAD: 5 files, +198/-20.
  • python3 tests/docs_links_check.py: Self-test passed. Checked 19 Markdown files and 459 links.
  • python3 tests/bidi_controls_check.py: no bidirectional controls in 1641 files.
  • git diff --check origin/main...HEAD: clean.
  • g++ -std=c++17 -Isrc tests/startup_per_reason_refusal_census_check.cpp && ./a.out: PASS (keys=2, pairs=4, detail=8, max=128).

Windows (WARP), python3 x2w_pipe.py win2025 2333 --wait 3600 --skip-release

  • Direct scope: 100% tests passed out of 47.
  • That includes startup_indirect_translated_refusal_census_warp and startup_indirect_translated_refusal_census_control_warp.
  • Neighbouring tests also passed: startup_indirect_translated_draw_warp, startup_indirect_translated_indexed_rect_warp, startup_indirect_translated_indexed_upload_warp and startup_indirect_counts_control_warp.
  • Release was skipped (--skip-release) because this change does not touch shader lowering.

Mutation test

  • I changed the missing_guest_root code in d3d12_draw.inl to sampled_texture_mismatch, and applied it with --patch on Win2025.
  • startup_indirect_translated_refusal_census_warp FAILED, so the test kills it. The other 46 tests still passed.
  • The mutation was reverted locally.

Nits (non-blocking)

  • draw_translated: for translation_not_ready, d16_srv_not_ready, pipeline_unavailable and sampler_heap_unavailable, only refusal_code is set. The prose log line then shows the generic default, "translated pipeline or target unavailable". That is fine, but a prose message per code would help log readers.
  • The new test covers 4 of the 13 codes. The others (live_compute_pipeline, indexed_validation_failed and so on) have no end-to-end check. A table-driven test could add them later.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058502616 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#pullrequestreview-6058502616). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:29:58Z. **Review:** COMMENTED --- Review of head `46fbcbdfeb9b95a37914d8ec901d0acdee03496f`. **Verdict: no blocking findings (P1=0, P2=0).** The census wiring is correct and the new tests guard it. What I checked - Every refusal path in `draw_translated` that can run with `indirect` set now records a short `refusal_code`. The prose `refusal` text is unchanged, and `set_refusal` keeps the two in sync. - The old `if (indexed_rect && !pipeline) indirect->refusal = ...` could dereference a null `indirect`. It is now guarded with `indirect &&`. That is a good fix. - Census calls happen only on the refusal path, and the census uses its own mutex. - `x2w_d3d12_census_report` appends the block only when `total() != 0`, so the 4-line output of zero-refusal fixtures stays the same. - CI on this head is green: Linux Python checks, gfx1013 fixtures, and Windows build and test. - The PR is mergeable. The title is neutral. The docs now match the code. Commands executed locally (Linux) - `git diff --stat origin/main...HEAD`: 5 files, +198/-20. - `python3 tests/docs_links_check.py`: Self-test passed. Checked 19 Markdown files and 459 links. - `python3 tests/bidi_controls_check.py`: no bidirectional controls in 1641 files. - `git diff --check origin/main...HEAD`: clean. - `g++ -std=c++17 -Isrc tests/startup_per_reason_refusal_census_check.cpp && ./a.out`: PASS (keys=2, pairs=4, detail=8, max=128). Windows (WARP), `python3 x2w_pipe.py win2025 2333 --wait 3600 --skip-release` - Direct scope: 100% tests passed out of 47. - That includes `startup_indirect_translated_refusal_census_warp` and `startup_indirect_translated_refusal_census_control_warp`. - Neighbouring tests also passed: `startup_indirect_translated_draw_warp`, `startup_indirect_translated_indexed_rect_warp`, `startup_indirect_translated_indexed_upload_warp` and `startup_indirect_counts_control_warp`. - Release was skipped (`--skip-release`) because this change does not touch shader lowering. Mutation test - I changed the `missing_guest_root` code in `d3d12_draw.inl` to `sampled_texture_mismatch`, and applied it with `--patch` on Win2025. - `startup_indirect_translated_refusal_census_warp` FAILED, so the test kills it. The other 46 tests still passed. - The mutation was reverted locally. Nits (non-blocking) - `draw_translated`: for `translation_not_ready`, `d16_srv_not_ready`, `pipeline_unavailable` and `sampler_heap_unavailable`, only `refusal_code` is set. The prose log line then shows the generic default, "translated pipeline or target unavailable". That is fine, but a prose message per code would help log readers. - The new test covers 4 of the 13 codes. The others (`live_compute_pipeline`, `indexed_validation_failed` and so on) have no end-to-end check. A table-driven test could add them later. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:05:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:05:05Z.


@stan495 could you rebase this branch onto current main and force-push?

GitHub reports head 1c431de9 as conflicting with main, so it cannot be merged as is.

Files that conflict with current main (4ea0c770):

  • tests/startup_indirect_draw_indexed.cpp

Commands run locally:

git fetch origin main pull/2333/head
git merge-tree --write-tree --name-only origin/main FETCH_HEAD
gh pr view 2333 --json mergeable   # CONFLICTING

Once it is rebased and CI is green it will be re-checked right away.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163267719 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#issuecomment-7163267719). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:05:05Z. --- @stan495 could you rebase this branch onto current `main` and force-push? GitHub reports head `1c431de9` as conflicting with `main`, so it cannot be merged as is. Files that conflict with current `main` (`4ea0c770`): - `tests/startup_indirect_draw_indexed.cpp` Commands run locally: ``` git fetch origin main pull/2333/head git merge-tree --write-tree --name-only origin/main FETCH_HEAD gh pr view 2333 --json mergeable # CONFLICTING ``` Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:05:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:20:05Z.


@stan495 could you rebase this branch onto current main and force-push?

GitHub reports head 7d355dd1 as conflicting with main, so it cannot be merged as is.

Files that conflict with current main (214ed093):

  • tests/startup_indirect_draw_indexed.cpp

Commands run locally:

git fetch origin main pull/2333/head
git merge-tree --write-tree --name-only origin/main FETCH_HEAD
gh pr view 2333 --json mergeable   # CONFLICTING

Once it is rebased and CI is green it will be re-checked right away.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163626168 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2333#issuecomment-7163626168). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:20:05Z. --- @stan495 could you rebase this branch onto current `main` and force-push? GitHub reports head `7d355dd1` as conflicting with `main`, so it cannot be merged as is. Files that conflict with current `main` (`214ed093`): - `tests/startup_indirect_draw_indexed.cpp` Commands run locally: ``` git fetch origin main pull/2333/head git merge-tree --write-tree --name-only origin/main FETCH_HEAD gh pr view 2333 --json mergeable # CONFLICTING ``` Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally.
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!2325
No description provided.