Refresh CPU-backed shader inputs between fenced submissions #1110

Manually merged
github merged 2 commits from gh-pr/1110/head into gh-pr/1110/base 2026-11-26 22:42:23 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 01:10 UTC · original
R0Y00:codex/cpu-srv-refresh → main · +170 −0 · 7 files · 2 commits · merged 2026-11-24 12:37 UTC

Refs #874, #870.

cpu_srv::refresh updates an existing upload range for a stable shader-resource view. The caller serializes updates and submits, holds the CPU input stable during the copy, and supplies the fence point covering prior GPU readers. Unreadable input and an unfinished fence preserve the live data. The fixture uses the same R16_UINT view for both compute dispatches.

On Windows build 26200, RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818 passed all four Release tests with the D3D12 debug layer enabled, zero warnings, zero errors and zero skips. The second readback changes from 1398 2467 to 8765 fe01 after refresh. Skipping the refresh preserves the original pair. Rejections include an incomplete fence, a write extending beyond the endpoint, an overflowing offset and an unreadable source.

cmake --build --preset release --target offscreen_check
ctest --preset release --no-tests=error -R '^cpu_srv_' -V

This PR covers the source-built shader input and its CPU/GPU handoff. Diagnostic runtime integration is tracked in #870.

**@⁠R0Y00** on GitHub · 2026-11-24 01:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1110) `R0Y00:codex/cpu-srv-refresh` → `main` · +170 −0 · 7 files · 2 commits · merged 2026-11-24 12:37 UTC Refs #874, #870. `cpu_srv::refresh` updates an existing upload range for a stable shader-resource view. The caller serializes updates and submits, holds the CPU input stable during the copy, and supplies the fence point covering prior GPU readers. Unreadable input and an unfinished fence preserve the live data. The fixture uses the same `R16_UINT` view for both compute dispatches. On Windows build 26200, RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818 passed all four Release tests with the D3D12 debug layer enabled, zero warnings, zero errors and zero skips. The second readback changes from `1398 2467` to `8765 fe01` after refresh. Skipping the refresh preserves the original pair. Rejections include an incomplete fence, a write extending beyond the endpoint, an overflowing offset and an unreadable source. ``` cmake --build --preset release --target offscreen_check ctest --preset release --no-tests=error -R '^cpu_srv_' -V ``` This PR covers the source-built shader input and its CPU/GPU handoff. Diagnostic runtime integration is tracked in #870.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:42:22 +00:00
github manually merged commit 4ca3c951a2 into gh-pr/1110/base 2026-11-26 22:42:23 +00:00
Author
Owner

@⁠Toons29 on GitHub · 2026-11-24 02:02 UTC · original

Tested 9f23be2b on an AMD Radeon RX 9070 (RDNA 4, 1002:7550), driver 32.0.32029.2010, Windows 11 build 26300, dev preset, debug layer unavailable: pass

ctest --preset dev --no-tests=error -R '^cpu_srv_' -V

All 4 pass with no skips. cpu_srv_refresh reads 00001398,00002467 after fence 1 and 00008765,0000fe01 after fence 2 on both the RX 9070 and in-box WARP. cpu_srv_stale keeps 00001398,00002467 after fence 2 on both, as expected.

**@⁠Toons29** on GitHub · 2026-11-24 02:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1110#issuecomment-7119702847) Tested 9f23be2b on an AMD Radeon RX 9070 (RDNA 4, `1002:7550`), driver `32.0.32029.2010`, Windows 11 build 26300, `dev` preset, debug layer unavailable: pass ```powershell ctest --preset dev --no-tests=error -R '^cpu_srv_' -V ``` All 4 pass with no skips. `cpu_srv_refresh` reads `00001398,00002467` after fence 1 and `00008765,0000fe01` after fence 2 on both the RX 9070 and in-box WARP. `cpu_srv_stale` keeps `00001398,00002467` after fence 2 on both, as expected.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 12:28 UTC · original

Resolved the CMake conflict at 4ca3c951 by retaining the CPU SRV and startup sampler shader registrations. Windows Release: 12/12 CPU SRV refresh/stale, descriptor-window, and startup sampler cases passed on RTX and WARP, with no skips.

**@⁠R0Y00** on GitHub · 2026-11-24 12:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1110#issuecomment-7131501314) Resolved the CMake conflict at 4ca3c951 by retaining the CPU SRV and startup sampler shader registrations. Windows Release: 12/12 CPU SRV refresh/stale, descriptor-window, and startup sampler cases passed on RTX and WARP, with no skips.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:15 UTC · original · reviewed

Reviewed at 9f23be2b232f96c9e48edb90c4cb9b97fb47bcdf.

  • Code & structure: cpu_srv::refresh in src/cpu_srv_upload.h validates inputs, buffer dimension, overflow-safe bounds (bytes > desc.Width - destination_offset), D3D12_HEAP_TYPE_UPLOAD, and fence completion (UINT64_MAX -> DXGI_ERROR_DEVICE_REMOVED, done < previous_value -> DXGI_ERROR_WAS_STILL_DRAWING). Staging via ReadProcessMemory before Map/memcpy/Unmap ensures an unreadable source page fails without altering the upload buffer (minor note: per-call heap allocation + ReadProcessMemory is great for safety here, though worth keeping in mind if ever used on a hot path). check_cpu_srv_refresh in tests/descriptor_window_submissions.cpp covers both refresh and --cpu-srv-stale plus the negative cases.
  • Linux checks run: python3 -B tests/docs_links_check.py (15 files, 246 links), python3 -B tests/bidi_controls_check.py (929 files), python3 -B tests/gpu_report_format_check.py (10 tests), and python3 -B tests/xgameruntime_table_check.py — all passed.
  • CI / Windows: gh pr checks 1110 shows all 4 Windows/Linux checks passed (publish skipped); Windows MSVC/WARP/hardware execution is covered by CI.
**@⁠tedin7** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1110#pullrequestreview-6032633724) · **reviewed** Reviewed at `9f23be2b232f96c9e48edb90c4cb9b97fb47bcdf`. - **Code & structure**: `cpu_srv::refresh` in `src/cpu_srv_upload.h` validates inputs, buffer dimension, overflow-safe bounds (`bytes > desc.Width - destination_offset`), `D3D12_HEAP_TYPE_UPLOAD`, and fence completion (`UINT64_MAX` -> `DXGI_ERROR_DEVICE_REMOVED`, `done < previous_value` -> `DXGI_ERROR_WAS_STILL_DRAWING`). Staging via `ReadProcessMemory` before `Map`/`memcpy`/`Unmap` ensures an unreadable source page fails without altering the upload buffer (minor note: per-call heap allocation + `ReadProcessMemory` is great for safety here, though worth keeping in mind if ever used on a hot path). `check_cpu_srv_refresh` in `tests/descriptor_window_submissions.cpp` covers both refresh and `--cpu-srv-stale` plus the negative cases. - **Linux checks run**: `python3 -B tests/docs_links_check.py` (15 files, 246 links), `python3 -B tests/bidi_controls_check.py` (929 files), `python3 -B tests/gpu_report_format_check.py` (10 tests), and `python3 -B tests/xgameruntime_table_check.py` — all passed. - **CI / Windows**: `gh pr checks 1110` shows all 4 Windows/Linux checks passed (publish skipped); Windows MSVC/WARP/hardware execution is covered by CI.
This discussion has been locked. Commenting is limited to contributors.
No description provided.