startup: refresh directly written R8 planes on frame reuse #1238
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1238
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1238/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@R0Y00 on GitHub · 2026-11-24 04:56 UTC · original
R0Y00:codex/cpu-plane-refresh→main· +125 −3 · 5 files · 2 commits · merged 2026-11-24 05:26 UTCRefs #870, #874. This supplies the runtime texture side of CPU-written image refresh. #1110 covers updates to buffer SRVs.
The startup wrapper checked directly written image data every 15 presented frames. Reusing one of three CPU-backed images between those checks could display old pixels while the desktop continued presenting. Recheck single-slice, single-mip R8_UNORM textures of up to 32 MiB on the first bind of each new frame. The existing content hash avoids a copy when bytes match. Explicit write notifications still take precedence.
Built commit
0f496ab6in Release under Windows build 26200. NVIDIA GeForce RTX 4060 Laptop driver 32.0.16.1656 and Microsoft WARP 10.0.26100.9818 each passed the same six-image test. The debug layer was off. Both read back 306/306 current R8 pixels. With the reused planes intentionally left stale, exactly 153/306 pixels differed, all matching their original buffer contents. Zero skips.The fixture uses source-built CPU images, the uploader's refresh decision and the desktop footprint copy on each backend. Decoded, uploaded and presented frame counts from a whole-program run remain a separate end-to-end measurement.
@tedin7 on GitHub · 2026-11-24 05:03 UTC · original · reviewed
Reviewed commit
0f496ab6(Linux host; Windows build andstartup_plane_refresh_{warp,hardware}were not executed locally).Code & Edge-Case Audit
src/startup_stubs/slice_footprints.h(recheck_cpu_texture) &src/startup_stubs/d3d12_draw.inl(upload_texture):elapsed >= 1) toDXGI_FORMAT_R8_UNORM,MipLevels == 1,DepthOrArraySize == 1, andtotal <= 32 MiB; other formats retain the 15-frame interval.elapseduses unsigned subtraction (static_cast<UINT>(frame_number) - static_cast<UINT>(state.checked_frame)), avoiding signed overflow onLONGwraparound.state.checked_frame = frame_numberis updated before thehash == state.hashearly return, so an unchanged plane is not re-hashed multiple times within the same frame, and explicit XG write notifications (announced) still bypass the interval check.recheck_cpu_texturechecksdesc.DepthOrArraySize == 1directly (whileupload_texturenormalizes0to1inslices), andMipLevels == 0(full mip chain) is excluded; both are safe/conservative.tests/startup_plane_refresh.cpp&docs/experiments.md:AGENTS.mdcompliant). The test validatesrecheck_cpu_textureboundary cases (elapsed 0 vs 1,32 MiB + 1,R8G8B8A8_UNORMat 14 vs 15) and the 6-frame / 3-texture rotation pattern, thoughupload_textureitself is not exercised directly by this test.Checks Run (Linux / Python)
git diff --check origin/main...HEAD: pass (0 issues)/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 280 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1049 files)ctest -R '^startup_plane_refresh_': not run locally.