startup: name the causes of a refused placed build and accept PERFORM_UPDATE with a source structure #1799

Closed
github-bot wants to merge 1 commit from gh-pr/1799/head into gh-pr/1799/base
Owner

@⁠tedin7 on GitHub · 2026-11-24 18:50 UTC · original
tedin7:x2w-frontier-placed-update → main · +302 −15 · 6 files · 1 commits · closed without merging

Related to #870 and #1758 (no Fixes). resolve_placed_build collapsed six different refusals into one opaque E_INVALIDARG and refused every update build. This names the causes and accepts PERFORM_UPDATE with a source structure. d3d12_memory_srv.inl and placed_buffer_range are untouched.

Changes

  • src/startup_stubs/placed_build.h: a standard-C++-only part with PlacedBuildCause (ok, unaligned, not_placed, wrong_state, range, update_without_source, source_without_update, source_unaligned, source_not_placed, source_wrong_state, source_range, source_dest_partial_overlap), cause_name, ranges_overlap and check_update_shape. The Windows declarations stay below, under _WIN32.
  • resolve_placed_build returns the same E_INVALIDARG and still publishes nothing on a refusal, and now logs x2w-dxr placed build refused: <cause> (<dest|scratch|source> at title 0x...) once per cause.
  • With PERFORM_UPDATE, the source goes through the same placement lookup as the destination, unchanged (a live placed buffer in the acceleration-structure state, 256-byte aligned). The scratch is sized by UpdateScratchDataSizeInBytes. The update may run in place (source == destination) or write another structure; a source that partly overlaps the destination is refused. Nothing is published unless all three addresses resolve.
  • tests/placed_build_causes_check.cpp (registered as placed_build_causes): the device-free rules, including both aliasing outcomes and the boundaries. tests/dxr_placed_build.h (used by dxr_placed_build_{hardware,warp}): six refused updates (no source, source without the flag, unaligned, unmapped, wrong state, partial overlap), an in-place update and an out-of-place one with its interior offset kept.
  • Notes in docs/experiments.md.

Verified (Linux)

  • g++ -std=c++17 -O2 -Wall -Wextra -fsanitize=address,undefined on tests/placed_build_causes_check.cpp: no warnings, passes.
  • Five mutations of placed_build.h, each failing the check, original restored: in-place update refused, partial overlap accepted, overlap boundary off by one, source alignment unchecked, update flag without source accepted.
  • MinGW -fsyntax-only on d3d12_xs_device.cpp (only the MSVC-only __try/__except of local_log.h, as on main) and on tests/cpu/placed_dxr_provider.cpp, which includes the fixture header.
  • git diff --check origin/main...HEAD, tests/docs_links_check.py, tests/bidi_controls_check.py: pass.
  • git merge-tree: no conflicts with main, #1766, #1787, #1788, #1789, #1744, #1726. #1441 already conflicts with main on its own.

Not verified

  • The WARP and hardware runs (dxr_placed_build_*) need Windows and were not run here; they should be run in CI or on Windows Server 2025. The device cases of the fixture are untested.
  • No update build is recorded or dispatched: tests/cpu/placed_dxr_provider.cpp is unchanged, because recording an update needs a changed trace helper.
  • The resolver cannot tell whether the source was built with ALLOW_UPDATE, which an update needs.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 18:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1799) `tedin7:x2w-frontier-placed-update` → `main` · +302 −15 · 6 files · 1 commits · closed without merging Related to #870 and #1758 (no `Fixes`). `resolve_placed_build` collapsed six different refusals into one opaque `E_INVALIDARG` and refused every update build. This names the causes and accepts `PERFORM_UPDATE` with a source structure. `d3d12_memory_srv.inl` and `placed_buffer_range` are untouched. ### Changes - `src/startup_stubs/placed_build.h`: a standard-C++-only part with `PlacedBuildCause` (`ok`, `unaligned`, `not_placed`, `wrong_state`, `range`, `update_without_source`, `source_without_update`, `source_unaligned`, `source_not_placed`, `source_wrong_state`, `source_range`, `source_dest_partial_overlap`), `cause_name`, `ranges_overlap` and `check_update_shape`. The Windows declarations stay below, under `_WIN32`. - `resolve_placed_build` returns the same `E_INVALIDARG` and still publishes nothing on a refusal, and now logs `x2w-dxr placed build refused: <cause> (<dest|scratch|source> at title 0x...)` once per cause. - With `PERFORM_UPDATE`, the source goes through the same placement lookup as the destination, unchanged (a live placed buffer in the acceleration-structure state, 256-byte aligned). The scratch is sized by `UpdateScratchDataSizeInBytes`. The update may run in place (source == destination) or write another structure; a source that partly overlaps the destination is refused. Nothing is published unless all three addresses resolve. - `tests/placed_build_causes_check.cpp` (registered as `placed_build_causes`): the device-free rules, including both aliasing outcomes and the boundaries. `tests/dxr_placed_build.h` (used by `dxr_placed_build_{hardware,warp}`): six refused updates (no source, source without the flag, unaligned, unmapped, wrong state, partial overlap), an in-place update and an out-of-place one with its interior offset kept. - Notes in `docs/experiments.md`. ### Verified (Linux) - `g++ -std=c++17 -O2 -Wall -Wextra -fsanitize=address,undefined` on `tests/placed_build_causes_check.cpp`: no warnings, passes. - Five mutations of `placed_build.h`, each failing the check, original restored: in-place update refused, partial overlap accepted, overlap boundary off by one, source alignment unchecked, update flag without source accepted. - MinGW `-fsyntax-only` on `d3d12_xs_device.cpp` (only the MSVC-only `__try`/`__except` of `local_log.h`, as on `main`) and on `tests/cpu/placed_dxr_provider.cpp`, which includes the fixture header. - `git diff --check origin/main...HEAD`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`: pass. - `git merge-tree`: no conflicts with `main`, #1766, #1787, #1788, #1789, #1744, #1726. #1441 already conflicts with `main` on its own. ### Not verified - The WARP and hardware runs (`dxr_placed_build_*`) need Windows and were not run here; they should be run in CI or on Windows Server 2025. The device cases of the fixture are untested. - No update build is recorded or dispatched: `tests/cpu/placed_dxr_provider.cpp` is unchanged, because recording an update needs a changed trace helper. - The resolver cannot tell whether the source was built with `ALLOW_UPDATE`, which an update needs. AI-assisted; commands listed were executed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:34:07 +00:00
github-bot closed this pull request 2026-11-26 23:34:07 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 19:14 UTC · original

Closing this draft for now to help keep the open PR queue manageable; the branch stays preserved on the fork so it can be reopened once the queue clears.

**@⁠tedin7** on GitHub · 2026-11-24 19:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1799#issuecomment-7141810405) Closing this draft for now to help keep the open PR queue manageable; the branch stays preserved on the fork so it can be reopened once the queue clears.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.