startup: copy and resolve whole resources on a recording list (slots 15, 17, 19) #1937
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1944"
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-24T21:58:44Z.
Related to #870 (no
Fixes).What changes
In render mode, three command-list slots that were dropped now copy whole resources:
CopyBufferRegion, slot 17CopyResource, slot 19ResolveSubresource(unshifted, like slots 12 to 25).COPY_SOURCE/COPY_DESTorRESOLVE_SOURCE/RESOLVE_DESTfor the call and back toCOMMONat Close. An upload buffer stays readable and a readback buffer stays a copy destination.size_mismatch,sample_mismatch,range_overflow,source_not_multisampled, ...). Calls on a closed list are ignored.R16G16B16A16, as in #1729; normalised for the 8-bit and 10-bit families). One with no single choice (for exampleR16_TYPELESS) is refused asbad_format.x2w_d3d12_list_copy_statsexports the counters for fixtures.CopyTextureRegion(16) andCopyTiles(18) are left out on purpose.Code is in new files:
src/startup_stubs/list_copy.h(pure checks) andlist_copy.inl(handlers).d3d12_xs_device.cppgets 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)
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.
Replaces closed draft #1811 (rebased cleanly on origin/main).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:00:39Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e7b39dcℹ️ 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-24T22:08:09Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
e7b39dc483ℹ️ 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 ChazY11 on 2026-11-24T22:36:34Z.
Merge-order check: these four PRs cannot all land in any order — one pair conflicts, the other three compose
Four open PRs now add command-list behaviour to the same two files (
CMakeLists.txt,src/startup_stubs/d3d12_xs_device.cpp):#1975, #1974, #1972, #1944. I merged them against
main889cd3f4in every pair, then all four together.And the four-way merge conflicts on the same pair, at the shared
CMakeLists.txtinsertion point just after theforeach(backend IN ITEMS warp hardware …)block that registers the list tests — the two PRs append their newadd_executable/add_testgroup at the same anchor, sogithas no ordering hint to pick.The three that do compose, compose for real
Merged #1975 + #1974 + #1972 onto
main, configured, built and ran their tests:So the command-list slots those three add coexist in one build, including both negative controls that #1974 registers.
What this means for ordering
Nothing is semantically wrong with #1944 — it is a text conflict at a shared anchor. The practical consequence is that whichever of
#1972 / #1944 lands second has to rebase, and a rebase that resolves the anchor by hand needs the same care as the original: the
ENVIRONMENTlist (X2W_D3D12_PERMISSIVE,X2W_D3D12_LIST_NOOP,X2W_D3D12_RENDER,X2W_D3D12_DEBUG) andSKIP_RETURN_CODE 77have to survive on both groups, or one PR's tests silently run without the permissive flags and fail in CI instead of here.
I did not resolve the conflict myself: the resolution depends on which PR the maintainer wants first, and inventing an ordering would
hide the decision.
Aside, same family
#1951 and #1947 (the two
tools/PRs in this batch) touch different files and do not conflict with any of the above.Notes
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.inl; line 19For a slot-127 upload resource backed by
__XMemAllocationHooks__,resource_map()returnstitle_memoryandresource_unmap()does not update the separate desktop resource. Returningown().realhere therefore makes an ordinary map/write/CopyBufferRegionsequence copy stale or zeroed desktop data rather than the bytes written by the caller. Synchronize non-aliased title backing before using it as a copy source, or explicitly refuse that backing mode. The new fixture only maps native desktop resources, so it does not exercise this path.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.inl; line 96When the destination is a slot-133 texture with readable title backing and no render-target/depth/UAV flags, a subsequent translated draw calls
upload_texture()ind3d12_draw.inl. On its first bind, that uploader copies the stale title backing over the desktop texture, overwriting the result just recorded here.CopyResourcehas the same problem. Update the destination's upload/ownership bookkeeping so copy and resolve results survive later sampling; the native-resource readback fixture does not cover this wrapper-to-draw flow.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.inl; line 40device_place_resource_x()preserves an explicitUNORDERED_ACCESSinitial state for placed buffers and records it inResourceInfo::initial_state. On such a buffer's first copy, this call entersrequire_state(), which always emits its first barrier fromCOMMON. That records an incorrectStateBeforefor an otherwise legal buffer copy and can invalidate the recording. Preserve the wrapper's initial-state information when planning transitions, or refuse buffers that are not eligible for the COMMON-based tracker, aslist_execute_indirect()already does.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.h; line 191For a typeless RGBA8 source, a typed
R8G8B8A8_UNORM_SRGBdestination and an unknown format argument, the preceding fallback choosesR8G8B8A8_UNORM, and these family checks accept it. D3D12 requires the resolve format to match a fully typed endpoint exactly; family compatibility is only sufficient for a typeless endpoint. Consequently, this plan forwards a desktop-invalid resolve instead of refusing it. Select or validate against typed endpoints before applying the typeless-family fallback.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.inl; line 39Skipping transitions is correct for an upload source or a readback destination, but this condition also skips them for an upload destination or a readback source. The descriptor-only validators accept those buffers, so both copy handlers forward the operation while the endpoint remains in an incompatible immutable state (
GENERIC_READorCOPY_DEST) and count it as successful. Check that the heap's fixed state permits the requested role and refuse the wrong-direction cases before recording the copy.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:08:09Z.
Code review location:
src/startup_stubs/list_copy.h; line 79The family table omits valid DXGI type groups, including the BC formats, R16 and R8 families. For example, equal-shaped
BC7_TYPELESSandBC7_UNORMresources fall through here as different families, socheck_copy_resource()reportsformat_mismatchand silently skips a legal whole-resource copy. Populate the remaining CopyResource-compatible type groups rather than limiting compatibility to the few families currently supported by the resolve-choice table.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-24T23:56:04Z.
WARP and hardware run of
startup_list_copy_*at heade7b39dc4(Debug build, Windows 11 build 26300, NVIDIA GeForce RTX 3070 Ti driver 32.0.16.2101, D3D12 debug layer enabled viaX2W_D3D12_DEBUG=1):Result: 6/6 passed (
100% tests passed, 0 tests failed out of 6).startup_list_copy_warpandstartup_list_copy_hardware, plus the 4startup_list_copy_validation*tests. 0 capability skips (exit code 77).sevisD3D12_MESSAGE_SEVERITY: 1 = ERROR, 2 = WARNING): nosev=0orsev=1line; each GPU test logs 4sev=2 id=820warnings (ClearRenderTargetView: The clear values do not match those passed to resource creation).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:30Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:32Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:33Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:35Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:37Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:39Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:04:14Z.
Fixed in
5bda1cfc(all six review threads):title_backed_source.initial_state, likelist_execute_indirect().heap_direction.Verification:
x2w_pipe.py win2025 1944on Win2025: 27/27 passed, includingstartup_list_copy_warpandstartup_list_copy_validation(new pure checks for typed-endpoint resolve and the BC7/R16/R8 families; the warp probe now refuses a copy into an upload buffer and out of a readback buffer). The title-backed sync and GPU-written paths need a title-memory resource, which the warp probe does not create, so they are not covered by a fixture yet.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:30Z.
Code review location:
src/startup_stubs/list_copy.h; line 191Fixed in
5bda1cfc: Resolve format is now validated against fully typed endpoints exactly; family match only applies to typeless ones. Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:32Z.
Code review location:
src/startup_stubs/list_copy.inl; line 40Fixed in
5bda1cfc: Buffers with a non-COMMON initial state are refused (initial_state refusal) instead of recording a wrong StateBefore. Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:33Z.
Code review location:
src/startup_stubs/list_copy.h; line 79Fixed in
5bda1cfc: The DXGI family table now covers the remaining CopyResource-compatible groups (BC, R16, R8, ...). Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:35Z.
Code review location:
src/startup_stubs/list_copy.inl; line 39Fixed in
5bda1cfc: Fixed-heap direction is checked: upload destination and readback source are refused (heap_direction). Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:37Z.
Code review location:
src/startup_stubs/list_copy.inl; line 19Fixed in
5bda1cfc: Title-backed copy sources are now synced before the copy (texture upload, upload-buffer bytes, aliased placed buffer already current; title-backed default-heap buffer refused). Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:02:39Z.
Code review location:
src/startup_stubs/list_copy.inl; line 96Fixed in
5bda1cfc: Copy and resolve destinations are now marked GPU-written, so a later draw's first-bind upload no longer overwrites the result. Win2025 WARP: 27/27 passed (Debug and Release). AI-assisted; commands listed were executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T05:25:57Z.
Review: CHANGES_REQUESTED
Independent Release test of
0c603797: all six existing cases pass, including WARP and RTX 4060 Laptop. One remaining source-path issue is outside those cases. sync_title_source returns success for a title-backed texture even when upload_texture cannot stage it; the handler can then copy an older desktop texture and mark the destination GPU-written. The upload-buffer branch also recopies into the same backing at command recording, without preserving bytes already referenced by a stalled submission.Please keep the validated direct-resource and genuinely aliased source paths. For other title-backed sources either refuse while the upload is unavailable, or use a validated per-recording upload whose lifetime follows the consuming fence. A source-built missing/unreadable title input should leave the destination sentinel unchanged. If keeping the copied upload-buffer path, gate submission A, change its title bytes and submit B, then release and check both payloads. The current six cases remain useful and should stay.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:45:43Z.
Thanks. Fixed in
dfadc46c(code in0004422c).upload_texturenow reports whether it really staged the texture.sync_title_sourcereturns that result, so a title-backed texture that cannot be staged (unreadable, unsupported or too many mips) is refused withtitle_backed_source. The destination is never written and not marked GPU-written.startup_list_copy): the six existing cases stay. New 8a copies from a staged title-backed texture and checks the destination texels. New 8b copies from a title-backed texture whose pages are decommitted: it is refused, counted, and the destination keeps its sentinel.Verification (Windows Server 2025, WARP, default 3-slot pool,
x2w_pipe.py win2025 1944 --force): dev 26/26 and release 26/26 passed, no skips, includingstartup_list_copy_warpand thestartup_list_copy_validation*tests. A first release attempt died on a compile-cache connection reset and passed on rerun. Linux:python3 -I tests/docs_links_check.pypassed.The upload-buffer refusal has no GPU case of its own yet; I only covered it through the docs and the shared refusal path.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:11:46Z.
Independent Release check on
3f7b8a5f: all six existingstartup_list_copy_*checks passed. A source-built repro added to the same fixture fails on both WARP and RTX 4060 Laptop: create a placed texture with CPU texels0x44332211, record CopyResource into it, Close and Reset without submitting, then copy out of that texture and wait on the fence. Actual0x00000000, expected0x44332211. The destination is marked GPU-written during recording, so the discarded copy prevents its first CPU upload.I tried a focused local revision. Track unsubmitted writes on their recording, use them for reads on that list, publish the GPU-written state on submission, and discard the pending records on Reset or failed Close. For CPU-backed texture copy sources, take a fresh snapshot using the existing recording-owned upload and fence retirement path. The shared draw upload cache may reuse an earlier snapshot within one frame.
With that revision,
ctest --preset release -j1 --no-tests=error -R '^startup_list_copy_' -Vpassed 6/6. Both adapters read back44332211after the discarded write,44332211then88776655from two copies recorded around a CPU write, andff0000fffrom a GPU-written texture both on its own recording and after submission. Windows 11 build 26200.9974, NVIDIA 32.0.16.1656, WARP 10.0.26100.9818, debug layer enabled. Both reported zero errors and four existing clear-value warnings (820), with no skips.The slot 15 wording also needs an update. A local trace shows a 68-byte copy at a nonzero source offset between two non-aliased placed buffers. The source is UAV-capable. Please keep that case refused until there is a validated source of current bytes. The texture revision adds no new buffer-backing behavior.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:25:24Z.
Thanks, reproduced and fixed in
18ec51de(code in0aafe6b9).startup_list_copycase 10: place a texture with0x44332211, record CopyResource into it, Close and Reset without submitting, then copy out of it and wait on the fence. It reads back0x44332211. Docs wording updated.Verification (Windows Server 2025, WARP, default 3-slot pool,
x2w_pipe.py win2025 1944 --force): dev 26/26 and release 26/26 passed, no skips. An earlier release attempt died on a compile-cache connection error and passed on rerun. Linux:python3 -I tests/docs_links_check.pypassed.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T07:30:52Z.
Review: APPROVED
The previous source and discarded-recording findings are resolved. On Windows Release I independently ran all six startup_list_copy checks on this head. Both WARP and RTX 4060 Laptop passed the discarded-copy and same-recording read controls. A Reset leaves the first upload available and a real submitted copy preserves GPU-written contents.