startup: copy and resolve whole resources on a recording list (slots 15, 17, 19) #1804

Closed
tedin7 wants to merge 1 commit from upstream-pr/1811 into main
tedin7 commented 2026-11-24 19:04:06 +00:00 (Migrated from github.com)

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


Related to #870 (no Fixes).

What changes

In render mode, three command-list slots that were dropped now copy whole resources:

  • slot 15 CopyBufferRegion, slot 17 CopyResource, slot 19 ResolveSubresource (unshifted, like slots 12 to 25).
  • Each argument is mapped to its desktop resource. The pair moves to COPY_SOURCE/COPY_DEST or RESOLVE_SOURCE/RESOLVE_DEST for the call and back to COMMON at Close. An upload buffer stays readable and a readback buffer stays a copy destination.
  • A call the desktop would reject is counted, logged (first six) and not forwarded, with a named reason (size_mismatch, sample_mismatch, range_overflow, source_not_multisampled, ...). Calls on a closed list are ignored.
  • A typeless resolve format resolves as the family's typed choice (half float for R16G16B16A16, as in #1729; normalised for the 8-bit and 10-bit families). One with no single choice (for example R16_TYPELESS) is refused as bad_format.
  • x2w_d3d12_list_copy_stats exports the counters for fixtures.
  • CopyTextureRegion (16) and CopyTiles (18) are left out on purpose.

Code is in new files: src/startup_stubs/list_copy.h (pure checks) and list_copy.inl (handlers). d3d12_xs_device.cpp gets one include of each, plus three install lines after the slot 52 line.

These slots have not been seen in a title log yet; the placement follows the unshifted slot order.

Checks run locally (Linux)

g++ -std=c++17 -Wall -Wextra -Isrc -I/usr/include/directx -I/usr/include/wsl/stubs -include wsl/winadapter.h tests/startup_list_copy_check.cpp
./a.out   # ok; --mutate overflow, typeless, samples each fail
x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only -Isrc tests/startup_list_copy.cpp
x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only ... src/startup_stubs/d3d12_xs_device.cpp   # only the two __try/__except errors of local_log.h, none from the new code
git diff --check
python3 -B tests/docs_links_check.py
python3 -B tests/bidi_controls_check.py
git merge-tree --write-tree HEAD <ref>   # origin/main, #1726, #1787, #1788, #1799, #1800, #1803: no conflicts

Not run

startup_list_copy_{warp,hardware} and the new device code have not been built or run; they need Windows. The fixture records on one list: clear and copy, a swapped copy (the empty texture stays empty), a 4-sample resolve, a typeless half-float resolve, two buffer copies with offsets, four refused calls (size mismatch, null source, one-sample resolve source, range past the end) and calls on a closed list, then reads everything back and checks the debug layer.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6589275239 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1811). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:04:06Z. --- Related to #870 (no `Fixes`). ## What changes In render mode, three command-list slots that were dropped now copy whole resources: - slot 15 `CopyBufferRegion`, slot 17 `CopyResource`, slot 19 `ResolveSubresource` (unshifted, like slots 12 to 25). - Each argument is mapped to its desktop resource. The pair moves to `COPY_SOURCE`/`COPY_DEST` or `RESOLVE_SOURCE`/`RESOLVE_DEST` for the call and back to `COMMON` at Close. An upload buffer stays readable and a readback buffer stays a copy destination. - A call the desktop would reject is counted, logged (first six) and not forwarded, with a named reason (`size_mismatch`, `sample_mismatch`, `range_overflow`, `source_not_multisampled`, ...). Calls on a closed list are ignored. - A typeless resolve format resolves as the family's typed choice (half float for `R16G16B16A16`, as in #1729; normalised for the 8-bit and 10-bit families). One with no single choice (for example `R16_TYPELESS`) is refused as `bad_format`. - `x2w_d3d12_list_copy_stats` exports the counters for fixtures. - `CopyTextureRegion` (16) and `CopyTiles` (18) are left out on purpose. Code is in new files: `src/startup_stubs/list_copy.h` (pure checks) and `list_copy.inl` (handlers). `d3d12_xs_device.cpp` gets one include of each, plus three install lines after the slot 52 line. These slots have not been seen in a title log yet; the placement follows the unshifted slot order. ## Checks run locally (Linux) ``` g++ -std=c++17 -Wall -Wextra -Isrc -I/usr/include/directx -I/usr/include/wsl/stubs -include wsl/winadapter.h tests/startup_list_copy_check.cpp ./a.out # ok; --mutate overflow, typeless, samples each fail x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only -Isrc tests/startup_list_copy.cpp x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only ... src/startup_stubs/d3d12_xs_device.cpp # only the two __try/__except errors of local_log.h, none from the new code git diff --check python3 -B tests/docs_links_check.py python3 -B tests/bidi_controls_check.py git merge-tree --write-tree HEAD <ref> # origin/main, #1726, #1787, #1788, #1799, #1800, #1803: no conflicts ``` ## Not run `startup_list_copy_{warp,hardware}` and the new device code have not been built or run; they need Windows. The fixture records on one list: clear and copy, a swapped copy (the empty texture stays empty), a 4-sample resolve, a typeless half-float resolve, two buffer copies with offsets, four refused calls (size mismatch, null source, one-sample resolve source, range past the end) and calls on a closed list, then reads everything back and checks the debug layer. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 20:00:43 +00:00
tedin7 commented 2026-11-24 20:01:17 +00:00 (Migrated from github.com)

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


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:7141816795 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1811#issuecomment-7141816795). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:14:49Z. --- 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!1804
No description provided.