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

Closed
tedin7 wants to merge 1 commit from upstream-pr/1799 into main
tedin7 commented 2026-11-24 18:50:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:50:30Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6589040337 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1799). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:50:30Z. --- 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.
upstream-sync closed this pull request 2026-11-24 20:00:39 +00:00
tedin7 commented 2026-11-24 20:01:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:14:34Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7141810405 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1799#issuecomment-7141810405). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:14:34Z. --- 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

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!1792
No description provided.