startup: recheck single-mip A8 atlases every frame #1638

Merged
rm-NoobInCoding merged 1 commit from upstream-pr/1645 into main 2026-11-24 16:11:53 +00:00
rm-NoobInCoding commented 2026-11-24 15:43:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rm-NoobInCoding on 2026-11-24T15:43:28Z.


Change

The startup draw uploader re-hashes a CPU-backed texture that has no XG write notification on its first bind each frame only when it is a single-mip, single-slice R8_UNORM plane. Every other format waits 15 frames (x2w_startup::recheck_cpu_texture, src/startup_stubs/slice_footprints.h).

A text renderer can add glyphs to a single-mip A8_UNORM atlas between draws without an XG copy, so newly added characters reached the desktop copy up to 15 frames late: on each new screen some characters were missing and then appeared at once, about half a second later at ~28 fps.

This change gives single-mip, single-slice A8_UNORM the same one-frame recheck as R8_UNORM. The inclusive 32 MiB cap, the 15-frame interval for every other texture (including A8 with more than one mip or slice) and explicit XG write notifications are unchanged. The two doc passages that state the rule are updated.

No shared interface changes.

Verification

Base 141617bb, patch 126ce023. Windows 11 build 26300, MSVC 19.51.36260, dev preset (Debug), NVIDIA GeForce RTX 4070, driver 617.14, D3D12 debug layer off.

cmake --build --preset dev --target startup_slice_footprints_check startup_plane_refresh d3d12_xs_shim
ctest --preset dev --no-tests=error -R '^(startup_slice_footprints|startup_plane_refresh_)' --output-on-failure

Result: 4/4 passed, no capability skips (startup_plane_refresh_warp, startup_plane_refresh_hardware, startup_slice_footprints, startup_slice_footprints_padded_control).

python -B tests/docs_links_check.py: self-test passed, 16 Markdown files and 348 links checked.

Negative control. With only slice_footprints.h reverted to the base and the new test cases kept, startup_slice_footprints fails 2 of 61 checks:

FAIL A8 atlas: after one frame
FAIL A8 atlas: exactly 32 MiB
startup_slice_footprints: 2 of 61 FAILED

The new cases also require A8 with 2 mips and an A8 array of 2 to keep the 15-frame interval (not read after 1 or 14 frames, read after 15), and A8 past 32 MiB to never be re-read.

Evidence and follow-up

Local diagnostic runs of a console executable on the startup stand-ins (tools/startup/run.ps1 -Render -FakeUser -GpuMirror -HostCpu); raw logs, pointers, binaries and captures are not attached.

  • With a temporary log of every upload whose contents changed without a write notification (not part of this PR), the only such texture other than the cycling R8 decoder planes was a 2048×2048 single-mip A8_UNORM texture. It changed in bursts as new screens added text.
  • With a temporary override forcing a one-frame recheck for all textures, the missing-then-appearing characters were no longer observed.
  • With this patch alone and no override, the characters appeared complete on each new screen across a 200 s run that reached several setup screens; the run ended at its timeout.

The public fixture verifies the recheck interval decision; the visual result is an observation from the local run only.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6585632745 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1645). Originally posted by [rm-NoobInCoding](https://github.com/rm-NoobInCoding) on 2026-11-24T15:43:28Z. --- ## Change The startup draw uploader re-hashes a CPU-backed texture that has no XG write notification on its first bind each frame only when it is a single-mip, single-slice `R8_UNORM` plane. Every other format waits 15 frames (`x2w_startup::recheck_cpu_texture`, `src/startup_stubs/slice_footprints.h`). A text renderer can add glyphs to a single-mip `A8_UNORM` atlas between draws without an XG copy, so newly added characters reached the desktop copy up to 15 frames late: on each new screen some characters were missing and then appeared at once, about half a second later at ~28 fps. This change gives single-mip, single-slice `A8_UNORM` the same one-frame recheck as `R8_UNORM`. The inclusive 32 MiB cap, the 15-frame interval for every other texture (including A8 with more than one mip or slice) and explicit XG write notifications are unchanged. The two doc passages that state the rule are updated. No shared interface changes. ## Verification Base `141617bb`, patch `126ce023`. Windows 11 build 26300, MSVC 19.51.36260, `dev` preset (Debug), NVIDIA GeForce RTX 4070, driver 617.14, D3D12 debug layer off. ```powershell cmake --build --preset dev --target startup_slice_footprints_check startup_plane_refresh d3d12_xs_shim ctest --preset dev --no-tests=error -R '^(startup_slice_footprints|startup_plane_refresh_)' --output-on-failure ``` Result: 4/4 passed, no capability skips (`startup_plane_refresh_warp`, `startup_plane_refresh_hardware`, `startup_slice_footprints`, `startup_slice_footprints_padded_control`). `python -B tests/docs_links_check.py`: self-test passed, 16 Markdown files and 348 links checked. **Negative control.** With only `slice_footprints.h` reverted to the base and the new test cases kept, `startup_slice_footprints` fails 2 of 61 checks: ``` FAIL A8 atlas: after one frame FAIL A8 atlas: exactly 32 MiB startup_slice_footprints: 2 of 61 FAILED ``` The new cases also require A8 with 2 mips and an A8 array of 2 to keep the 15-frame interval (not read after 1 or 14 frames, read after 15), and A8 past 32 MiB to never be re-read. ## Evidence and follow-up Local diagnostic runs of a console executable on the startup stand-ins (`tools/startup/run.ps1 -Render -FakeUser -GpuMirror -HostCpu`); raw logs, pointers, binaries and captures are not attached. - With a temporary log of every upload whose contents changed without a write notification (not part of this PR), the only such texture other than the cycling R8 decoder planes was a 2048×2048 single-mip `A8_UNORM` texture. It changed in bursts as new screens added text. - With a temporary override forcing a one-frame recheck for all textures, the missing-then-appearing characters were no longer observed. - With this patch alone and no override, the characters appeared complete on each new screen across a 200 s run that reached several setup screens; the run ended at its timeout. The public fixture verifies the recheck interval decision; the visual result is an observation from the local run only. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
tedin7 commented 2026-11-24 16:03:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:55:55Z.

Review: COMMENTED


Dual-platform peer review at commit 126ce02388f37ad5b372b2dee5ffaaef8389bfc1: 0 blocking issues.

Findings

  • src/startup_stubs/slice_footprints.h (recheck_cpu_texture): extends the 1-frame recheck rule from single-mip, single-slice DXGI_FORMAT_R8_UNORM textures to also include DXGI_FORMAT_A8_UNORM, while preserving the 15-frame interval for multi-mip/array A8/R8 and all other formats, as well as the inclusive 32 MiB cap.
  • tests/startup_slice_footprints_check.cpp: covers A8 single-mip/single-slice (elapsed_frames 0 vs 1, 32 MiB vs 32 MiB + 1) and negative multi-mip / array-of-2 cases at frames 1, 14, and 15.
  • Documentation (docs/experiments.md, docs/startup-runtime.md) and comment (src/startup_stubs/d3d12_draw.inl) are consistent with the code.

Verification

  • Linux:
    • python3 tests/docs_links_check.py: passed (16 Markdown files, 348 links).
    • python3 tests/bidi_controls_check.py: passed (1266 tracked files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target startup_slice_footprints_check startup_plane_refresh startup_nv12_draw startup_stub_xg_xs -- -j 6 (5.29s); ctest --preset dev -R '^(startup_slice_footprints|startup_slice_footprints_padded_control|startup_plane_refresh_warp|startup_nv12_draw_warp)$' --parallel 4 --no-tests=error --output-on-failure — 4/4 passed (0.38s).
    • Release /O2 (--preset release): cmake --build --preset release --target startup_slice_footprints_check startup_plane_refresh startup_nv12_draw startup_stub_xg_xs -- -j 6 (2.71s); ctest --preset release -R '^(startup_slice_footprints|startup_slice_footprints_padded_control|startup_plane_refresh_warp|startup_nv12_draw_warp)$' --parallel 4 --no-tests=error --output-on-failure — 4/4 passed (0.28s).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042722661 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1645#pullrequestreview-6042722661). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:55:55Z. **Review:** COMMENTED --- Dual-platform peer review at commit `126ce02388f37ad5b372b2dee5ffaaef8389bfc1`: **0 blocking issues**. ### Findings - `src/startup_stubs/slice_footprints.h` (`recheck_cpu_texture`): extends the 1-frame recheck rule from single-mip, single-slice `DXGI_FORMAT_R8_UNORM` textures to also include `DXGI_FORMAT_A8_UNORM`, while preserving the 15-frame interval for multi-mip/array A8/R8 and all other formats, as well as the inclusive 32 MiB cap. - `tests/startup_slice_footprints_check.cpp`: covers A8 single-mip/single-slice (`elapsed_frames` 0 vs 1, 32 MiB vs 32 MiB + 1) and negative multi-mip / array-of-2 cases at frames 1, 14, and 15. - Documentation (`docs/experiments.md`, `docs/startup-runtime.md`) and comment (`src/startup_stubs/d3d12_draw.inl`) are consistent with the code. ### Verification - **Linux**: - `python3 tests/docs_links_check.py`: passed (16 Markdown files, 348 links). - `python3 tests/bidi_controls_check.py`: passed (1266 tracked files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Debug (`--preset dev`): `cmake --build --preset dev --target startup_slice_footprints_check startup_plane_refresh startup_nv12_draw startup_stub_xg_xs -- -j 6` (`5.29s`); `ctest --preset dev -R '^(startup_slice_footprints|startup_slice_footprints_padded_control|startup_plane_refresh_warp|startup_nv12_draw_warp)$' --parallel 4 --no-tests=error --output-on-failure` — **4/4 passed** (`0.38s`). - Release `/O2` (`--preset release`): `cmake --build --preset release --target startup_slice_footprints_check startup_plane_refresh startup_nv12_draw startup_stub_xg_xs -- -j 6` (`2.71s`); `ctest --preset release -R '^(startup_slice_footprints|startup_slice_footprints_padded_control|startup_plane_refresh_warp|startup_nv12_draw_warp)$' --parallel 4 --no-tests=error --output-on-failure` — **4/4 passed** (`0.28s`). AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 17:01:47 +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!1638
No description provided.