startup: implement next copy command-list slot in d3d12_xs_device (Part of #870) #2063
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2070"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:58:32Z.
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
COPY_SOURCE/COPY_DESTfor the call (Close returns them toCOMMON), and forwards the call.unknown_resource,buffer_to_buffer,bad_box,source_overflow,dest_overflow,bad_pitch,bad_offset,footprint_overflow,sample_mismatch,bad_alignment.src/startup_stubs/list_copy_texture.h; the handler is inlist_copy_texture.inl(one include and one install line ind3d12_xs_device.cpp).x2w_d3d12_list_copy_texture_statsexports 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 2070at head91c13296, debug and release /O2, release ctest 23/23 passed incl.startup_list_copy_textureandstartup_list_copy_texture_overflow_control; Linux checks below)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Review: COMMENTED
💡 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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:07:01Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
91c1329ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 96For 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, butrequire_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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 80When a source texture has been filled through its guest backing but has never been sampled, unwrapping
own().realdoes not provide its current contents. Placed textures use non-aliased desktop stand-ins, andd3d12_draw.inl::upload_texture()normally populates them lazily during a draw; this handler never invokes that synchronization. Likewise, slot 133 can return non-aliasedPlacement::copied_buffersources. 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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 101For 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 itsTextureUploadcache untouched. On the first subsequent sample,draw_translated()callsupload_texture(), whose initialdone == falseschedules 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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 96When 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, andtransition()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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:40Z.
Code review location:
src/startup_stubs/list_copy_texture.h; line 95For 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
okfor 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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:13:41Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 3759Installing slot 16 changes the public startup-runtime capability and adds a new reproducible fixture, but neither
README.mdnordocs/experiments.mdis updated; repository-wide searches find the new fixture only in source, tests, and CMake. The rootAGENTS.mdexplicitly 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 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:33Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:36Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:39Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:42Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:45Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:48Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T02:00:52Z.
Review: CHANGES_REQUESTED
The validation currently derives
mipusing modulo without checking the full subresource index (including array slice and plane), and computesformat_src/format_dstwithout 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 contractImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:13:48Z.
All 6 review threads fixed and pushed in
394dbe3a(rebased on origin/main).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:33Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 96Fixed in
394dbe3a:fixed_heap_state()detects UPLOAD/READBACK buffers and skipsrequire_state()for them; an upload destination or readback source is refused (bad_heap). Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:36Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 80Fixed in
394dbe3a: texture sides callupload_texture()before the copy; a non-aliased copied-buffer source is refused (stale_source). Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:39Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 101Fixed in
394dbe3a: the destination texture is uploaded viaupload_texture()before the copy, so the first sample no longer schedules an upload over the copied texels. Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:42Z.
Code review location:
src/startup_stubs/list_copy_texture.inl; line 96Fixed in
394dbe3a: a copy whose two sides are the same resource is refused (same_resource) since states are tracked per resource. Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:45Z.
Code review location:
src/startup_stubs/list_copy_texture.h; line 95Fixed 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). Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:33:47Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 3759Fixed in
a2702c0d: new section 'Command list CopyTextureRegion (list slot 16)' in docs/startup-runtime.md with capability, scope, unverified Windows forwarding, and the commandctest --preset dev --no-tests=error -R '^startup_list_copy_texture' -V. Win2025x2w_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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:03:19Z.
Addressed in
d7610f5b(code in2927598b).Fix:
mip + slice * mips + plane * mips * array_sizeand must lie insidemips * 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).format_mismatch) and the same sample count (sample_mismatch). A multisampled copy must be whole subresource to whole subresource at origin 0 (partial_multisample).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,0xffffffffand 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.cppand run: ok. Both--mutate overflowand--mutate slicefail as expected.python3 -B tests/docs_links_check.pyandtests/bidi_controls_check.py: pass.python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 2070atd7610f5b: dev 25/25 and release 25/25 pass (100%), includingstartup_list_copy_texture_warp.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T14:45:31Z.
Review: APPROVED
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