startup: implement next copy command-list slot in d3d12_xs_device (Part of #870) #2070

Manually merged
github merged 7 commits from gh-pr/2070/head into gh-pr/2070/base 2026-11-26 23:54:01 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 23:58 UTC · original
tedin7:x2w-870-copy-slot → main · +738 −1 · 7 files · 7 commits · merged 2026-11-25 14:51 UTC

Part of #870

What this unblocks: command-list slot 16 CopyTextureRegion (texture to texture, texture to buffer, buffer to texture) is no longer dropped in render mode, so title copies reach the desktop list.

What changes

  • Slot 16 maps both locations to their desktop resources, checks the arguments, moves the pair to COPY_SOURCE / COPY_DEST for the call (Close returns them to COMMON), and forwards the call.
  • A call the desktop would reject is counted, logged (first six) and not forwarded, with a named reason: unknown_resource, buffer_to_buffer, bad_box, source_overflow, dest_overflow, bad_pitch, bad_offset, footprint_overflow, sample_mismatch, bad_alignment.
  • Pure checks live in src/startup_stubs/list_copy_texture.h; the handler is in list_copy_texture.inl (one include and one install line in d3d12_xs_device.cpp).
  • x2w_d3d12_list_copy_texture_stats exports the counters.
  • CopyTiles (18) is left out on purpose. Slots 15, 17, 19 are in #1944.

The slot placement follows the unshifted order of slots 12 to 25 and has not been seen in a title log yet.

Verification: (Win2025: x2w_pipe.py win2025 2070 at head 91c13296, debug and release /O2, release ctest 23/23 passed incl. startup_list_copy_texture and startup_list_copy_texture_overflow_control; Linux checks below)

g++ -std=c++17 -Wall -Wextra -o /tmp/lct tests/startup_list_copy_texture_check.cpp && /tmp/lct   # ok
/tmp/lct --mutate overflow   # FAIL: dest overflow (negative control, exit 1)
x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only -Isrc -Isrc/startup_stubs src/startup_stubs/d3d12_xs_device.cpp   # only the 2 existing __try/__except errors of this toolchain
git diff --check   # clean
**@⁠tedin7** on GitHub · 2026-11-24 23:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070) `tedin7:x2w-870-copy-slot` → `main` · +738 −1 · 7 files · 7 commits · merged 2026-11-25 14:51 UTC Part of #870 What this unblocks: command-list slot 16 `CopyTextureRegion` (texture to texture, texture to buffer, buffer to texture) is no longer dropped in render mode, so title copies reach the desktop list. ## What changes - Slot 16 maps both locations to their desktop resources, checks the arguments, moves the pair to `COPY_SOURCE` / `COPY_DEST` for the call (Close returns them to `COMMON`), and forwards the call. - A call the desktop would reject is counted, logged (first six) and not forwarded, with a named reason: `unknown_resource`, `buffer_to_buffer`, `bad_box`, `source_overflow`, `dest_overflow`, `bad_pitch`, `bad_offset`, `footprint_overflow`, `sample_mismatch`, `bad_alignment`. - Pure checks live in `src/startup_stubs/list_copy_texture.h`; the handler is in `list_copy_texture.inl` (one include and one install line in `d3d12_xs_device.cpp`). - `x2w_d3d12_list_copy_texture_stats` exports the counters. - `CopyTiles` (18) is left out on purpose. Slots 15, 17, 19 are in #1944. The slot placement follows the unshifted order of slots 12 to 25 and has not been seen in a title log yet. Verification: (Win2025: `x2w_pipe.py win2025 2070` at head 91c13296, debug and release /O2, release ctest 23/23 passed incl. `startup_list_copy_texture` and `startup_list_copy_texture_overflow_control`; Linux checks below) ``` g++ -std=c++17 -Wall -Wextra -o /tmp/lct tests/startup_list_copy_texture_check.cpp && /tmp/lct # ok /tmp/lct --mutate overflow # FAIL: dest overflow (negative control, exit 1) x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only -Isrc -Isrc/startup_stubs src/startup_stubs/d3d12_xs_device.cpp # only the 2 existing __try/__except errors of this toolchain git diff --check # clean ```
Maps both copy locations to desktop resources, refuses calls the desktop would reject with a named reason, and forwards the rest with COPY_SOURCE/COPY_DEST states.
Index = mip + slice * mips + plane * mips * array_size must lie inside the resource; planar,
format-mismatched and partial multisampled copies are refused; footprint arithmetic is checked
at each multiply and add. Adds a wrapped-list readback test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:54:00 +00:00
github manually merged commit 809e1b2159 into gh-pr/2070/base 2026-11-26 23:54:01 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:07 UTC · original · edited 2026-11-25 00:13 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T00:13:43.971479Z 91c1329 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#issuecomment-7148159082) · edited 2026-11-25 00:13 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"91c1329631b9cfa32f24d5f63eed2491976c7218","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T00:13:43.971479Z">2026-11-25T00:13:43.971479Z</relative-time> | `91c1329` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P1 Badge Preserve fixed states for upload and readback footprint buffers

For footprint buffers on UPLOAD or READBACK heaps, these calls emit invalid barriers. device_create_committed_x() creates those resources in GENERIC_READ and COPY_DEST respectively, but require_state() assumes an unseen resource starts in COMMON, transitions it to the requested state, and returns it to COMMON at Close. Upload/readback resources must remain in their fixed heap states, so ordinary buffer-to-texture uploads and texture-to-buffer readbacks can invalidate the whole command list. Detect these heap types and exclude them from the COMMON-based transition tracking.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402816) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Preserve fixed states for upload and readback footprint buffers** For footprint buffers on UPLOAD or READBACK heaps, these calls emit invalid barriers. `device_create_committed_x()` creates those resources in GENERIC_READ and COPY_DEST respectively, but `require_state()` assumes an unseen resource starts in COMMON, transitions it to the requested state, and returns it to COMMON at Close. Upload/readback resources must remain in their fixed heap states, so ordinary buffer-to-texture uploads and texture-to-buffer readbacks can invalidate the whole command list. Detect these heap types and exclude them from the COMMON-based transition tracking. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P2 Badge Materialize non-aliased source data before copying

When a source texture has been filled through its guest backing but has never been sampled, unwrapping own().real does not provide its current contents. Placed textures use non-aliased desktop stand-ins, and d3d12_draw.inl::upload_texture() normally populates them lazily during a draw; this handler never invokes that synchronization. Likewise, slot 133 can return non-aliased Placement::copied_buffer sources. Copies from these backings therefore read stale or zero desktop data instead of the supplied source bytes. Materialize the relevant source data before forwarding, or explicitly refuse unsupported backings.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402823) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Materialize non-aliased source data before copying** When a source texture has been filled through its guest backing but has never been sampled, unwrapping `own().real` does not provide its current contents. Placed textures use non-aliased desktop stand-ins, and `d3d12_draw.inl::upload_texture()` normally populates them lazily during a draw; this handler never invokes that synchronization. Likewise, slot 133 can return non-aliased `Placement::copied_buffer` sources. Copies from these backings therefore read stale or zero desktop data instead of the supplied source bytes. Materialize the relevant source data before forwarding, or explicitly refuse unsupported backings. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -0,0 +155,4 @@
to.pResource = real_dst;
from.pResource = real_src;
static_cast<ID3D12GraphicsCommandList*>(self->own().real)->CopyTextureRegion(&to, x, y, z, &from, box ? box : nullptr);
InterlockedIncrement(&list_copy_texture_forwarded);
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P2 Badge Prevent lazy uploads from overwriting copied textures

For a destination texture with title_memory, no render-target/depth/UAV flags, and no previous sampler bind, this copy updates only the desktop resource and leaves its TextureUpload cache untouched. On the first subsequent sample, draw_translated() calls upload_texture(), whose initial done == false schedules an upload from the stale guest backing over the copied pixels. Thus a valid copy from a rendered texture into a shader-only texture is lost before it is sampled. Publish the GPU write to the texture-coherence tracking so the first-bind uploader preserves copied contents.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402831) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Prevent lazy uploads from overwriting copied textures** For a destination texture with `title_memory`, no render-target/depth/UAV flags, and no previous sampler bind, this copy updates only the desktop resource and leaves its `TextureUpload` cache untouched. On the first subsequent sample, `draw_translated()` calls `upload_texture()`, whose initial `done == false` schedules an upload from the stale guest backing over the copied pixels. Thus a valid copy from a rendered texture into a shader-only texture is lost before it is sampled. Publish the GPU write to the texture-coherence tracking so the first-bind uploader preserves copied contents. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P2 Badge Transition subresources separately for intra-resource copies

When the locations name different subresources of the same texture, such as two array slices, both checks pass but real_src == real_dst. require_state() tracks states per resource, and transition() always uses ALL_SUBRESOURCES, so the second call moves the source subresource back out of COPY_SOURCE and into COPY_DEST immediately before the copy. This turns a legal intra-resource copy into an invalid D3D12 command. Track and transition the selected subresources independently, or refuse this case until that is supported.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402838) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Transition subresources separately for intra-resource copies** When the locations name different subresources of the same texture, such as two array slices, both checks pass but `real_src == real_dst`. `require_state()` tracks states per resource, and `transition()` always uses ALL_SUBRESOURCES, so the second call moves the source subresource back out of COPY_SOURCE and into COPY_DEST immediately before the copy. This turns a legal intra-resource copy into an invalid D3D12 command. Track and transition the selected subresources independently, or refuse this case until that is supported. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P2 Badge Include copy origins in footprint buffer bounds

For partial footprint copies, the byte-end calculation uses only the copied extent and ignores both the destination origin and the source box origin. The portable checker returns ok for a 1x1 RGBA8 copy into a 64x64 footprint with row pitch 256, buffer size 256, and destination Y=63, although the write ends at byte 16132. Source boxes with nonzero top/front have the same problem, and 3D slice strides must use the footprint height rather than the copied height. Include those offsets and strides, or conservatively validate the complete footprint, before forwarding an out-of-buffer copy.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402847) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Include copy origins in footprint buffer bounds** For partial footprint copies, the byte-end calculation uses only the copied extent and ignores both the destination origin and the source box origin. The portable checker returns `ok` for a 1x1 RGBA8 copy into a 64x64 footprint with row pitch 256, buffer size 256, and destination Y=63, although the write ends at byte 16132. Source boxes with nonzero top/front have the same problem, and 3D slice strides must use the footprint height rather than the copied height. Include those offsets and strides, or conservatively validate the complete footprint, before forwarding an out-of-buffer copy. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -4786,6 +4787,7 @@ void build_tables()
list_typed[139] = reinterpret_cast<ListTyped>(&list_reset);
list_typed[148] = reinterpret_cast<ListTyped>(&list_allocate_upload);
list_typed[12] = reinterpret_cast<ListTyped>(&list_draw);
list_typed[16] = reinterpret_cast<ListTyped>(&list_copy_texture);
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original

P1 Badge Document the new copy-slot capability and reproduction command

Installing slot 16 changes the public startup-runtime capability and adds a new reproducible fixture, but neither README.md nor docs/experiments.md is updated; repository-wide searches find the new fixture only in source, tests, and CMake. The root AGENTS.md explicitly requires updating one of those documents when a public capability or reproduction command changes. Add the fixture command, its measured portable-check scope, and the unverified Windows-forwarding status rather than leaving that information only in the commit message.

AGENTS.md reference: AGENTS.md:L211-L212

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688402855) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new copy-slot capability and reproduction command** Installing slot 16 changes the public startup-runtime capability and adds a new reproducible fixture, but neither `README.md` nor `docs/experiments.md` is updated; repository-wide searches find the new fixture only in source, tests, and CMake. The root `AGENTS.md` explicitly requires updating one of those documents when a public capability or reproduction command changes. Add the fixture command, its measured portable-check scope, and the unverified Windows-forwarding status rather than leaving that information only in the commit message. AGENTS.md reference: [AGENTS.md:L211-L212](https://github.com/R0Y00/Xbox2Windows/blob/91c1329631b9cfa32f24d5f63eed2491976c7218/AGENTS.md#L211-L212) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:13 UTC · original

All 6 review threads fixed and pushed in 394dbe3a (rebased on origin/main).

**@⁠tedin7** on GitHub · 2026-11-25 01:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#issuecomment-7149336317) All 6 review threads fixed and pushed in 394dbe3a (rebased on origin/main).
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in 394dbe3a: fixed_heap_state() detects UPLOAD/READBACK buffers and skips require_state() for them; an upload destination or readback source is refused (bad_heap). Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688991070) Fixed in 394dbe3a: `fixed_heap_state()` detects UPLOAD/READBACK buffers and skips `require_state()` for them; an upload destination or readback source is refused (`bad_heap`). Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in 394dbe3a: texture sides call upload_texture() before the copy; a non-aliased copied-buffer source is refused (stale_source). Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688991501) Fixed in 394dbe3a: texture sides call `upload_texture()` before the copy; a non-aliased copied-buffer source is refused (`stale_source`). Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
@ -0,0 +155,4 @@
to.pResource = real_dst;
from.pResource = real_src;
static_cast<ID3D12GraphicsCommandList*>(self->own().real)->CopyTextureRegion(&to, x, y, z, &from, box ? box : nullptr);
InterlockedIncrement(&list_copy_texture_forwarded);
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in 394dbe3a: the destination texture is uploaded via upload_texture() before the copy, so the first sample no longer schedules an upload over the copied texels. Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688991981) Fixed in 394dbe3a: the destination texture is uploaded via `upload_texture()` before the copy, so the first sample no longer schedules an upload over the copied texels. Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in 394dbe3a: a copy whose two sides are the same resource is refused (same_resource) since states are tracked per resource. Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688992444) Fixed in 394dbe3a: a copy whose two sides are the same resource is refused (`same_resource`) since states are tracked per resource. Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in 394dbe3a: footprint_end() includes the destination/source-box origin and the footprint-height slice stride; tests added (dest origin Y=63 -> footprint_overflow, box origin, 3D slice stride). Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688992934) Fixed in 394dbe3a: `footprint_end()` includes the destination/source-box origin and the footprint-height slice stride; tests added (dest origin Y=63 -> footprint_overflow, box origin, 3D slice stride). Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
@ -4786,6 +4787,7 @@ void build_tables()
list_typed[139] = reinterpret_cast<ListTyped>(&list_reset);
list_typed[148] = reinterpret_cast<ListTyped>(&list_allocate_upload);
list_typed[12] = reinterpret_cast<ListTyped>(&list_draw);
list_typed[16] = reinterpret_cast<ListTyped>(&list_copy_texture);
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 01:33 UTC · original

Fixed in a2702c0d: new section 'Command list CopyTextureRegion (list slot 16)' in docs/startup-runtime.md with capability, scope, unverified Windows forwarding, and the command ctest --preset dev --no-tests=error -R '^startup_list_copy_texture' -V. Win2025 x2w_pipe.py win2025 2070: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#discussion_r4688993370) Fixed in a2702c0d: new section 'Command list CopyTextureRegion (list slot 16)' in docs/startup-runtime.md with capability, scope, unverified Windows forwarding, and the command `ctest --preset dev --no-tests=error -R '^startup_list_copy_texture' -V`. Win2025 `x2w_pipe.py win2025 2070`: dev and release 23/23 ctest passed, incl. startup_list_copy_texture and its overflow control. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 03:03 UTC · original

Addressed in d7610f5b (code in 2927598b).

Fix:

  • The subresource index is now decoded as mip + slice * mips + plane * mips * array_size and must lie inside mips * array_size * planes. A mip-only modulo no longer reads an out-of-range slice as mip 0 (bad_subresource). Planar formats are refused (planar_unsupported).
  • Both sides must name the same format (format_mismatch) and the same sample count (sample_mismatch). A multisampled copy must be whole subresource to whole subresource at origin 0 (partial_multisample).
  • Every multiply and add in the footprint extent arithmetic is overflow-checked.
  • All refusals happen before any barrier, upload or desktop copy.

Regression tests:

  • startup_list_copy_texture (Linux and Windows): index decode, last valid index, one past the last slice, 0xffffffff, sample counts, formats, checked arithmetic. Negative controls: startup_list_copy_texture_overflow_control, startup_list_copy_texture_slice_control.
  • startup_list_copy_texture_warp (new): through the wrapped list, two images round-trip through array slices 1 and 2 and read back byte for byte. A list with subresource 6, 0xffffffff and a format mismatch is refused before any desktop copy, and a sentinel-filled readback buffer stays unchanged.

Verification:

  • g++ -std=c++17 -Wall -Wextra -Isrc tests/startup_list_copy_texture_check.cpp and run: ok. Both --mutate overflow and --mutate slice fail as expected.
  • python3 -B tests/docs_links_check.py and tests/bidi_controls_check.py: pass.
  • python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 2070 at d7610f5b: dev 25/25 and release 25/25 pass (100%), including startup_list_copy_texture_warp.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 03:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#issuecomment-7151544697) Addressed in d7610f5b (code in 2927598b). Fix: - The subresource index is now decoded as `mip + slice * mips + plane * mips * array_size` and must lie inside `mips * array_size * planes`. A mip-only modulo no longer reads an out-of-range slice as mip 0 (`bad_subresource`). Planar formats are refused (`planar_unsupported`). - Both sides must name the same format (`format_mismatch`) and the same sample count (`sample_mismatch`). A multisampled copy must be whole subresource to whole subresource at origin 0 (`partial_multisample`). - Every multiply and add in the footprint extent arithmetic is overflow-checked. - All refusals happen before any barrier, upload or desktop copy. Regression tests: - `startup_list_copy_texture` (Linux and Windows): index decode, last valid index, one past the last slice, `0xffffffff`, sample counts, formats, checked arithmetic. Negative controls: `startup_list_copy_texture_overflow_control`, `startup_list_copy_texture_slice_control`. - `startup_list_copy_texture_warp` (new): through the wrapped list, two images round-trip through array slices 1 and 2 and read back byte for byte. A list with subresource 6, `0xffffffff` and a format mismatch is refused before any desktop copy, and a sentinel-filled readback buffer stays unchanged. Verification: - `g++ -std=c++17 -Wall -Wextra -Isrc tests/startup_list_copy_texture_check.cpp` and run: ok. Both `--mutate overflow` and `--mutate slice` fail as expected. - `python3 -B tests/docs_links_check.py` and `tests/bidi_controls_check.py`: pass. - `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 2070` at d7610f5b: dev 25/25 and release 25/25 pass (100%), including `startup_list_copy_texture_warp`. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:13 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91c1329631

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#pullrequestreview-6049544071) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `91c1329631` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-25 02:00 UTC · original · requested changes

The validation currently derives mip using modulo without checking the full subresource index (including array slice and plane), and computes format_src/format_dst without checking compatibility. An invalid subresource can reach the desktop call. A multisample mismatch also needs exact sample-count validation and whole-subresource restrictions. Please begin with a documented slice whose subresource range, formats and sample count are all known, and refuse the others before upload or barriers. Make the footprint extent arithmetic checked at each multiply/add before submitting. Add a source-built wrapped-list readback, with a bad index and incompatible format rejected before any desktop copy; arithmetic-only tests can continue to cover the size checks. Desktop CopyTextureRegion contract

**@⁠R0Y00** on GitHub · 2026-11-25 02:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#pullrequestreview-6050502079) · **requested changes** The validation currently derives `mip` using modulo without checking the full subresource index (including array slice and plane), and computes `format_src`/`format_dst` without checking compatibility. An invalid subresource can reach the desktop call. A multisample mismatch also needs exact sample-count validation and whole-subresource restrictions. Please begin with a documented slice whose subresource range, formats and sample count are all known, and refuse the others before upload or barriers. Make the footprint extent arithmetic checked at each multiply/add before submitting. Add a source-built wrapped-list readback, with a bad index and incompatible format rejected before any desktop copy; arithmetic-only tests can continue to cover the size checks. [Desktop CopyTextureRegion contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion)
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-25 14:45 UTC · original · approved these changes

The array-slice, format and footprint changes address the original review. During recheck I found that a multisampled copy could still forward a non-null source box covering the full resource. The desktop API requires a null box for those copies and for depth-stencil copies. I added exact controls for both and kept the existing reasons for other refusals. Windows Release passed all five selected checks. The wrapped-list copies round-tripped both slices and kept the refused index/format cases off the desktop path on WARP and RTX 4060 Laptop.

Reference: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion

**@⁠R0Y00** on GitHub · 2026-11-25 14:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2070#pullrequestreview-6059798428) · **approved these changes** The array-slice, format and footprint changes address the original review. During recheck I found that a multisampled copy could still forward a non-null source box covering the full resource. The desktop API requires a null box for those copies and for depth-stencil copies. I added exact controls for both and kept the existing reasons for other refusals. Windows Release passed all five selected checks. The wrapped-list copies round-tripped both slices and kept the refused index/format cases off the desktop path on WARP and RTX 4060 Laptop. Reference: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion
This discussion has been locked. Commenting is limited to contributors.
No description provided.