startup: implement command-list slots 53-55 ClearUAV and Discard (Part of #870) #1965
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1972"
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-24T22:21:07Z.
Part of #870
What this unblocks: render targets and UAV buffers cleared (and discarded) on a list before the first world frame no longer hit the no-op trap at list slots 53/54/55.
Summary:
startup_clear_uav(cteststartup_clear_uav_warp/_hardware): uint clear, rect clear, float clear, refused clears (bad GPU handle, empty CPU handle, no values) leave the target untouched, discards with and without region; readback on the desktop device, no device removal, no debug-layer errors. Without the handlers the slots are no-ops and the readback assertions fail.Verification:
git diff --check: cleanx86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_clear_uav.cpp: no errorsx86_64-w64-mingw32-g++ -fsyntax-onlyon d3d12_xs_device.cpp : only the pre-existing MSVC__try/__excepterrors in local_log.h, none in the new codectest -R startup_clear_uavon WARP and hardwareAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:45:39Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
0d81de30e1ℹ️ 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:36Z.
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:36:49Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
0d81de3ℹ️ 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:45:39Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 2183For a valid clear, including those in the new fixture, the GPU descriptor's heap is never bound to the desktop list.
list_set_descriptor_heapsind3d12_draw.inlonly caches the title's heaps, while translated draws bind a different private heap. Both desktop clear APIs require the GPU descriptor to belong to the currently bound shader-visible heap, so checking that the address belongs to some known heap is insufficient: these calls produce validation errors instead of a usable recording. Resolve and bind the owning heap for the clear, then restore or invalidate the translated-heap cache so subsequent draws bind their heap again.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:45:39Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 2179When the view targets a buffer placed through device slot 133 with initial state
UNORDERED_ACCESS,device_place_resource_xdeliberately preserves that state and records it inResourceInfo::initial_state. This handler nevertheless callsrequire_state, which assumes every newly encountered resource starts inCOMMONand emits aCOMMON -> UNORDERED_ACCESSbarrier. The first clear therefore records an incorrectStateBefore, potentially invalidating the command list even though the resource and view are valid. Consult the recorded state before using this COMMON-only tracker, or refuse non-COMMON resources aslist_execute_indirectalready does. The new discard handler has the same unchecked use of the tracker.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:45:39Z.
Code review location:
tests/startup_clear_uav.cpp; line 266Both registered tests enable
X2W_D3D12_DEBUG=1, under whichProbe::submitreachesqueue_execute, callscheck_device, and clears the same device's stored debug messages withClearStoredMessages(). By the time this assertion runs, synchronous validation errors from recording the clears/discards and submitting the list have already been removed. The reported error count therefore does not establish that the command path was validation-clean; it primarily checks messages from the later observer readbacks. Register a message callback before recording, asstartup_root_heap.cppdoes, or expose a cumulative error count instead of inspecting the drained queue.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-24T23:56:06Z.
WARP and hardware run at head
0d81de30(Debug build, Windows 11 build 26300, NVIDIA GeForce RTX 3070 Ti driver 32.0.16.2101, debug layer enabled): 2/2 passed, 0 capability skips (exit code 77).In both
startup_clear_uav_warpandstartup_clear_uav_hardwarethe debug layer emits threesev=1messages (D3D12_MESSAGE_SEVERITY_ERROR), yet the last line of each test isdebug layer errors: 0:So the test passes and reports 0 errors although the layer reported errors, on both WARP and the physical GPU. Codex's inline P2 comment on
tests/startup_clear_uav.cppat this head concerns the same error counter.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:00Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:02Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:04Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:00Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 2183Fixed in
248e2d5dand99cc35ae. The clear binds the heap that owns the GPU handle and resets the translated-heap cache. Non-COMMON initial states are refused for clear and discard. The test counts debug errors through a message callback registered before recording. Win2025 WARP: startup_clear_uav_warp passed (dev and release).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:02Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 2179Fixed in
248e2d5dand99cc35ae. The clear binds the heap that owns the GPU handle and resets the translated-heap cache. Non-COMMON initial states are refused for clear and discard. The test counts debug errors through a message callback registered before recording. Win2025 WARP: startup_clear_uav_warp passed (dev and release).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:04Z.
Code review location:
tests/startup_clear_uav.cpp; line 266Fixed in
248e2d5dand99cc35ae. The clear binds the heap that owns the GPU handle and resets the translated-heap cache. Non-COMMON initial states are refused for clear and discard. The test counts debug errors through a message callback registered before recording. Win2025 WARP: startup_clear_uav_warp passed (dev and release).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T10:27:30Z.
Head
3792cc25:startup_clear_uav_warpandstartup_clear_uav_hardwareboth pass, and both end withdevice removed reason: 0x00000000, debug layer errors: 0.Environment: NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.2101) and WARP; Windows 11 build 26300.9974; Debug build; D3D12 debug layer enabled (
x2w-d3d12 debug layer: 0x00000000 enabled). 0 capability skips (77). The hardware run was serial on an idle machine.Compared with my earlier run at
0d81de30:x2w-d3d12-debug ... sev=1 id=1314lines (GPU descriptor handle not from the bound heap) no longer appear in either log (0 matches).x2w-d3d12 ClearUnorderedAccessViewUint skipped: GPU handle is on no known descriptor heap,... skipped: view holds no known resourceand... skipped: no clear values. Checks 4 to 6 of the test readrefused +1 (expected +1).RegisterMessageCallback). The log has nono debug layer message callbackline, so the callback registered on both adapters.I did not run a negative control that makes the callback fire in this run, so "0 errors" shows that no error message arrived, not that the callback is proven to catch one.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:52:42Z.
Thank you @Makto94 for the re-run at
3792cc25on WARP and hardware, and for noting that the callback is not yet proven by a negative control.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:10:05Z.
Stage-2 verification at
3792cc25(Win2025, WARP, default 3-slot pool):ctest -R '^(...startup_clear_uav_warp...)$'(23 direct downstream tests): 23/23 passed./O2preset: build OK (106.64s), same 23 tests: 23/23 passed (startup_clear_uav_warp0.14s).main.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T14:32:39Z.
Win2025 WARP receipt for head
1c4a9ac6after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
1c4a9ac63d705af36a0af7d7b9f2d08780f92f0f:--preset dev):cmake --build --preset dev --target cpu_exe_io cpu_shim_draw cpu_shim_startup cpu_shim_startup_guest cpu_shim_startup_lifted d3d12_xs_device_obj d3d12_xs_shim d3d12x_compute_list_check d3d12x_descriptor_check d3d12x_device_check d3d12x_device_struct_return_control d3d12x_graphics_list_check pe_map startup_clear_uav startup_stub_acphal startup_stub_chad startup_stub_consumer startup_stub_gameinput startup_stub_xapu startup_stub_xcrdapi startup_stub_xg_xs xgameruntime_preflight_exe xgameruntime_shim xmem_shim -- -j 2):30.55s(configure2.00s)ctest --preset dev -R '^(cpu_native_shim_startup|cpu_shim_chain_warp|cpu_shim_compute_warp|cpu_shim_draw_warp|cpu_shim_shadow_warp|cpu_shim_texture_reuse_warp|cpu_shim_upload_texture_warp|d3d12x_compute_list_warp|d3d12x_descriptor_heap_warp|d3d12x_descriptor_negative_warp|d3d12x_descriptor_table_warp|d3d12x_device_create_warp|d3d12x_device_negative_warp|d3d12x_device_struct_return_neither_control_warp|d3d12x_device_struct_return_warp|d3d12x_graphics_list_warp|d3d12x_pso_reject_warp|d3d12x_pso_static_sampler_warp|startup_build_rev_dll|startup_clear_uav_warp|startup_sampler_heap_wrapped_warp|startup_stubs|xgameruntime_preflight_stub_refused)$' --parallel 2 --no-tests=error --output-on-failure): 23/23 passed (9.56s:cpu_shim_upload_texture_warp3.22s,cpu_shim_shadow_warp4.20s,cpu_shim_chain_warp2.25s,cpu_shim_draw_warp2.72s,cpu_shim_compute_warp2.09s,cpu_native_shim_startup1.28s,cpu_shim_texture_reuse_warp1.26s,startup_stubs0.72s,startup_sampler_heap_wrapped_warp0.14s,d3d12x_descriptor_heap_warp0.04s,startup_build_rev_dll0.11s,startup_clear_uav_warp0.06s,xgameruntime_preflight_stub_refused0.28s,d3d12x_descriptor_table_warp0.05s,d3d12x_compute_list_warp0.05s,d3d12x_graphics_list_warp0.06s,d3d12x_device_create_warp0.04s,d3d12x_descriptor_negative_warp0.05s,d3d12x_pso_reject_warp0.04s,d3d12x_pso_static_sampler_warp0.04s,d3d12x_device_struct_return_neither_control_warp0.05s,d3d12x_device_struct_return_warp0.04s,d3d12x_device_negative_warp0.03s)/O2(--preset release):cmake --build --preset release --target cpu_exe_io cpu_shim_draw cpu_shim_startup cpu_shim_startup_guest cpu_shim_startup_lifted d3d12_xs_device_obj d3d12_xs_shim d3d12x_compute_list_check d3d12x_descriptor_check d3d12x_device_check d3d12x_device_struct_return_control d3d12x_graphics_list_check pe_map startup_clear_uav startup_stub_acphal startup_stub_chad startup_stub_consumer startup_stub_gameinput startup_stub_xapu startup_stub_xcrdapi startup_stub_xg_xs xgameruntime_preflight_exe xgameruntime_shim xmem_shim -- -j 2):59.18s(configure1.97s)ctest --preset release -R '^(cpu_native_shim_startup|cpu_shim_chain_warp|cpu_shim_compute_warp|cpu_shim_draw_warp|cpu_shim_shadow_warp|cpu_shim_texture_reuse_warp|cpu_shim_upload_texture_warp|d3d12x_compute_list_warp|d3d12x_descriptor_heap_warp|d3d12x_descriptor_negative_warp|d3d12x_descriptor_table_warp|d3d12x_device_create_warp|d3d12x_device_negative_warp|d3d12x_device_struct_return_neither_control_warp|d3d12x_device_struct_return_warp|d3d12x_graphics_list_warp|d3d12x_pso_reject_warp|d3d12x_pso_static_sampler_warp|startup_build_rev_dll|startup_clear_uav_warp|startup_sampler_heap_wrapped_warp|startup_stubs|xgameruntime_preflight_stub_refused)$' --parallel 2 --no-tests=error --output-on-failure): 23/23 passed (9.34s:cpu_shim_upload_texture_warp3.04s,cpu_shim_shadow_warp3.99s,cpu_shim_chain_warp2.20s,cpu_shim_draw_warp3.08s,cpu_shim_compute_warp1.93s,cpu_native_shim_startup1.31s,cpu_shim_texture_reuse_warp1.21s,startup_sampler_heap_wrapped_warp0.14s,xgameruntime_preflight_stub_refused0.23s,startup_build_rev_dll0.08s,d3d12x_compute_list_warp0.05s,d3d12x_graphics_list_warp0.05s,startup_clear_uav_warp0.06s,d3d12x_descriptor_table_warp0.04s,startup_stubs0.68s,d3d12x_descriptor_heap_warp0.04s,d3d12x_descriptor_negative_warp0.05s,d3d12x_device_struct_return_neither_control_warp0.04s,d3d12x_device_create_warp0.04s,d3d12x_pso_static_sampler_warp0.04s,d3d12x_device_struct_return_warp0.04s,d3d12x_pso_reject_warp0.04s,d3d12x_device_negative_warp0.02s)sccache: 4/14 hits; wall121.4sAI-assisted; commands listed were executed locally.