startup: implement command-list slots 53-55 ClearUAV and Discard (Part of #870) #1965

Merged
tedin7 merged 4 commits from upstream-pr/1972 into main 2026-11-25 14:36:59 +00:00
tedin7 commented 2026-11-24 22:21:07 +00:00 (Migrated from github.com)

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:

  • Slot 53/54 ClearUnorderedAccessViewUint/Float: the CPU handle is resolved through its shadow record (copied descriptors follow), the GPU handle must lie on a known CBV/SRV/UAV heap, the resource must allow unordered access; the target moves to UNORDERED_ACCESS around the clear. Anything else is refused, logged and counted.
  • Slot 55 DiscardResource: render, depth and UAV resources are moved to the matching state and discarded; other resources, unreadable regions and null resources are dropped (discard is a hint).
  • New test startup_clear_uav (ctest startup_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 : clean
  • x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_clear_uav.cpp : no errors
  • x86_64-w64-mingw32-g++ -fsyntax-only on d3d12_xs_device.cpp : only the pre-existing MSVC __try/__except errors in local_log.h, none in the new code
  • Win2025 (NOT yet run): Release build, ctest -R startup_clear_uav on WARP and hardware

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6592571551 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972). Originally posted by [tedin7](https://github.com/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: - Slot 53/54 ClearUnorderedAccessViewUint/Float: the CPU handle is resolved through its shadow record (copied descriptors follow), the GPU handle must lie on a known CBV/SRV/UAV heap, the resource must allow unordered access; the target moves to UNORDERED_ACCESS around the clear. Anything else is refused, logged and counted. - Slot 55 DiscardResource: render, depth and UAV resources are moved to the matching state and discarded; other resources, unreadable regions and null resources are dropped (discard is a hint). - New test `startup_clear_uav` (ctest `startup_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` : clean - `x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_clear_uav.cpp` : no errors - `x86_64-w64-mingw32-g++ -fsyntax-only` on d3d12_xs_device.cpp : only the pre-existing MSVC `__try/__except` errors in local_log.h, none in the new code - Win2025 (NOT yet run): Release build, `ctest -R startup_clear_uav` on WARP and hardware AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 23:03:21 +00:00 (Migrated from github.com)

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

  • 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".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048582766 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#pullrequestreview-6048582766). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:45:39Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0d81de30e1` <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>
ChazY11 commented 2026-11-24 23:03:39 +00:00 (Migrated from github.com)

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 main 889cd3f4 in every pair, then all four together.

#1975 + #1974   clean
#1975 + #1972   clean
#1975 + #1944   clean
#1974 + #1972   clean
#1974 + #1944   clean
#1972 + #1944   conflict: CMakeLists.txt, src/startup_stubs/d3d12_xs_device.cpp

And the four-way merge conflicts on the same pair, at the shared CMakeLists.txt insertion point just after the
foreach(backend IN ITEMS warp hardware …) block that registers the list tests — the two PRs append their new
add_executable / add_test group at the same anchor, so git has 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:

git merge pr-1975 pr-1974 pr-1972          # 0 conflicts
cmake --preset dev                          # Generating done
cmake --build --preset dev --target startup_root_constant_store startup_list_dispatch_check startup_clear_uav
build exit 0

ctest --preset dev -R 'root_constant|list_dispatch|clear_uav'
1/6 startup_root_constant_store ............   Passed 0.15
2/6 startup_clear_uav_warp .................   Passed 0.62
3/6 startup_clear_uav_hardware .............   Passed 4.03   (physical GPU, not a skip)
4/6 startup_list_dispatch ..................   Passed 0.14
5/6 startup_list_dispatch_no-limit_control .   Passed 0.03
6/6 startup_list_dispatch_no-state_control .   Passed 0.02
100% tests passed, 0 tests failed out of 6

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
ENVIRONMENT list (X2W_D3D12_PERMISSIVE, X2W_D3D12_LIST_NOOP, X2W_D3D12_RENDER, X2W_D3D12_DEBUG) and SKIP_RETURN_CODE 77
have 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

  • AI-assisted, run on Windows 11 build 26300.9974 with MSVC 19.44.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146435142 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7146435142). Originally posted by [ChazY11](https://github.com/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 `main` `889cd3f4` in every pair, then all four together. ```text #1975 + #1974 clean #1975 + #1972 clean #1975 + #1944 clean #1974 + #1972 clean #1974 + #1944 clean #1972 + #1944 conflict: CMakeLists.txt, src/startup_stubs/d3d12_xs_device.cpp ``` And the four-way merge conflicts on the same pair, at the shared `CMakeLists.txt` insertion point just after the `foreach(backend IN ITEMS warp hardware …)` block that registers the list tests — the two PRs append their new `add_executable` / `add_test` group at the same anchor, so `git` has 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: ```powershell git merge pr-1975 pr-1974 pr-1972 # 0 conflicts cmake --preset dev # Generating done cmake --build --preset dev --target startup_root_constant_store startup_list_dispatch_check startup_clear_uav build exit 0 ctest --preset dev -R 'root_constant|list_dispatch|clear_uav' 1/6 startup_root_constant_store ............ Passed 0.15 2/6 startup_clear_uav_warp ................. Passed 0.62 3/6 startup_clear_uav_hardware ............. Passed 4.03 (physical GPU, not a skip) 4/6 startup_list_dispatch .................. Passed 0.14 5/6 startup_list_dispatch_no-limit_control . Passed 0.03 6/6 startup_list_dispatch_no-state_control . Passed 0.02 100% tests passed, 0 tests failed out of 6 ``` 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 `ENVIRONMENT` list (`X2W_D3D12_PERMISSIVE`, `X2W_D3D12_LIST_NOOP`, `X2W_D3D12_RENDER`, `X2W_D3D12_DEBUG`) and `SKIP_RETURN_CODE 77` have 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 - AI-assisted, run on Windows 11 build 26300.9974 with MSVC 19.44.
chatgpt-codex-connector[bot commented 2026-11-24 23:03:41 +00:00 (Migrated from github.com)

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.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T22:45:42.071137Z 0d81de3 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146439678 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7146439678). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:36:49Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"0d81de30e1077ec01fb16c4397c8cd35309d78c7","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-24T22:45:42.071137Z">2026-11-24T22:45:42.071137Z</relative-time> | `0d81de3` | 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>
chatgpt-codex-connector[bot commented 2026-11-24 23:03:44 +00:00 (Migrated from github.com)

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 2183

@@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour,
                                 rect_count ? rects : nullptr);
     InterlockedIncrement(&render_clears);
 }
+// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap.
+bool known_view_gpu_handle(u64 gpu)
+{
+    bool found = false;
+    AcquireSRWLockShared(&note_lock);
+    for (const HeapInfo& heap : heap_infos()) {
+        if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue;
+        const u64 offset = gpu - heap.desktop_gpu;
+        if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) {
+            found = true;
+            break;
+        }
+    }
+    ReleaseSRWLockShared(&note_lock);
+    return found;
+}
+// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU
+// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the
+// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no
+// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is
+// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS
+// around the clear.
+template <bool Float>
+void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values,
+                              UINT rect_count, const D3D12_RECT* rects)
+{
+    if (!self->own().list_open) return;
+    static LONG logged, refused;
+    const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint";
+    const u64 desktop = desktop_cpu_handle(cpu_handle);
+    const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{};
+    ID3D12Resource* target = view.resource;
+    const char* why = nullptr;
+    if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values";
+    else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects";
+    else if (!target) why = view.wrong_kind ? "view is not an unordered-access view"
+                            : view.skipped ? "view was skipped at creation" : "view holds no known resource";
+    else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap";
+    else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access";
+    if (why) {
+        InterlockedIncrement(&render_target_unresolved);
+        if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle);
+        return;
+    }
+    if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count);
+    auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real);
+    require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+    const D3D12_GPU_DESCRIPTOR_HANDLE gpu{gpu_handle};
+    const D3D12_CPU_DESCRIPTOR_HANDLE cpu{static_cast<SIZE_T>(desktop)};
+    if (Float) list->ClearUnorderedAccessViewFloat(gpu, cpu, target, static_cast<const float*>(values), rect_count, rect_count ? rects : nullptr);
+    else list->ClearUnorderedAccessViewUint(gpu, cpu, target, static_cast<const UINT*>(values), rect_count, rect_count ? rects : nullptr);

P1 Badge Bind the GPU descriptor's heap before issuing a clear

For a valid clear, including those in the new fixture, the GPU descriptor's heap is never bound to the desktop list. list_set_descriptor_heaps in d3d12_draw.inl only 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 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687563464 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4687563464). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:45:39Z. **Code review location:** `src/startup_stubs/d3d12_xs_device.cpp`; line 2183 ~~~~diff @@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour, rect_count ? rects : nullptr); InterlockedIncrement(&render_clears); } +// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap. +bool known_view_gpu_handle(u64 gpu) +{ + bool found = false; + AcquireSRWLockShared(&note_lock); + for (const HeapInfo& heap : heap_infos()) { + if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue; + const u64 offset = gpu - heap.desktop_gpu; + if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) { + found = true; + break; + } + } + ReleaseSRWLockShared(&note_lock); + return found; +} +// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU +// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the +// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no +// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is +// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS +// around the clear. +template <bool Float> +void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values, + UINT rect_count, const D3D12_RECT* rects) +{ + if (!self->own().list_open) return; + static LONG logged, refused; + const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint"; + const u64 desktop = desktop_cpu_handle(cpu_handle); + const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{}; + ID3D12Resource* target = view.resource; + const char* why = nullptr; + if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values"; + else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects"; + else if (!target) why = view.wrong_kind ? "view is not an unordered-access view" + : view.skipped ? "view was skipped at creation" : "view holds no known resource"; + else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap"; + else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access"; + if (why) { + InterlockedIncrement(&render_target_unresolved); + if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle); + return; + } + if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count); + auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real); + require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + const D3D12_GPU_DESCRIPTOR_HANDLE gpu{gpu_handle}; + const D3D12_CPU_DESCRIPTOR_HANDLE cpu{static_cast<SIZE_T>(desktop)}; + if (Float) list->ClearUnorderedAccessViewFloat(gpu, cpu, target, static_cast<const float*>(values), rect_count, rect_count ? rects : nullptr); + else list->ClearUnorderedAccessViewUint(gpu, cpu, target, static_cast<const UINT*>(values), rect_count, rect_count ? rects : nullptr); ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Bind the GPU descriptor's heap before issuing a clear** For a valid clear, including those in the new fixture, the GPU descriptor's heap is never bound to the desktop list. `list_set_descriptor_heaps` in `d3d12_draw.inl` only 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 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-24 23:03:44 +00:00 (Migrated from github.com)

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 2179

@@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour,
                                 rect_count ? rects : nullptr);
     InterlockedIncrement(&render_clears);
 }
+// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap.
+bool known_view_gpu_handle(u64 gpu)
+{
+    bool found = false;
+    AcquireSRWLockShared(&note_lock);
+    for (const HeapInfo& heap : heap_infos()) {
+        if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue;
+        const u64 offset = gpu - heap.desktop_gpu;
+        if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) {
+            found = true;
+            break;
+        }
+    }
+    ReleaseSRWLockShared(&note_lock);
+    return found;
+}
+// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU
+// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the
+// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no
+// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is
+// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS
+// around the clear.
+template <bool Float>
+void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values,
+                              UINT rect_count, const D3D12_RECT* rects)
+{
+    if (!self->own().list_open) return;
+    static LONG logged, refused;
+    const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint";
+    const u64 desktop = desktop_cpu_handle(cpu_handle);
+    const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{};
+    ID3D12Resource* target = view.resource;
+    const char* why = nullptr;
+    if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values";
+    else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects";
+    else if (!target) why = view.wrong_kind ? "view is not an unordered-access view"
+                            : view.skipped ? "view was skipped at creation" : "view holds no known resource";
+    else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap";
+    else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access";
+    if (why) {
+        InterlockedIncrement(&render_target_unresolved);
+        if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle);
+        return;
+    }
+    if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count);
+    auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real);
+    require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);

P2 Badge Respect the initial state of placed UAV buffers

When the view targets a buffer placed through device slot 133 with initial state UNORDERED_ACCESS, device_place_resource_x deliberately preserves that state and records it in ResourceInfo::initial_state. This handler nevertheless calls require_state, which assumes every newly encountered resource starts in COMMON and emits a COMMON -> UNORDERED_ACCESS barrier. The first clear therefore records an incorrect StateBefore, 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 as list_execute_indirect already does. The new discard handler has the same unchecked use of the tracker.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687563474 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4687563474). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:45:39Z. **Code review location:** `src/startup_stubs/d3d12_xs_device.cpp`; line 2179 ~~~~diff @@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour, rect_count ? rects : nullptr); InterlockedIncrement(&render_clears); } +// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap. +bool known_view_gpu_handle(u64 gpu) +{ + bool found = false; + AcquireSRWLockShared(&note_lock); + for (const HeapInfo& heap : heap_infos()) { + if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue; + const u64 offset = gpu - heap.desktop_gpu; + if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) { + found = true; + break; + } + } + ReleaseSRWLockShared(&note_lock); + return found; +} +// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU +// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the +// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no +// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is +// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS +// around the clear. +template <bool Float> +void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values, + UINT rect_count, const D3D12_RECT* rects) +{ + if (!self->own().list_open) return; + static LONG logged, refused; + const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint"; + const u64 desktop = desktop_cpu_handle(cpu_handle); + const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{}; + ID3D12Resource* target = view.resource; + const char* why = nullptr; + if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values"; + else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects"; + else if (!target) why = view.wrong_kind ? "view is not an unordered-access view" + : view.skipped ? "view was skipped at creation" : "view holds no known resource"; + else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap"; + else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access"; + if (why) { + InterlockedIncrement(&render_target_unresolved); + if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle); + return; + } + if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count); + auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real); + require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Respect the initial state of placed UAV buffers** When the view targets a buffer placed through device slot 133 with initial state `UNORDERED_ACCESS`, `device_place_resource_x` deliberately preserves that state and records it in `ResourceInfo::initial_state`. This handler nevertheless calls `require_state`, which assumes every newly encountered resource starts in `COMMON` and emits a `COMMON -> UNORDERED_ACCESS` barrier. The first clear therefore records an incorrect `StateBefore`, 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 as `list_execute_indirect` already does. The new discard handler has the same unchecked use of the tracker. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-24 23:03:44 +00:00 (Migrated from github.com)

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 266

@@ -0,0 +1,270 @@
+// ClearUnorderedAccessViewUint / ClearUnorderedAccessViewFloat / DiscardResource on a console command list
+// (list slots 53, 54 and 55, device slot 19).
+//
+//   startup_clear_uav <warp|hardware>     (X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1)
+//
+// Through D3D12XboxCreateDevice the probe makes 1x1 targets with unordered access and records, on one list:
+//
+//   A  R32_UINT   ClearUnorderedAccessViewUint(0x12345678)            read back: 12345678
+//   B  R32_UINT   cleared 0x11111111, then a clear with a GPU handle on no heap (refused, counted)
+//                                                                     read back: 11111111
+//   C  R32_FLOAT  ClearUnorderedAccessViewFloat(1.5)                  read back: 3fc00000
+//   D  R32_UINT   a clear through a CPU handle that holds no view (refused, counted)
+//   E  RGBA8 RTV  DiscardResource, with and without a region          list closes and executes
+//
+// The shader-visible heap holds the GPU-side descriptors, a second heap holds the CPU-side copies the
+// desktop API requires. The desktop device must not be removed and the debug layer must store no errors.
+//
+// Exit codes: 0 pass, 77 no physical adapter, other values name the failing step.
+#include <d3d12.h>
+#include <d3d12sdklayers.h>
+#include <dxgi1_6.h>
+#include <wrl/client.h>
+
+#include <array>
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
+#include <vector>
+
+using Microsoft::WRL::ComPtr;
+extern "C" __declspec(dllimport) HRESULT WINAPI D3D12XboxCreateDevice(IUnknown*, const void*, REFIID, void**);
+extern "C" __declspec(dllimport) void x2w_d3d12_render_target_stats(unsigned* binds, unsigned* unresolved);
+
+namespace {
+using Word = std::uint64_t;
+template <class T> Word arg(T* value) { return reinterpret_cast<Word>(value); }
+Word invoke(void* object, unsigned index, Word a = 0, Word b = 0, Word c = 0, Word d = 0, Word e = 0, Word f = 0, Word g = 0)
+{
+    using Slot = Word (WINAPI*)(void*, Word, Word, Word, Word, Word, Word, Word);
+    return reinterpret_cast<Slot>((*static_cast<void***>(object))[index])(object, a, b, c, d, e, f, g);
+}
+bool ok(Word hr) { return SUCCEEDED(static_cast<HRESULT>(hr)); }
+
+unsigned unresolved_now()
+{
+    unsigned binds = 0, unresolved = 0;
+    x2w_d3d12_render_target_stats(&binds, &unresolved);
+    return unresolved;
+}
+
+struct Probe {
+    ComPtr<ID3D12Device> desktop;
+    ComPtr<ID3D12Resource> readback;
+    D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint{};
+    void* queue = nullptr;
+    void* fence = nullptr;
+    Word fence_value = 0;
+
+    bool submit(void* list)
+    {
+        void* lists[] = {list};
+        invoke(queue, 10, 1, arg(lists));
+        if (!ok(invoke(queue, 14, arg(fence), ++fence_value))) return false;
+        const auto deadline = GetTickCount64() + 10000;
+        while (invoke(fence, 8) < fence_value) {
+            if (GetTickCount64() >= deadline) return false;
+            Sleep(1);
+        }
+        return true;
+    }
+    UINT64 debug_errors()
+    {
+        ComPtr<ID3D12InfoQueue> info;
+        if (FAILED(desktop.As(&info))) return 0;
+        UINT64 errors = 0;
+        for (UINT64 i = 0, n = info->GetNumStoredMessages(); i < n; ++i) {
+            SIZE_T bytes = 0;
+            if (FAILED(info->GetMessage(i, nullptr, &bytes))) continue;
+            std::vector<char> storage(bytes);
+            auto* message = reinterpret_cast<D3D12_MESSAGE*>(storage.data());
+            if (FAILED(info->GetMessage(i, message, &bytes))) continue;
+            if (message->Severity <= D3D12_MESSAGE_SEVERITY_ERROR) {
+                ++errors;
+                std::printf("debug layer: %.*s\n", static_cast<int>(message->DescriptionByteLength), message->pDescription);
+            }
+        }
+        return errors;
+    }
+    // The one texel of a target (4 bytes), copied on a desktop queue.
+    std::uint32_t texel(ID3D12Resource* target)
+    {
+        D3D12_COMMAND_QUEUE_DESC desc{};
+        ComPtr<ID3D12CommandQueue> observer;
+        ComPtr<ID3D12CommandAllocator> allocator;
+        ComPtr<ID3D12GraphicsCommandList> copy;
+        ComPtr<ID3D12Fence> done;
+        if (FAILED(desktop->CreateCommandQueue(&desc, IID_PPV_ARGS(&observer))) ||
+            FAILED(desktop->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator))) ||
+            FAILED(desktop->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.Get(), nullptr, IID_PPV_ARGS(&copy))) ||
+            FAILED(desktop->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&done))))
+            return 0;
+        D3D12_TEXTURE_COPY_LOCATION to{readback.Get(), D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT};
+        to.PlacedFootprint = footprint;
+        D3D12_TEXTURE_COPY_LOCATION from{target, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX};
+        copy->CopyTextureRegion(&to, 0, 0, 0, &from, nullptr);
+        if (FAILED(copy->Close())) return 0;
+        ID3D12CommandList* lists[] = {copy.Get()};
+        observer->ExecuteCommandLists(1, lists);
+        HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
+        const bool finished = event && SUCCEEDED(observer->Signal(done.Get(), 1)) &&
+                              SUCCEEDED(done->SetEventOnCompletion(1, event)) && WaitForSingleObject(event, 10000) == WAIT_OBJECT_0;
+        if (event) CloseHandle(event);
+        void* memory = nullptr;
+        if (!finished || FAILED(readback->Map(0, nullptr, &memory))) return 0;
+        std::uint32_t bits = 0;
+        std::memcpy(&bits, memory, sizeof(bits));
+        readback->Unmap(0, nullptr);
+        return bits;
+    }
+};
+
+bool check_count(const char* name, unsigned& before, unsigned expected_added)
+{
+    const unsigned now = unresolved_now();
+    const bool good = now - before == expected_added;
+    std::printf("%s: refused +%u (expected +%u)\n", name, now - before, expected_added);
+    before = now;
+    return good;
+}
+}  // namespace
+
+int main(int argc, char** argv)
+{
+    if (argc != 2) return 2;
+    ComPtr<IDXGIFactory6> factory;
+    if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 3;
+    ComPtr<IDXGIAdapter> adapter;
+    if (std::strcmp(argv[1], "hardware") == 0) {
+        for (UINT n = 0;; ++n) {
+            ComPtr<IDXGIAdapter1> candidate;
+            const HRESULT hr = factory->EnumAdapterByGpuPreference(n, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&candidate));
+            if (hr == DXGI_ERROR_NOT_FOUND) return 77;
+            if (FAILED(hr)) return 3;
+            DXGI_ADAPTER_DESC1 desc{};
+            if (FAILED(candidate->GetDesc1(&desc))) return 3;
+            if (!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) &&
+                SUCCEEDED(D3D12CreateDevice(candidate.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) {
+                adapter = candidate;
+                break;
+            }
+        }
+    } else if (std::strcmp(argv[1], "warp") != 0 || FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)))) {
+        return 3;
+    }
+    DXGI_ADAPTER_DESC adapter_desc{};
+    if (FAILED(adapter->GetDesc(&adapter_desc))) return 3;
+    std::printf("adapter=%ls\n", adapter_desc.Description);
+
+    Probe probe;
+    std::array<unsigned char, 64> parameters{};
+    void* device = nullptr;
+    if (FAILED(D3D12XboxCreateDevice(adapter.Get(), parameters.data(), __uuidof(ID3D12Device), &device))) return 4;
+    if (FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&probe.desktop)))) return 4;
+
+    // Five 1x1 targets: four with unordered access (A, B, C, D) and one render target (E).
+    D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT};
+    const auto texture = [](DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags) {
+        return D3D12_RESOURCE_DESC{D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 1, 1, 1, 1, format, {1, 0},
+                                   D3D12_TEXTURE_LAYOUT_UNKNOWN, flags};
+    };
+    const D3D12_RESOURCE_DESC uint_desc = texture(DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
+    const D3D12_RESOURCE_DESC float_desc = texture(DXGI_FORMAT_R32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
+    const D3D12_RESOURCE_DESC rt_desc = texture(DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
+    const D3D12_CLEAR_VALUE rt_clear{DXGI_FORMAT_R8G8B8A8_UNORM, {0, 0, 0, 0}};
+    ComPtr<ID3D12Resource> a, b, c, d, e;
+    const auto make = [&](const D3D12_RESOURCE_DESC& desc, ComPtr<ID3D12Resource>& out, const D3D12_CLEAR_VALUE* clear) {
+        return SUCCEEDED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON,
+                                                                clear, IID_PPV_ARGS(&out)));
+    };
+    if (!make(uint_desc, a, nullptr) || !make(uint_desc, b, nullptr) || !make(float_desc, c, nullptr) ||
+        !make(uint_desc, d, nullptr) || !make(rt_desc, e, &rt_clear))
+        return 5;
+    UINT64 bytes = 0;
+    probe.desktop->GetCopyableFootprints(&uint_desc, 0, 1, 0, &probe.footprint, nullptr, nullptr, &bytes);
+    heap.Type = D3D12_HEAP_TYPE_READBACK;
+    const D3D12_RESOURCE_DESC buffer{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0},
+                                     D3D12_TEXTURE_LAYOUT_ROW_MAJOR};
+    if (FAILED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, D3D12_RESOURCE_STATE_COPY_DEST,
+                                                      nullptr, IID_PPV_ARGS(&probe.readback)))) return 5;
+
+    // Heaps: the shader-visible one is read by GPU handle, the plain one by CPU handle. Index 3 of the plain
+    // heap is left empty. Both hold a UAV for A, B and C at the same indexes.
+    const auto make_heap = [&](D3D12_DESCRIPTOR_HEAP_FLAGS flags, void** out) {
+        const struct {
+            D3D12_DESCRIPTOR_HEAP_DESC desc;
+            Word backing, bytes;
+        } desc{{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 4, flags}, 0, 0};
+        return ok(invoke(device, 14, arg(&desc), arg(&__uuidof(ID3D12DescriptorHeap)), arg(out)));
+    };
+    void *visible_heap = nullptr, *plain_heap = nullptr;
+    if (!make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, &visible_heap) || !make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_NONE, &plain_heap))
+        return 6;
+    const UINT stride = probe.desktop->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+    const Word visible_cpu = invoke(visible_heap, 9), plain_cpu = invoke(plain_heap, 9), gpu_start = invoke(visible_heap, 10);
+    D3D12_UNORDERED_ACCESS_VIEW_DESC uint_view{DXGI_FORMAT_R32_UINT, D3D12_UAV_DIMENSION_TEXTURE2D, {}};
+    D3D12_UNORDERED_ACCESS_VIEW_DESC float_view{DXGI_FORMAT_R32_FLOAT, D3D12_UAV_DIMENSION_TEXTURE2D, {}};
+    ID3D12Resource* views[] = {a.Get(), b.Get(), c.Get()};
+    D3D12_UNORDERED_ACCESS_VIEW_DESC* view_descs[] = {&uint_view, &uint_view, &float_view};
+    for (unsigned i = 0; i < 3; ++i) {
+        invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), visible_cpu + i * stride);
+        invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), plain_cpu + i * stride);
+    }
+
+    D3D12_COMMAND_QUEUE_DESC queue_desc{};
+    const unsigned list_desc[] = {D3D12_COMMAND_LIST_TYPE_DIRECT, 2, 1, 0};
+    void *allocator = nullptr, *list = nullptr;
+    if (!ok(invoke(device, 8, arg(&queue_desc), arg(&__uuidof(ID3D12CommandQueue)), arg(&probe.queue))) ||
+        !ok(invoke(device, 36, 0, 0, arg(&__uuidof(ID3D12Fence)), arg(&probe.fence))) ||
+        !ok(invoke(device, 9, D3D12_COMMAND_LIST_TYPE_DIRECT, arg(&__uuidof(ID3D12CommandAllocator)), arg(&allocator))) ||
+        !ok(invoke(device, 73, arg(list_desc), arg(allocator), 0, arg(&__uuidof(ID3D12GraphicsCommandList)), arg(&list))))
+        return 7;
+    if (!ok(invoke(list, 139, arg(allocator), 0))) return 8;
+    void* heaps[] = {visible_heap};
+    invoke(list, 32, 1, arg(heaps));
+
+    const std::uint32_t uint_a[4] = {0x12345678, 0x12345678, 0x12345678, 0x12345678};
+    const std::uint32_t uint_b1[4] = {0x11111111, 0x11111111, 0x11111111, 0x11111111};
+    const std::uint32_t uint_b2[4] = {0x0badf00d, 0x0badf00d, 0x0badf00d, 0x0badf00d};
+    const float float_c[4] = {1.5f, 1.5f, 1.5f, 1.5f};
+    const D3D12_RECT whole{0, 0, 1, 1};
+
+    unsigned seen = unresolved_now();
+    invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), arg(uint_a), 0, 0);
+    if (!check_count("1 uint clear of A", seen, 0)) return 10;
+    invoke(list, 53, gpu_start + stride, plain_cpu + stride, arg(b.Get()), arg(uint_b1), 1, arg(&whole));
+    if (!check_count("2 uint clear of B with a rect", seen, 0)) return 11;
+    invoke(list, 54, gpu_start + 2 * stride, plain_cpu + 2 * stride, arg(c.Get()), arg(float_c), 0, 0);
+    if (!check_count("3 float clear of C", seen, 0)) return 12;
+    // The GPU handle is far past the four-descriptor heap: no known heap holds it.
+    invoke(list, 53, gpu_start + 64 * stride, plain_cpu + stride, arg(b.Get()), arg(uint_b2), 0, 0);
+    if (!check_count("4 clear of B through a GPU handle on no heap", seen, 1)) return 13;
+    invoke(list, 53, gpu_start + 3 * stride, plain_cpu + 3 * stride, arg(d.Get()), arg(uint_b2), 0, 0);
+    if (!check_count("5 clear through a CPU handle holding no view", seen, 1)) return 14;
+    invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), 0, 0, 0);
+    if (!check_count("6 clear with no values", seen, 1)) return 15;
+
+    const D3D12_DISCARD_REGION region{1, &whole, 0, 1};
+    invoke(list, 55, arg(e.Get()), 0);
+    invoke(list, 55, arg(e.Get()), arg(&region));
+    invoke(list, 55, 0, 0);
+    if (!check_count("7 discards of the render target", seen, 0)) return 16;
+
+    invoke(list, 9);
+    if (!probe.submit(list)) return 17;
+    const std::uint32_t bits_a = probe.texel(a.Get());
+    const std::uint32_t bits_b = probe.texel(b.Get());
+    const std::uint32_t bits_c = probe.texel(c.Get());
+    std::printf("8 A after the uint clear: %08x (expected 12345678)\n", bits_a);
+    std::printf("9 B after the refused clear: %08x (expected 11111111)\n", bits_b);
+    std::printf("10 C after the float clear: %08x (expected 3fc00000)\n", bits_c);
+    if (bits_a != 0x12345678) return 18;
+    if (bits_b != 0x11111111) return 19;
+    if (bits_c != 0x3fc00000) return 20;
+
+    const HRESULT removed = probe.desktop->GetDeviceRemovedReason();
+    const UINT64 errors = probe.debug_errors();

P2 Badge Count debug-layer errors before the shim drains them

Both registered tests enable X2W_D3D12_DEBUG=1, under which Probe::submit reaches queue_execute, calls check_device, and clears the same device's stored debug messages with ClearStoredMessages(). 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, as startup_root_heap.cpp does, or expose a cumulative error count instead of inspecting the drained queue.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687563485 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4687563485). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:45:39Z. **Code review location:** `tests/startup_clear_uav.cpp`; line 266 ~~~~diff @@ -0,0 +1,270 @@ +// ClearUnorderedAccessViewUint / ClearUnorderedAccessViewFloat / DiscardResource on a console command list +// (list slots 53, 54 and 55, device slot 19). +// +// startup_clear_uav <warp|hardware> (X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1) +// +// Through D3D12XboxCreateDevice the probe makes 1x1 targets with unordered access and records, on one list: +// +// A R32_UINT ClearUnorderedAccessViewUint(0x12345678) read back: 12345678 +// B R32_UINT cleared 0x11111111, then a clear with a GPU handle on no heap (refused, counted) +// read back: 11111111 +// C R32_FLOAT ClearUnorderedAccessViewFloat(1.5) read back: 3fc00000 +// D R32_UINT a clear through a CPU handle that holds no view (refused, counted) +// E RGBA8 RTV DiscardResource, with and without a region list closes and executes +// +// The shader-visible heap holds the GPU-side descriptors, a second heap holds the CPU-side copies the +// desktop API requires. The desktop device must not be removed and the debug layer must store no errors. +// +// Exit codes: 0 pass, 77 no physical adapter, other values name the failing step. +#include <d3d12.h> +#include <d3d12sdklayers.h> +#include <dxgi1_6.h> +#include <wrl/client.h> + +#include <array> +#include <cstdint> +#include <cstdio> +#include <cstring> +#include <vector> + +using Microsoft::WRL::ComPtr; +extern "C" __declspec(dllimport) HRESULT WINAPI D3D12XboxCreateDevice(IUnknown*, const void*, REFIID, void**); +extern "C" __declspec(dllimport) void x2w_d3d12_render_target_stats(unsigned* binds, unsigned* unresolved); + +namespace { +using Word = std::uint64_t; +template <class T> Word arg(T* value) { return reinterpret_cast<Word>(value); } +Word invoke(void* object, unsigned index, Word a = 0, Word b = 0, Word c = 0, Word d = 0, Word e = 0, Word f = 0, Word g = 0) +{ + using Slot = Word (WINAPI*)(void*, Word, Word, Word, Word, Word, Word, Word); + return reinterpret_cast<Slot>((*static_cast<void***>(object))[index])(object, a, b, c, d, e, f, g); +} +bool ok(Word hr) { return SUCCEEDED(static_cast<HRESULT>(hr)); } + +unsigned unresolved_now() +{ + unsigned binds = 0, unresolved = 0; + x2w_d3d12_render_target_stats(&binds, &unresolved); + return unresolved; +} + +struct Probe { + ComPtr<ID3D12Device> desktop; + ComPtr<ID3D12Resource> readback; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint{}; + void* queue = nullptr; + void* fence = nullptr; + Word fence_value = 0; + + bool submit(void* list) + { + void* lists[] = {list}; + invoke(queue, 10, 1, arg(lists)); + if (!ok(invoke(queue, 14, arg(fence), ++fence_value))) return false; + const auto deadline = GetTickCount64() + 10000; + while (invoke(fence, 8) < fence_value) { + if (GetTickCount64() >= deadline) return false; + Sleep(1); + } + return true; + } + UINT64 debug_errors() + { + ComPtr<ID3D12InfoQueue> info; + if (FAILED(desktop.As(&info))) return 0; + UINT64 errors = 0; + for (UINT64 i = 0, n = info->GetNumStoredMessages(); i < n; ++i) { + SIZE_T bytes = 0; + if (FAILED(info->GetMessage(i, nullptr, &bytes))) continue; + std::vector<char> storage(bytes); + auto* message = reinterpret_cast<D3D12_MESSAGE*>(storage.data()); + if (FAILED(info->GetMessage(i, message, &bytes))) continue; + if (message->Severity <= D3D12_MESSAGE_SEVERITY_ERROR) { + ++errors; + std::printf("debug layer: %.*s\n", static_cast<int>(message->DescriptionByteLength), message->pDescription); + } + } + return errors; + } + // The one texel of a target (4 bytes), copied on a desktop queue. + std::uint32_t texel(ID3D12Resource* target) + { + D3D12_COMMAND_QUEUE_DESC desc{}; + ComPtr<ID3D12CommandQueue> observer; + ComPtr<ID3D12CommandAllocator> allocator; + ComPtr<ID3D12GraphicsCommandList> copy; + ComPtr<ID3D12Fence> done; + if (FAILED(desktop->CreateCommandQueue(&desc, IID_PPV_ARGS(&observer))) || + FAILED(desktop->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator))) || + FAILED(desktop->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.Get(), nullptr, IID_PPV_ARGS(&copy))) || + FAILED(desktop->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&done)))) + return 0; + D3D12_TEXTURE_COPY_LOCATION to{readback.Get(), D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT}; + to.PlacedFootprint = footprint; + D3D12_TEXTURE_COPY_LOCATION from{target, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX}; + copy->CopyTextureRegion(&to, 0, 0, 0, &from, nullptr); + if (FAILED(copy->Close())) return 0; + ID3D12CommandList* lists[] = {copy.Get()}; + observer->ExecuteCommandLists(1, lists); + HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + const bool finished = event && SUCCEEDED(observer->Signal(done.Get(), 1)) && + SUCCEEDED(done->SetEventOnCompletion(1, event)) && WaitForSingleObject(event, 10000) == WAIT_OBJECT_0; + if (event) CloseHandle(event); + void* memory = nullptr; + if (!finished || FAILED(readback->Map(0, nullptr, &memory))) return 0; + std::uint32_t bits = 0; + std::memcpy(&bits, memory, sizeof(bits)); + readback->Unmap(0, nullptr); + return bits; + } +}; + +bool check_count(const char* name, unsigned& before, unsigned expected_added) +{ + const unsigned now = unresolved_now(); + const bool good = now - before == expected_added; + std::printf("%s: refused +%u (expected +%u)\n", name, now - before, expected_added); + before = now; + return good; +} +} // namespace + +int main(int argc, char** argv) +{ + if (argc != 2) return 2; + ComPtr<IDXGIFactory6> factory; + if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 3; + ComPtr<IDXGIAdapter> adapter; + if (std::strcmp(argv[1], "hardware") == 0) { + for (UINT n = 0;; ++n) { + ComPtr<IDXGIAdapter1> candidate; + const HRESULT hr = factory->EnumAdapterByGpuPreference(n, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&candidate)); + if (hr == DXGI_ERROR_NOT_FOUND) return 77; + if (FAILED(hr)) return 3; + DXGI_ADAPTER_DESC1 desc{}; + if (FAILED(candidate->GetDesc1(&desc))) return 3; + if (!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) && + SUCCEEDED(D3D12CreateDevice(candidate.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) { + adapter = candidate; + break; + } + } + } else if (std::strcmp(argv[1], "warp") != 0 || FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)))) { + return 3; + } + DXGI_ADAPTER_DESC adapter_desc{}; + if (FAILED(adapter->GetDesc(&adapter_desc))) return 3; + std::printf("adapter=%ls\n", adapter_desc.Description); + + Probe probe; + std::array<unsigned char, 64> parameters{}; + void* device = nullptr; + if (FAILED(D3D12XboxCreateDevice(adapter.Get(), parameters.data(), __uuidof(ID3D12Device), &device))) return 4; + if (FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&probe.desktop)))) return 4; + + // Five 1x1 targets: four with unordered access (A, B, C, D) and one render target (E). + D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT}; + const auto texture = [](DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags) { + return D3D12_RESOURCE_DESC{D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 1, 1, 1, 1, format, {1, 0}, + D3D12_TEXTURE_LAYOUT_UNKNOWN, flags}; + }; + const D3D12_RESOURCE_DESC uint_desc = texture(DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); + const D3D12_RESOURCE_DESC float_desc = texture(DXGI_FORMAT_R32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); + const D3D12_RESOURCE_DESC rt_desc = texture(DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET); + const D3D12_CLEAR_VALUE rt_clear{DXGI_FORMAT_R8G8B8A8_UNORM, {0, 0, 0, 0}}; + ComPtr<ID3D12Resource> a, b, c, d, e; + const auto make = [&](const D3D12_RESOURCE_DESC& desc, ComPtr<ID3D12Resource>& out, const D3D12_CLEAR_VALUE* clear) { + return SUCCEEDED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, + clear, IID_PPV_ARGS(&out))); + }; + if (!make(uint_desc, a, nullptr) || !make(uint_desc, b, nullptr) || !make(float_desc, c, nullptr) || + !make(uint_desc, d, nullptr) || !make(rt_desc, e, &rt_clear)) + return 5; + UINT64 bytes = 0; + probe.desktop->GetCopyableFootprints(&uint_desc, 0, 1, 0, &probe.footprint, nullptr, nullptr, &bytes); + heap.Type = D3D12_HEAP_TYPE_READBACK; + const D3D12_RESOURCE_DESC buffer{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0}, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR}; + if (FAILED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, IID_PPV_ARGS(&probe.readback)))) return 5; + + // Heaps: the shader-visible one is read by GPU handle, the plain one by CPU handle. Index 3 of the plain + // heap is left empty. Both hold a UAV for A, B and C at the same indexes. + const auto make_heap = [&](D3D12_DESCRIPTOR_HEAP_FLAGS flags, void** out) { + const struct { + D3D12_DESCRIPTOR_HEAP_DESC desc; + Word backing, bytes; + } desc{{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 4, flags}, 0, 0}; + return ok(invoke(device, 14, arg(&desc), arg(&__uuidof(ID3D12DescriptorHeap)), arg(out))); + }; + void *visible_heap = nullptr, *plain_heap = nullptr; + if (!make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, &visible_heap) || !make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_NONE, &plain_heap)) + return 6; + const UINT stride = probe.desktop->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + const Word visible_cpu = invoke(visible_heap, 9), plain_cpu = invoke(plain_heap, 9), gpu_start = invoke(visible_heap, 10); + D3D12_UNORDERED_ACCESS_VIEW_DESC uint_view{DXGI_FORMAT_R32_UINT, D3D12_UAV_DIMENSION_TEXTURE2D, {}}; + D3D12_UNORDERED_ACCESS_VIEW_DESC float_view{DXGI_FORMAT_R32_FLOAT, D3D12_UAV_DIMENSION_TEXTURE2D, {}}; + ID3D12Resource* views[] = {a.Get(), b.Get(), c.Get()}; + D3D12_UNORDERED_ACCESS_VIEW_DESC* view_descs[] = {&uint_view, &uint_view, &float_view}; + for (unsigned i = 0; i < 3; ++i) { + invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), visible_cpu + i * stride); + invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), plain_cpu + i * stride); + } + + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + const unsigned list_desc[] = {D3D12_COMMAND_LIST_TYPE_DIRECT, 2, 1, 0}; + void *allocator = nullptr, *list = nullptr; + if (!ok(invoke(device, 8, arg(&queue_desc), arg(&__uuidof(ID3D12CommandQueue)), arg(&probe.queue))) || + !ok(invoke(device, 36, 0, 0, arg(&__uuidof(ID3D12Fence)), arg(&probe.fence))) || + !ok(invoke(device, 9, D3D12_COMMAND_LIST_TYPE_DIRECT, arg(&__uuidof(ID3D12CommandAllocator)), arg(&allocator))) || + !ok(invoke(device, 73, arg(list_desc), arg(allocator), 0, arg(&__uuidof(ID3D12GraphicsCommandList)), arg(&list)))) + return 7; + if (!ok(invoke(list, 139, arg(allocator), 0))) return 8; + void* heaps[] = {visible_heap}; + invoke(list, 32, 1, arg(heaps)); + + const std::uint32_t uint_a[4] = {0x12345678, 0x12345678, 0x12345678, 0x12345678}; + const std::uint32_t uint_b1[4] = {0x11111111, 0x11111111, 0x11111111, 0x11111111}; + const std::uint32_t uint_b2[4] = {0x0badf00d, 0x0badf00d, 0x0badf00d, 0x0badf00d}; + const float float_c[4] = {1.5f, 1.5f, 1.5f, 1.5f}; + const D3D12_RECT whole{0, 0, 1, 1}; + + unsigned seen = unresolved_now(); + invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), arg(uint_a), 0, 0); + if (!check_count("1 uint clear of A", seen, 0)) return 10; + invoke(list, 53, gpu_start + stride, plain_cpu + stride, arg(b.Get()), arg(uint_b1), 1, arg(&whole)); + if (!check_count("2 uint clear of B with a rect", seen, 0)) return 11; + invoke(list, 54, gpu_start + 2 * stride, plain_cpu + 2 * stride, arg(c.Get()), arg(float_c), 0, 0); + if (!check_count("3 float clear of C", seen, 0)) return 12; + // The GPU handle is far past the four-descriptor heap: no known heap holds it. + invoke(list, 53, gpu_start + 64 * stride, plain_cpu + stride, arg(b.Get()), arg(uint_b2), 0, 0); + if (!check_count("4 clear of B through a GPU handle on no heap", seen, 1)) return 13; + invoke(list, 53, gpu_start + 3 * stride, plain_cpu + 3 * stride, arg(d.Get()), arg(uint_b2), 0, 0); + if (!check_count("5 clear through a CPU handle holding no view", seen, 1)) return 14; + invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), 0, 0, 0); + if (!check_count("6 clear with no values", seen, 1)) return 15; + + const D3D12_DISCARD_REGION region{1, &whole, 0, 1}; + invoke(list, 55, arg(e.Get()), 0); + invoke(list, 55, arg(e.Get()), arg(&region)); + invoke(list, 55, 0, 0); + if (!check_count("7 discards of the render target", seen, 0)) return 16; + + invoke(list, 9); + if (!probe.submit(list)) return 17; + const std::uint32_t bits_a = probe.texel(a.Get()); + const std::uint32_t bits_b = probe.texel(b.Get()); + const std::uint32_t bits_c = probe.texel(c.Get()); + std::printf("8 A after the uint clear: %08x (expected 12345678)\n", bits_a); + std::printf("9 B after the refused clear: %08x (expected 11111111)\n", bits_b); + std::printf("10 C after the float clear: %08x (expected 3fc00000)\n", bits_c); + if (bits_a != 0x12345678) return 18; + if (bits_b != 0x11111111) return 19; + if (bits_c != 0x3fc00000) return 20; + + const HRESULT removed = probe.desktop->GetDeviceRemovedReason(); + const UINT64 errors = probe.debug_errors(); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Count debug-layer errors before the shim drains them** Both registered tests enable `X2W_D3D12_DEBUG=1`, under which `Probe::submit` reaches `queue_execute`, calls `check_device`, and clears the same device's stored debug messages with `ClearStoredMessages()`. 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, as `startup_root_heap.cpp` does, or expose a cumulative error count instead of inspecting the drained queue. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Makto94 commented 2026-11-25 01:02:00 +00:00 (Migrated from github.com)

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).

ctest --test-dir out/build/dev -j1 --no-tests=error -R '^startup_clear_uav_' -V

In both startup_clear_uav_warp and startup_clear_uav_hardware the debug layer emits three sev=1 messages (D3D12_MESSAGE_SEVERITY_ERROR), yet the last line of each test is debug layer errors: 0:

x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewUint: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list.
x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewUint: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list.
x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewFloat: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list.
...
device removed reason: 0x00000000, debug 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.cpp at this head concerns the same error counter.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147955542 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7147955542). Originally posted by [Makto94](https://github.com/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). ``` ctest --test-dir out/build/dev -j1 --no-tests=error -R '^startup_clear_uav_' -V ``` In both `startup_clear_uav_warp` and `startup_clear_uav_hardware` the debug layer emits three `sev=1` messages (`D3D12_MESSAGE_SEVERITY_ERROR`), yet the last line of each test is `debug layer errors: 0`: ``` x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewUint: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list. x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewUint: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list. x2w-d3d12-debug [CommandQueue execute 35] sev=1 id=1314 ID3D12CommandList::ClearUnorderedAccessViewFloat: The specified GPU decriptor handle needs to be from the descriptor heap currently set on the command list. ... device removed reason: 0x00000000, debug 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.cpp` at this head concerns the same error counter.
tedin7 commented 2026-11-25 02:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:00Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050026935 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#pullrequestreview-6050026935). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:00Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 02:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:02Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050027161 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#pullrequestreview-6050027161). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:02Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 02:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:04Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050027369 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#pullrequestreview-6050027369). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:04Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 02:02:14 +00:00 (Migrated from github.com)

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 2183

@@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour,
                                 rect_count ? rects : nullptr);
     InterlockedIncrement(&render_clears);
 }
+// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap.
+bool known_view_gpu_handle(u64 gpu)
+{
+    bool found = false;
+    AcquireSRWLockShared(&note_lock);
+    for (const HeapInfo& heap : heap_infos()) {
+        if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue;
+        const u64 offset = gpu - heap.desktop_gpu;
+        if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) {
+            found = true;
+            break;
+        }
+    }
+    ReleaseSRWLockShared(&note_lock);
+    return found;
+}
+// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU
+// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the
+// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no
+// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is
+// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS
+// around the clear.
+template <bool Float>
+void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values,
+                              UINT rect_count, const D3D12_RECT* rects)
+{
+    if (!self->own().list_open) return;
+    static LONG logged, refused;
+    const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint";
+    const u64 desktop = desktop_cpu_handle(cpu_handle);
+    const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{};
+    ID3D12Resource* target = view.resource;
+    const char* why = nullptr;
+    if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values";
+    else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects";
+    else if (!target) why = view.wrong_kind ? "view is not an unordered-access view"
+                            : view.skipped ? "view was skipped at creation" : "view holds no known resource";
+    else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap";
+    else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access";
+    if (why) {
+        InterlockedIncrement(&render_target_unresolved);
+        if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle);
+        return;
+    }
+    if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count);
+    auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real);
+    require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+    const D3D12_GPU_DESCRIPTOR_HANDLE gpu{gpu_handle};
+    const D3D12_CPU_DESCRIPTOR_HANDLE cpu{static_cast<SIZE_T>(desktop)};
+    if (Float) list->ClearUnorderedAccessViewFloat(gpu, cpu, target, static_cast<const float*>(values), rect_count, rect_count ? rects : nullptr);
+    else list->ClearUnorderedAccessViewUint(gpu, cpu, target, static_cast<const UINT*>(values), rect_count, rect_count ? rects : nullptr);

Fixed in 248e2d5d and 99cc35ae. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688829492 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4688829492). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:00Z. **Code review location:** `src/startup_stubs/d3d12_xs_device.cpp`; line 2183 ~~~~diff @@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour, rect_count ? rects : nullptr); InterlockedIncrement(&render_clears); } +// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap. +bool known_view_gpu_handle(u64 gpu) +{ + bool found = false; + AcquireSRWLockShared(&note_lock); + for (const HeapInfo& heap : heap_infos()) { + if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue; + const u64 offset = gpu - heap.desktop_gpu; + if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) { + found = true; + break; + } + } + ReleaseSRWLockShared(&note_lock); + return found; +} +// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU +// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the +// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no +// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is +// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS +// around the clear. +template <bool Float> +void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values, + UINT rect_count, const D3D12_RECT* rects) +{ + if (!self->own().list_open) return; + static LONG logged, refused; + const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint"; + const u64 desktop = desktop_cpu_handle(cpu_handle); + const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{}; + ID3D12Resource* target = view.resource; + const char* why = nullptr; + if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values"; + else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects"; + else if (!target) why = view.wrong_kind ? "view is not an unordered-access view" + : view.skipped ? "view was skipped at creation" : "view holds no known resource"; + else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap"; + else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access"; + if (why) { + InterlockedIncrement(&render_target_unresolved); + if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle); + return; + } + if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count); + auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real); + require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + const D3D12_GPU_DESCRIPTOR_HANDLE gpu{gpu_handle}; + const D3D12_CPU_DESCRIPTOR_HANDLE cpu{static_cast<SIZE_T>(desktop)}; + if (Float) list->ClearUnorderedAccessViewFloat(gpu, cpu, target, static_cast<const float*>(values), rect_count, rect_count ? rects : nullptr); + else list->ClearUnorderedAccessViewUint(gpu, cpu, target, static_cast<const UINT*>(values), rect_count, rect_count ? rects : nullptr); ~~~~ --- Fixed in 248e2d5d and 99cc35ae. 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.
tedin7 commented 2026-11-25 02:02:14 +00:00 (Migrated from github.com)

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 2179

@@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour,
                                 rect_count ? rects : nullptr);
     InterlockedIncrement(&render_clears);
 }
+// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap.
+bool known_view_gpu_handle(u64 gpu)
+{
+    bool found = false;
+    AcquireSRWLockShared(&note_lock);
+    for (const HeapInfo& heap : heap_infos()) {
+        if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue;
+        const u64 offset = gpu - heap.desktop_gpu;
+        if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) {
+            found = true;
+            break;
+        }
+    }
+    ReleaseSRWLockShared(&note_lock);
+    return found;
+}
+// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU
+// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the
+// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no
+// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is
+// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS
+// around the clear.
+template <bool Float>
+void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values,
+                              UINT rect_count, const D3D12_RECT* rects)
+{
+    if (!self->own().list_open) return;
+    static LONG logged, refused;
+    const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint";
+    const u64 desktop = desktop_cpu_handle(cpu_handle);
+    const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{};
+    ID3D12Resource* target = view.resource;
+    const char* why = nullptr;
+    if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values";
+    else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects";
+    else if (!target) why = view.wrong_kind ? "view is not an unordered-access view"
+                            : view.skipped ? "view was skipped at creation" : "view holds no known resource";
+    else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap";
+    else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access";
+    if (why) {
+        InterlockedIncrement(&render_target_unresolved);
+        if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle);
+        return;
+    }
+    if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count);
+    auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real);
+    require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);

Fixed in 248e2d5d and 99cc35ae. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688829683 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4688829683). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:02Z. **Code review location:** `src/startup_stubs/d3d12_xs_device.cpp`; line 2179 ~~~~diff @@ -2130,6 +2130,85 @@ void __stdcall list_clear_target(Wrapper* self, u64 handle, const float* colour, rect_count ? rects : nullptr); InterlockedIncrement(&render_clears); } +// True when the shader-visible handle lies on a descriptor of a known CBV/SRV/UAV heap. +bool known_view_gpu_handle(u64 gpu) +{ + bool found = false; + AcquireSRWLockShared(&note_lock); + for (const HeapInfo& heap : heap_infos()) { + if (heap.type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || !heap.desktop_gpu || gpu < heap.desktop_gpu) continue; + const u64 offset = gpu - heap.desktop_gpu; + if (heap.increment && offset < u64{heap.count} * heap.increment && offset % heap.increment == 0) { + found = true; + break; + } + } + ReleaseSRWLockShared(&note_lock); + return found; +} +// List slots 53 and 54 (desktop 49/50 + 4), ClearUnorderedAccessViewUint/Float(view GPU handle, view CPU +// handle, resource, values, rect count, rects). The CPU handle is read from its shadow record, like the +// render-target clear, so a copied descriptor clears the resource it holds now. A GPU handle that is on no +// known heap, a CPU handle that holds no unordered-access view, or a resource without unordered access is +// refused (logged, counted) instead of reaching the desktop list. The target moves to UNORDERED_ACCESS +// around the clear. +template <bool Float> +void __stdcall list_clear_uav(Wrapper* self, u64 gpu_handle, u64 cpu_handle, u64 title_resource, const void* values, + UINT rect_count, const D3D12_RECT* rects) +{ + if (!self->own().list_open) return; + static LONG logged, refused; + const char* name = Float ? "ClearUnorderedAccessViewFloat" : "ClearUnorderedAccessViewUint"; + const u64 desktop = desktop_cpu_handle(cpu_handle); + const ResolvedView view = desktop ? resolve_view(desktop, 19) : ResolvedView{}; + ID3D12Resource* target = view.resource; + const char* why = nullptr; + if (!x2w_local::readable(values, 4 * sizeof(UINT))) why = "no clear values"; + else if (rect_count && !x2w_local::readable(rects, std::size_t{rect_count} * sizeof(D3D12_RECT))) why = "unreadable rects"; + else if (!target) why = view.wrong_kind ? "view is not an unordered-access view" + : view.skipped ? "view was skipped at creation" : "view holds no known resource"; + else if (!known_view_gpu_handle(gpu_handle)) why = "GPU handle is on no known descriptor heap"; + else if (!(target->GetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) why = "resource lacks unordered access"; + if (why) { + InterlockedIncrement(&render_target_unresolved); + if (first_calls(refused, 6)) log("x2w-d3d12 %s skipped: %s (view 0x%llx)", name, why, cpu_handle); + return; + } + if (first_calls(logged, 4)) log("x2w-render %s view=0x%llx target=%p rects=%u", name, cpu_handle, static_cast<void*>(target), rect_count); + auto* list = static_cast<ID3D12GraphicsCommandList*>(self->own().real); + require_state(self, target, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); ~~~~ --- Fixed in 248e2d5d and 99cc35ae. 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.
tedin7 commented 2026-11-25 02:02:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:12:04Z.

Code review location: tests/startup_clear_uav.cpp; line 266

@@ -0,0 +1,270 @@
+// ClearUnorderedAccessViewUint / ClearUnorderedAccessViewFloat / DiscardResource on a console command list
+// (list slots 53, 54 and 55, device slot 19).
+//
+//   startup_clear_uav <warp|hardware>     (X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1)
+//
+// Through D3D12XboxCreateDevice the probe makes 1x1 targets with unordered access and records, on one list:
+//
+//   A  R32_UINT   ClearUnorderedAccessViewUint(0x12345678)            read back: 12345678
+//   B  R32_UINT   cleared 0x11111111, then a clear with a GPU handle on no heap (refused, counted)
+//                                                                     read back: 11111111
+//   C  R32_FLOAT  ClearUnorderedAccessViewFloat(1.5)                  read back: 3fc00000
+//   D  R32_UINT   a clear through a CPU handle that holds no view (refused, counted)
+//   E  RGBA8 RTV  DiscardResource, with and without a region          list closes and executes
+//
+// The shader-visible heap holds the GPU-side descriptors, a second heap holds the CPU-side copies the
+// desktop API requires. The desktop device must not be removed and the debug layer must store no errors.
+//
+// Exit codes: 0 pass, 77 no physical adapter, other values name the failing step.
+#include <d3d12.h>
+#include <d3d12sdklayers.h>
+#include <dxgi1_6.h>
+#include <wrl/client.h>
+
+#include <array>
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
+#include <vector>
+
+using Microsoft::WRL::ComPtr;
+extern "C" __declspec(dllimport) HRESULT WINAPI D3D12XboxCreateDevice(IUnknown*, const void*, REFIID, void**);
+extern "C" __declspec(dllimport) void x2w_d3d12_render_target_stats(unsigned* binds, unsigned* unresolved);
+
+namespace {
+using Word = std::uint64_t;
+template <class T> Word arg(T* value) { return reinterpret_cast<Word>(value); }
+Word invoke(void* object, unsigned index, Word a = 0, Word b = 0, Word c = 0, Word d = 0, Word e = 0, Word f = 0, Word g = 0)
+{
+    using Slot = Word (WINAPI*)(void*, Word, Word, Word, Word, Word, Word, Word);
+    return reinterpret_cast<Slot>((*static_cast<void***>(object))[index])(object, a, b, c, d, e, f, g);
+}
+bool ok(Word hr) { return SUCCEEDED(static_cast<HRESULT>(hr)); }
+
+unsigned unresolved_now()
+{
+    unsigned binds = 0, unresolved = 0;
+    x2w_d3d12_render_target_stats(&binds, &unresolved);
+    return unresolved;
+}
+
+struct Probe {
+    ComPtr<ID3D12Device> desktop;
+    ComPtr<ID3D12Resource> readback;
+    D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint{};
+    void* queue = nullptr;
+    void* fence = nullptr;
+    Word fence_value = 0;
+
+    bool submit(void* list)
+    {
+        void* lists[] = {list};
+        invoke(queue, 10, 1, arg(lists));
+        if (!ok(invoke(queue, 14, arg(fence), ++fence_value))) return false;
+        const auto deadline = GetTickCount64() + 10000;
+        while (invoke(fence, 8) < fence_value) {
+            if (GetTickCount64() >= deadline) return false;
+            Sleep(1);
+        }
+        return true;
+    }
+    UINT64 debug_errors()
+    {
+        ComPtr<ID3D12InfoQueue> info;
+        if (FAILED(desktop.As(&info))) return 0;
+        UINT64 errors = 0;
+        for (UINT64 i = 0, n = info->GetNumStoredMessages(); i < n; ++i) {
+            SIZE_T bytes = 0;
+            if (FAILED(info->GetMessage(i, nullptr, &bytes))) continue;
+            std::vector<char> storage(bytes);
+            auto* message = reinterpret_cast<D3D12_MESSAGE*>(storage.data());
+            if (FAILED(info->GetMessage(i, message, &bytes))) continue;
+            if (message->Severity <= D3D12_MESSAGE_SEVERITY_ERROR) {
+                ++errors;
+                std::printf("debug layer: %.*s\n", static_cast<int>(message->DescriptionByteLength), message->pDescription);
+            }
+        }
+        return errors;
+    }
+    // The one texel of a target (4 bytes), copied on a desktop queue.
+    std::uint32_t texel(ID3D12Resource* target)
+    {
+        D3D12_COMMAND_QUEUE_DESC desc{};
+        ComPtr<ID3D12CommandQueue> observer;
+        ComPtr<ID3D12CommandAllocator> allocator;
+        ComPtr<ID3D12GraphicsCommandList> copy;
+        ComPtr<ID3D12Fence> done;
+        if (FAILED(desktop->CreateCommandQueue(&desc, IID_PPV_ARGS(&observer))) ||
+            FAILED(desktop->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator))) ||
+            FAILED(desktop->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.Get(), nullptr, IID_PPV_ARGS(&copy))) ||
+            FAILED(desktop->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&done))))
+            return 0;
+        D3D12_TEXTURE_COPY_LOCATION to{readback.Get(), D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT};
+        to.PlacedFootprint = footprint;
+        D3D12_TEXTURE_COPY_LOCATION from{target, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX};
+        copy->CopyTextureRegion(&to, 0, 0, 0, &from, nullptr);
+        if (FAILED(copy->Close())) return 0;
+        ID3D12CommandList* lists[] = {copy.Get()};
+        observer->ExecuteCommandLists(1, lists);
+        HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
+        const bool finished = event && SUCCEEDED(observer->Signal(done.Get(), 1)) &&
+                              SUCCEEDED(done->SetEventOnCompletion(1, event)) && WaitForSingleObject(event, 10000) == WAIT_OBJECT_0;
+        if (event) CloseHandle(event);
+        void* memory = nullptr;
+        if (!finished || FAILED(readback->Map(0, nullptr, &memory))) return 0;
+        std::uint32_t bits = 0;
+        std::memcpy(&bits, memory, sizeof(bits));
+        readback->Unmap(0, nullptr);
+        return bits;
+    }
+};
+
+bool check_count(const char* name, unsigned& before, unsigned expected_added)
+{
+    const unsigned now = unresolved_now();
+    const bool good = now - before == expected_added;
+    std::printf("%s: refused +%u (expected +%u)\n", name, now - before, expected_added);
+    before = now;
+    return good;
+}
+}  // namespace
+
+int main(int argc, char** argv)
+{
+    if (argc != 2) return 2;
+    ComPtr<IDXGIFactory6> factory;
+    if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 3;
+    ComPtr<IDXGIAdapter> adapter;
+    if (std::strcmp(argv[1], "hardware") == 0) {
+        for (UINT n = 0;; ++n) {
+            ComPtr<IDXGIAdapter1> candidate;
+            const HRESULT hr = factory->EnumAdapterByGpuPreference(n, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&candidate));
+            if (hr == DXGI_ERROR_NOT_FOUND) return 77;
+            if (FAILED(hr)) return 3;
+            DXGI_ADAPTER_DESC1 desc{};
+            if (FAILED(candidate->GetDesc1(&desc))) return 3;
+            if (!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) &&
+                SUCCEEDED(D3D12CreateDevice(candidate.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) {
+                adapter = candidate;
+                break;
+            }
+        }
+    } else if (std::strcmp(argv[1], "warp") != 0 || FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)))) {
+        return 3;
+    }
+    DXGI_ADAPTER_DESC adapter_desc{};
+    if (FAILED(adapter->GetDesc(&adapter_desc))) return 3;
+    std::printf("adapter=%ls\n", adapter_desc.Description);
+
+    Probe probe;
+    std::array<unsigned char, 64> parameters{};
+    void* device = nullptr;
+    if (FAILED(D3D12XboxCreateDevice(adapter.Get(), parameters.data(), __uuidof(ID3D12Device), &device))) return 4;
+    if (FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&probe.desktop)))) return 4;
+
+    // Five 1x1 targets: four with unordered access (A, B, C, D) and one render target (E).
+    D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT};
+    const auto texture = [](DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags) {
+        return D3D12_RESOURCE_DESC{D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 1, 1, 1, 1, format, {1, 0},
+                                   D3D12_TEXTURE_LAYOUT_UNKNOWN, flags};
+    };
+    const D3D12_RESOURCE_DESC uint_desc = texture(DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
+    const D3D12_RESOURCE_DESC float_desc = texture(DXGI_FORMAT_R32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
+    const D3D12_RESOURCE_DESC rt_desc = texture(DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
+    const D3D12_CLEAR_VALUE rt_clear{DXGI_FORMAT_R8G8B8A8_UNORM, {0, 0, 0, 0}};
+    ComPtr<ID3D12Resource> a, b, c, d, e;
+    const auto make = [&](const D3D12_RESOURCE_DESC& desc, ComPtr<ID3D12Resource>& out, const D3D12_CLEAR_VALUE* clear) {
+        return SUCCEEDED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON,
+                                                                clear, IID_PPV_ARGS(&out)));
+    };
+    if (!make(uint_desc, a, nullptr) || !make(uint_desc, b, nullptr) || !make(float_desc, c, nullptr) ||
+        !make(uint_desc, d, nullptr) || !make(rt_desc, e, &rt_clear))
+        return 5;
+    UINT64 bytes = 0;
+    probe.desktop->GetCopyableFootprints(&uint_desc, 0, 1, 0, &probe.footprint, nullptr, nullptr, &bytes);
+    heap.Type = D3D12_HEAP_TYPE_READBACK;
+    const D3D12_RESOURCE_DESC buffer{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0},
+                                     D3D12_TEXTURE_LAYOUT_ROW_MAJOR};
+    if (FAILED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, D3D12_RESOURCE_STATE_COPY_DEST,
+                                                      nullptr, IID_PPV_ARGS(&probe.readback)))) return 5;
+
+    // Heaps: the shader-visible one is read by GPU handle, the plain one by CPU handle. Index 3 of the plain
+    // heap is left empty. Both hold a UAV for A, B and C at the same indexes.
+    const auto make_heap = [&](D3D12_DESCRIPTOR_HEAP_FLAGS flags, void** out) {
+        const struct {
+            D3D12_DESCRIPTOR_HEAP_DESC desc;
+            Word backing, bytes;
+        } desc{{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 4, flags}, 0, 0};
+        return ok(invoke(device, 14, arg(&desc), arg(&__uuidof(ID3D12DescriptorHeap)), arg(out)));
+    };
+    void *visible_heap = nullptr, *plain_heap = nullptr;
+    if (!make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, &visible_heap) || !make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_NONE, &plain_heap))
+        return 6;
+    const UINT stride = probe.desktop->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+    const Word visible_cpu = invoke(visible_heap, 9), plain_cpu = invoke(plain_heap, 9), gpu_start = invoke(visible_heap, 10);
+    D3D12_UNORDERED_ACCESS_VIEW_DESC uint_view{DXGI_FORMAT_R32_UINT, D3D12_UAV_DIMENSION_TEXTURE2D, {}};
+    D3D12_UNORDERED_ACCESS_VIEW_DESC float_view{DXGI_FORMAT_R32_FLOAT, D3D12_UAV_DIMENSION_TEXTURE2D, {}};
+    ID3D12Resource* views[] = {a.Get(), b.Get(), c.Get()};
+    D3D12_UNORDERED_ACCESS_VIEW_DESC* view_descs[] = {&uint_view, &uint_view, &float_view};
+    for (unsigned i = 0; i < 3; ++i) {
+        invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), visible_cpu + i * stride);
+        invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), plain_cpu + i * stride);
+    }
+
+    D3D12_COMMAND_QUEUE_DESC queue_desc{};
+    const unsigned list_desc[] = {D3D12_COMMAND_LIST_TYPE_DIRECT, 2, 1, 0};
+    void *allocator = nullptr, *list = nullptr;
+    if (!ok(invoke(device, 8, arg(&queue_desc), arg(&__uuidof(ID3D12CommandQueue)), arg(&probe.queue))) ||
+        !ok(invoke(device, 36, 0, 0, arg(&__uuidof(ID3D12Fence)), arg(&probe.fence))) ||
+        !ok(invoke(device, 9, D3D12_COMMAND_LIST_TYPE_DIRECT, arg(&__uuidof(ID3D12CommandAllocator)), arg(&allocator))) ||
+        !ok(invoke(device, 73, arg(list_desc), arg(allocator), 0, arg(&__uuidof(ID3D12GraphicsCommandList)), arg(&list))))
+        return 7;
+    if (!ok(invoke(list, 139, arg(allocator), 0))) return 8;
+    void* heaps[] = {visible_heap};
+    invoke(list, 32, 1, arg(heaps));
+
+    const std::uint32_t uint_a[4] = {0x12345678, 0x12345678, 0x12345678, 0x12345678};
+    const std::uint32_t uint_b1[4] = {0x11111111, 0x11111111, 0x11111111, 0x11111111};
+    const std::uint32_t uint_b2[4] = {0x0badf00d, 0x0badf00d, 0x0badf00d, 0x0badf00d};
+    const float float_c[4] = {1.5f, 1.5f, 1.5f, 1.5f};
+    const D3D12_RECT whole{0, 0, 1, 1};
+
+    unsigned seen = unresolved_now();
+    invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), arg(uint_a), 0, 0);
+    if (!check_count("1 uint clear of A", seen, 0)) return 10;
+    invoke(list, 53, gpu_start + stride, plain_cpu + stride, arg(b.Get()), arg(uint_b1), 1, arg(&whole));
+    if (!check_count("2 uint clear of B with a rect", seen, 0)) return 11;
+    invoke(list, 54, gpu_start + 2 * stride, plain_cpu + 2 * stride, arg(c.Get()), arg(float_c), 0, 0);
+    if (!check_count("3 float clear of C", seen, 0)) return 12;
+    // The GPU handle is far past the four-descriptor heap: no known heap holds it.
+    invoke(list, 53, gpu_start + 64 * stride, plain_cpu + stride, arg(b.Get()), arg(uint_b2), 0, 0);
+    if (!check_count("4 clear of B through a GPU handle on no heap", seen, 1)) return 13;
+    invoke(list, 53, gpu_start + 3 * stride, plain_cpu + 3 * stride, arg(d.Get()), arg(uint_b2), 0, 0);
+    if (!check_count("5 clear through a CPU handle holding no view", seen, 1)) return 14;
+    invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), 0, 0, 0);
+    if (!check_count("6 clear with no values", seen, 1)) return 15;
+
+    const D3D12_DISCARD_REGION region{1, &whole, 0, 1};
+    invoke(list, 55, arg(e.Get()), 0);
+    invoke(list, 55, arg(e.Get()), arg(&region));
+    invoke(list, 55, 0, 0);
+    if (!check_count("7 discards of the render target", seen, 0)) return 16;
+
+    invoke(list, 9);
+    if (!probe.submit(list)) return 17;
+    const std::uint32_t bits_a = probe.texel(a.Get());
+    const std::uint32_t bits_b = probe.texel(b.Get());
+    const std::uint32_t bits_c = probe.texel(c.Get());
+    std::printf("8 A after the uint clear: %08x (expected 12345678)\n", bits_a);
+    std::printf("9 B after the refused clear: %08x (expected 11111111)\n", bits_b);
+    std::printf("10 C after the float clear: %08x (expected 3fc00000)\n", bits_c);
+    if (bits_a != 0x12345678) return 18;
+    if (bits_b != 0x11111111) return 19;
+    if (bits_c != 0x3fc00000) return 20;
+
+    const HRESULT removed = probe.desktop->GetDeviceRemovedReason();
+    const UINT64 errors = probe.debug_errors();

Fixed in 248e2d5d and 99cc35ae. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688829869 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#discussion_r4688829869). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:12:04Z. **Code review location:** `tests/startup_clear_uav.cpp`; line 266 ~~~~diff @@ -0,0 +1,270 @@ +// ClearUnorderedAccessViewUint / ClearUnorderedAccessViewFloat / DiscardResource on a console command list +// (list slots 53, 54 and 55, device slot 19). +// +// startup_clear_uav <warp|hardware> (X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1) +// +// Through D3D12XboxCreateDevice the probe makes 1x1 targets with unordered access and records, on one list: +// +// A R32_UINT ClearUnorderedAccessViewUint(0x12345678) read back: 12345678 +// B R32_UINT cleared 0x11111111, then a clear with a GPU handle on no heap (refused, counted) +// read back: 11111111 +// C R32_FLOAT ClearUnorderedAccessViewFloat(1.5) read back: 3fc00000 +// D R32_UINT a clear through a CPU handle that holds no view (refused, counted) +// E RGBA8 RTV DiscardResource, with and without a region list closes and executes +// +// The shader-visible heap holds the GPU-side descriptors, a second heap holds the CPU-side copies the +// desktop API requires. The desktop device must not be removed and the debug layer must store no errors. +// +// Exit codes: 0 pass, 77 no physical adapter, other values name the failing step. +#include <d3d12.h> +#include <d3d12sdklayers.h> +#include <dxgi1_6.h> +#include <wrl/client.h> + +#include <array> +#include <cstdint> +#include <cstdio> +#include <cstring> +#include <vector> + +using Microsoft::WRL::ComPtr; +extern "C" __declspec(dllimport) HRESULT WINAPI D3D12XboxCreateDevice(IUnknown*, const void*, REFIID, void**); +extern "C" __declspec(dllimport) void x2w_d3d12_render_target_stats(unsigned* binds, unsigned* unresolved); + +namespace { +using Word = std::uint64_t; +template <class T> Word arg(T* value) { return reinterpret_cast<Word>(value); } +Word invoke(void* object, unsigned index, Word a = 0, Word b = 0, Word c = 0, Word d = 0, Word e = 0, Word f = 0, Word g = 0) +{ + using Slot = Word (WINAPI*)(void*, Word, Word, Word, Word, Word, Word, Word); + return reinterpret_cast<Slot>((*static_cast<void***>(object))[index])(object, a, b, c, d, e, f, g); +} +bool ok(Word hr) { return SUCCEEDED(static_cast<HRESULT>(hr)); } + +unsigned unresolved_now() +{ + unsigned binds = 0, unresolved = 0; + x2w_d3d12_render_target_stats(&binds, &unresolved); + return unresolved; +} + +struct Probe { + ComPtr<ID3D12Device> desktop; + ComPtr<ID3D12Resource> readback; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint{}; + void* queue = nullptr; + void* fence = nullptr; + Word fence_value = 0; + + bool submit(void* list) + { + void* lists[] = {list}; + invoke(queue, 10, 1, arg(lists)); + if (!ok(invoke(queue, 14, arg(fence), ++fence_value))) return false; + const auto deadline = GetTickCount64() + 10000; + while (invoke(fence, 8) < fence_value) { + if (GetTickCount64() >= deadline) return false; + Sleep(1); + } + return true; + } + UINT64 debug_errors() + { + ComPtr<ID3D12InfoQueue> info; + if (FAILED(desktop.As(&info))) return 0; + UINT64 errors = 0; + for (UINT64 i = 0, n = info->GetNumStoredMessages(); i < n; ++i) { + SIZE_T bytes = 0; + if (FAILED(info->GetMessage(i, nullptr, &bytes))) continue; + std::vector<char> storage(bytes); + auto* message = reinterpret_cast<D3D12_MESSAGE*>(storage.data()); + if (FAILED(info->GetMessage(i, message, &bytes))) continue; + if (message->Severity <= D3D12_MESSAGE_SEVERITY_ERROR) { + ++errors; + std::printf("debug layer: %.*s\n", static_cast<int>(message->DescriptionByteLength), message->pDescription); + } + } + return errors; + } + // The one texel of a target (4 bytes), copied on a desktop queue. + std::uint32_t texel(ID3D12Resource* target) + { + D3D12_COMMAND_QUEUE_DESC desc{}; + ComPtr<ID3D12CommandQueue> observer; + ComPtr<ID3D12CommandAllocator> allocator; + ComPtr<ID3D12GraphicsCommandList> copy; + ComPtr<ID3D12Fence> done; + if (FAILED(desktop->CreateCommandQueue(&desc, IID_PPV_ARGS(&observer))) || + FAILED(desktop->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator))) || + FAILED(desktop->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.Get(), nullptr, IID_PPV_ARGS(&copy))) || + FAILED(desktop->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&done)))) + return 0; + D3D12_TEXTURE_COPY_LOCATION to{readback.Get(), D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT}; + to.PlacedFootprint = footprint; + D3D12_TEXTURE_COPY_LOCATION from{target, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX}; + copy->CopyTextureRegion(&to, 0, 0, 0, &from, nullptr); + if (FAILED(copy->Close())) return 0; + ID3D12CommandList* lists[] = {copy.Get()}; + observer->ExecuteCommandLists(1, lists); + HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + const bool finished = event && SUCCEEDED(observer->Signal(done.Get(), 1)) && + SUCCEEDED(done->SetEventOnCompletion(1, event)) && WaitForSingleObject(event, 10000) == WAIT_OBJECT_0; + if (event) CloseHandle(event); + void* memory = nullptr; + if (!finished || FAILED(readback->Map(0, nullptr, &memory))) return 0; + std::uint32_t bits = 0; + std::memcpy(&bits, memory, sizeof(bits)); + readback->Unmap(0, nullptr); + return bits; + } +}; + +bool check_count(const char* name, unsigned& before, unsigned expected_added) +{ + const unsigned now = unresolved_now(); + const bool good = now - before == expected_added; + std::printf("%s: refused +%u (expected +%u)\n", name, now - before, expected_added); + before = now; + return good; +} +} // namespace + +int main(int argc, char** argv) +{ + if (argc != 2) return 2; + ComPtr<IDXGIFactory6> factory; + if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 3; + ComPtr<IDXGIAdapter> adapter; + if (std::strcmp(argv[1], "hardware") == 0) { + for (UINT n = 0;; ++n) { + ComPtr<IDXGIAdapter1> candidate; + const HRESULT hr = factory->EnumAdapterByGpuPreference(n, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&candidate)); + if (hr == DXGI_ERROR_NOT_FOUND) return 77; + if (FAILED(hr)) return 3; + DXGI_ADAPTER_DESC1 desc{}; + if (FAILED(candidate->GetDesc1(&desc))) return 3; + if (!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) && + SUCCEEDED(D3D12CreateDevice(candidate.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) { + adapter = candidate; + break; + } + } + } else if (std::strcmp(argv[1], "warp") != 0 || FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)))) { + return 3; + } + DXGI_ADAPTER_DESC adapter_desc{}; + if (FAILED(adapter->GetDesc(&adapter_desc))) return 3; + std::printf("adapter=%ls\n", adapter_desc.Description); + + Probe probe; + std::array<unsigned char, 64> parameters{}; + void* device = nullptr; + if (FAILED(D3D12XboxCreateDevice(adapter.Get(), parameters.data(), __uuidof(ID3D12Device), &device))) return 4; + if (FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&probe.desktop)))) return 4; + + // Five 1x1 targets: four with unordered access (A, B, C, D) and one render target (E). + D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT}; + const auto texture = [](DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags) { + return D3D12_RESOURCE_DESC{D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 1, 1, 1, 1, format, {1, 0}, + D3D12_TEXTURE_LAYOUT_UNKNOWN, flags}; + }; + const D3D12_RESOURCE_DESC uint_desc = texture(DXGI_FORMAT_R32_UINT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); + const D3D12_RESOURCE_DESC float_desc = texture(DXGI_FORMAT_R32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); + const D3D12_RESOURCE_DESC rt_desc = texture(DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET); + const D3D12_CLEAR_VALUE rt_clear{DXGI_FORMAT_R8G8B8A8_UNORM, {0, 0, 0, 0}}; + ComPtr<ID3D12Resource> a, b, c, d, e; + const auto make = [&](const D3D12_RESOURCE_DESC& desc, ComPtr<ID3D12Resource>& out, const D3D12_CLEAR_VALUE* clear) { + return SUCCEEDED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, + clear, IID_PPV_ARGS(&out))); + }; + if (!make(uint_desc, a, nullptr) || !make(uint_desc, b, nullptr) || !make(float_desc, c, nullptr) || + !make(uint_desc, d, nullptr) || !make(rt_desc, e, &rt_clear)) + return 5; + UINT64 bytes = 0; + probe.desktop->GetCopyableFootprints(&uint_desc, 0, 1, 0, &probe.footprint, nullptr, nullptr, &bytes); + heap.Type = D3D12_HEAP_TYPE_READBACK; + const D3D12_RESOURCE_DESC buffer{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0}, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR}; + if (FAILED(probe.desktop->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, IID_PPV_ARGS(&probe.readback)))) return 5; + + // Heaps: the shader-visible one is read by GPU handle, the plain one by CPU handle. Index 3 of the plain + // heap is left empty. Both hold a UAV for A, B and C at the same indexes. + const auto make_heap = [&](D3D12_DESCRIPTOR_HEAP_FLAGS flags, void** out) { + const struct { + D3D12_DESCRIPTOR_HEAP_DESC desc; + Word backing, bytes; + } desc{{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 4, flags}, 0, 0}; + return ok(invoke(device, 14, arg(&desc), arg(&__uuidof(ID3D12DescriptorHeap)), arg(out))); + }; + void *visible_heap = nullptr, *plain_heap = nullptr; + if (!make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, &visible_heap) || !make_heap(D3D12_DESCRIPTOR_HEAP_FLAG_NONE, &plain_heap)) + return 6; + const UINT stride = probe.desktop->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + const Word visible_cpu = invoke(visible_heap, 9), plain_cpu = invoke(plain_heap, 9), gpu_start = invoke(visible_heap, 10); + D3D12_UNORDERED_ACCESS_VIEW_DESC uint_view{DXGI_FORMAT_R32_UINT, D3D12_UAV_DIMENSION_TEXTURE2D, {}}; + D3D12_UNORDERED_ACCESS_VIEW_DESC float_view{DXGI_FORMAT_R32_FLOAT, D3D12_UAV_DIMENSION_TEXTURE2D, {}}; + ID3D12Resource* views[] = {a.Get(), b.Get(), c.Get()}; + D3D12_UNORDERED_ACCESS_VIEW_DESC* view_descs[] = {&uint_view, &uint_view, &float_view}; + for (unsigned i = 0; i < 3; ++i) { + invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), visible_cpu + i * stride); + invoke(device, 19, arg(views[i]), 0, arg(view_descs[i]), plain_cpu + i * stride); + } + + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + const unsigned list_desc[] = {D3D12_COMMAND_LIST_TYPE_DIRECT, 2, 1, 0}; + void *allocator = nullptr, *list = nullptr; + if (!ok(invoke(device, 8, arg(&queue_desc), arg(&__uuidof(ID3D12CommandQueue)), arg(&probe.queue))) || + !ok(invoke(device, 36, 0, 0, arg(&__uuidof(ID3D12Fence)), arg(&probe.fence))) || + !ok(invoke(device, 9, D3D12_COMMAND_LIST_TYPE_DIRECT, arg(&__uuidof(ID3D12CommandAllocator)), arg(&allocator))) || + !ok(invoke(device, 73, arg(list_desc), arg(allocator), 0, arg(&__uuidof(ID3D12GraphicsCommandList)), arg(&list)))) + return 7; + if (!ok(invoke(list, 139, arg(allocator), 0))) return 8; + void* heaps[] = {visible_heap}; + invoke(list, 32, 1, arg(heaps)); + + const std::uint32_t uint_a[4] = {0x12345678, 0x12345678, 0x12345678, 0x12345678}; + const std::uint32_t uint_b1[4] = {0x11111111, 0x11111111, 0x11111111, 0x11111111}; + const std::uint32_t uint_b2[4] = {0x0badf00d, 0x0badf00d, 0x0badf00d, 0x0badf00d}; + const float float_c[4] = {1.5f, 1.5f, 1.5f, 1.5f}; + const D3D12_RECT whole{0, 0, 1, 1}; + + unsigned seen = unresolved_now(); + invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), arg(uint_a), 0, 0); + if (!check_count("1 uint clear of A", seen, 0)) return 10; + invoke(list, 53, gpu_start + stride, plain_cpu + stride, arg(b.Get()), arg(uint_b1), 1, arg(&whole)); + if (!check_count("2 uint clear of B with a rect", seen, 0)) return 11; + invoke(list, 54, gpu_start + 2 * stride, plain_cpu + 2 * stride, arg(c.Get()), arg(float_c), 0, 0); + if (!check_count("3 float clear of C", seen, 0)) return 12; + // The GPU handle is far past the four-descriptor heap: no known heap holds it. + invoke(list, 53, gpu_start + 64 * stride, plain_cpu + stride, arg(b.Get()), arg(uint_b2), 0, 0); + if (!check_count("4 clear of B through a GPU handle on no heap", seen, 1)) return 13; + invoke(list, 53, gpu_start + 3 * stride, plain_cpu + 3 * stride, arg(d.Get()), arg(uint_b2), 0, 0); + if (!check_count("5 clear through a CPU handle holding no view", seen, 1)) return 14; + invoke(list, 53, gpu_start, plain_cpu, arg(a.Get()), 0, 0, 0); + if (!check_count("6 clear with no values", seen, 1)) return 15; + + const D3D12_DISCARD_REGION region{1, &whole, 0, 1}; + invoke(list, 55, arg(e.Get()), 0); + invoke(list, 55, arg(e.Get()), arg(&region)); + invoke(list, 55, 0, 0); + if (!check_count("7 discards of the render target", seen, 0)) return 16; + + invoke(list, 9); + if (!probe.submit(list)) return 17; + const std::uint32_t bits_a = probe.texel(a.Get()); + const std::uint32_t bits_b = probe.texel(b.Get()); + const std::uint32_t bits_c = probe.texel(c.Get()); + std::printf("8 A after the uint clear: %08x (expected 12345678)\n", bits_a); + std::printf("9 B after the refused clear: %08x (expected 11111111)\n", bits_b); + std::printf("10 C after the float clear: %08x (expected 3fc00000)\n", bits_c); + if (bits_a != 0x12345678) return 18; + if (bits_b != 0x11111111) return 19; + if (bits_c != 0x3fc00000) return 20; + + const HRESULT removed = probe.desktop->GetDeviceRemovedReason(); + const UINT64 errors = probe.debug_errors(); ~~~~ --- Fixed in 248e2d5d and 99cc35ae. 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.
Makto94 commented 2026-11-25 11:02:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T10:27:30Z.


Head 3792cc25: startup_clear_uav_warp and startup_clear_uav_hardware both pass, and both end with device removed reason: 0x00000000, debug layer errors: 0.

.\tools\dev.ps1; ctest --preset dev --no-tests=error -j1 -R '^startup_clear_uav_warp$' -V
.\tools\dev.ps1; ctest --preset dev --no-tests=error -j1 -R '^startup_clear_uav_hardware$' -V

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:

  • The three x2w-d3d12-debug ... sev=1 id=1314 lines (GPU descriptor handle not from the bound heap) no longer appear in either log (0 matches).
  • The log now has three refused clears: x2w-d3d12 ClearUnorderedAccessViewUint skipped: GPU handle is on no known descriptor heap, ... skipped: view holds no known resource and ... skipped: no clear values. Checks 4 to 6 of the test read refused +1 (expected +1).
  • The test counts errors with a message callback now (RegisterMessageCallback). The log has no no debug layer message callback line, 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7159721945 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7159721945). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-25T10:27:30Z. --- Head `3792cc25`: `startup_clear_uav_warp` and `startup_clear_uav_hardware` both pass, and both end with `device removed reason: 0x00000000, debug layer errors: 0`. ```powershell .\tools\dev.ps1; ctest --preset dev --no-tests=error -j1 -R '^startup_clear_uav_warp$' -V .\tools\dev.ps1; ctest --preset dev --no-tests=error -j1 -R '^startup_clear_uav_hardware$' -V ``` 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`: - The three `x2w-d3d12-debug ... sev=1 id=1314` lines (GPU descriptor handle not from the bound heap) no longer appear in either log (0 matches). - The log now has three refused clears: `x2w-d3d12 ClearUnorderedAccessViewUint skipped: GPU handle is on no known descriptor heap`, `... skipped: view holds no known resource` and `... skipped: no clear values`. Checks 4 to 6 of the test read `refused +1 (expected +1)`. - The test counts errors with a message callback now (`RegisterMessageCallback`). The log has no `no debug layer message callback` line, 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.
tedin7 commented 2026-11-25 11:02:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:52:42Z.


Thank you @Makto94 for the re-run at 3792cc25 on WARP and hardware, and for noting that the callback is not yet proven by a negative control.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160293075 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7160293075). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T10:52:42Z. --- Thank you @Makto94 for the re-run at 3792cc25 on WARP and hardware, and for noting that the callback is not yet proven by a negative control. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 12:01:52 +00:00 (Migrated from github.com)

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):

  • Dev preset: build OK, ctest -R '^(...startup_clear_uav_warp...)$' (23 direct downstream tests): 23/23 passed.
  • Release /O2 preset: build OK (106.64s), same 23 tests: 23/23 passed (startup_clear_uav_warp 0.14s).
  • Hardware variants are not runnable on the VM (WARP only); the hardware run is the one posted by @Makto94 above.
  • GitHub CI on this head: Windows build and test, Linux Python checks and gfx1013 fixtures all pass. Mergeable, clean against main.
  • Diff, title, body and commit messages checked: no attribution trailers, no tool or model names.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160683265 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7160683265). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:10:05Z. --- Stage-2 verification at `3792cc25` (Win2025, WARP, default 3-slot pool): - Dev preset: build OK, `ctest -R '^(...startup_clear_uav_warp...)$'` (23 direct downstream tests): **23/23 passed**. - Release `/O2` preset: build OK (`106.64s`), same 23 tests: **23/23 passed** (`startup_clear_uav_warp` `0.14s`). - Hardware variants are not runnable on the VM (WARP only); the hardware run is the one posted by @Makto94 above. - GitHub CI on this head: Windows build and test, Linux Python checks and gfx1013 fixtures all pass. Mergeable, clean against `main`. - Diff, title, body and commit messages checked: no attribution trailers, no tool or model names. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 15:01:29 +00:00
tedin7 commented 2026-11-25 15:01:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T14:32:39Z.


Win2025 WARP receipt for head 1c4a9ac6 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 1c4a9ac63d705af36a0af7d7b9f2d08780f92f0f:

  • Debug (--preset dev):
    • Build (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 (configure 2.00s)
    • Test (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_warp 3.22s, cpu_shim_shadow_warp 4.20s, cpu_shim_chain_warp 2.25s, cpu_shim_draw_warp 2.72s, cpu_shim_compute_warp 2.09s, cpu_native_shim_startup 1.28s, cpu_shim_texture_reuse_warp 1.26s, startup_stubs 0.72s, startup_sampler_heap_wrapped_warp 0.14s, d3d12x_descriptor_heap_warp 0.04s, startup_build_rev_dll 0.11s, startup_clear_uav_warp 0.06s, xgameruntime_preflight_stub_refused 0.28s, d3d12x_descriptor_table_warp 0.05s, d3d12x_compute_list_warp 0.05s, d3d12x_graphics_list_warp 0.06s, d3d12x_device_create_warp 0.04s, d3d12x_descriptor_negative_warp 0.05s, d3d12x_pso_reject_warp 0.04s, d3d12x_pso_static_sampler_warp 0.04s, d3d12x_device_struct_return_neither_control_warp 0.05s, d3d12x_device_struct_return_warp 0.04s, d3d12x_device_negative_warp 0.03s)
  • Release /O2 (--preset release):
    • Build (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 (configure 1.97s)
    • Test (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_warp 3.04s, cpu_shim_shadow_warp 3.99s, cpu_shim_chain_warp 2.20s, cpu_shim_draw_warp 3.08s, cpu_shim_compute_warp 1.93s, cpu_native_shim_startup 1.31s, cpu_shim_texture_reuse_warp 1.21s, startup_sampler_heap_wrapped_warp 0.14s, xgameruntime_preflight_stub_refused 0.23s, startup_build_rev_dll 0.08s, d3d12x_compute_list_warp 0.05s, d3d12x_graphics_list_warp 0.05s, startup_clear_uav_warp 0.06s, d3d12x_descriptor_table_warp 0.04s, startup_stubs 0.68s, d3d12x_descriptor_heap_warp 0.04s, d3d12x_descriptor_negative_warp 0.05s, d3d12x_device_struct_return_neither_control_warp 0.04s, d3d12x_device_create_warp 0.04s, d3d12x_pso_static_sampler_warp 0.04s, d3d12x_device_struct_return_warp 0.04s, d3d12x_pso_reject_warp 0.04s, d3d12x_device_negative_warp 0.02s)
  • sccache: 4/14 hits; wall 121.4s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7165439422 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1972#issuecomment-7165439422). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T14:32:39Z. --- Win2025 WARP receipt for head 1c4a9ac6 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `1c4a9ac63d705af36a0af7d7b9f2d08780f92f0f`: - **Debug (`--preset dev`)**: - Build (`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` (configure `2.00s`) - Test (`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_warp` `3.22s`, `cpu_shim_shadow_warp` `4.20s`, `cpu_shim_chain_warp` `2.25s`, `cpu_shim_draw_warp` `2.72s`, `cpu_shim_compute_warp` `2.09s`, `cpu_native_shim_startup` `1.28s`, `cpu_shim_texture_reuse_warp` `1.26s`, `startup_stubs` `0.72s`, `startup_sampler_heap_wrapped_warp` `0.14s`, `d3d12x_descriptor_heap_warp` `0.04s`, `startup_build_rev_dll` `0.11s`, `startup_clear_uav_warp` `0.06s`, `xgameruntime_preflight_stub_refused` `0.28s`, `d3d12x_descriptor_table_warp` `0.05s`, `d3d12x_compute_list_warp` `0.05s`, `d3d12x_graphics_list_warp` `0.06s`, `d3d12x_device_create_warp` `0.04s`, `d3d12x_descriptor_negative_warp` `0.05s`, `d3d12x_pso_reject_warp` `0.04s`, `d3d12x_pso_static_sampler_warp` `0.04s`, `d3d12x_device_struct_return_neither_control_warp` `0.05s`, `d3d12x_device_struct_return_warp` `0.04s`, `d3d12x_device_negative_warp` `0.03s`) - **Release `/O2` (`--preset release`)**: - Build (`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` (configure `1.97s`) - Test (`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_warp` `3.04s`, `cpu_shim_shadow_warp` `3.99s`, `cpu_shim_chain_warp` `2.20s`, `cpu_shim_draw_warp` `3.08s`, `cpu_shim_compute_warp` `1.93s`, `cpu_native_shim_startup` `1.31s`, `cpu_shim_texture_reuse_warp` `1.21s`, `startup_sampler_heap_wrapped_warp` `0.14s`, `xgameruntime_preflight_stub_refused` `0.23s`, `startup_build_rev_dll` `0.08s`, `d3d12x_compute_list_warp` `0.05s`, `d3d12x_graphics_list_warp` `0.05s`, `startup_clear_uav_warp` `0.06s`, `d3d12x_descriptor_table_warp` `0.04s`, `startup_stubs` `0.68s`, `d3d12x_descriptor_heap_warp` `0.04s`, `d3d12x_descriptor_negative_warp` `0.05s`, `d3d12x_device_struct_return_neither_control_warp` `0.04s`, `d3d12x_device_create_warp` `0.04s`, `d3d12x_pso_static_sampler_warp` `0.04s`, `d3d12x_device_struct_return_warp` `0.04s`, `d3d12x_pso_reject_warp` `0.04s`, `d3d12x_device_negative_warp` `0.02s`) - `sccache`: 4/14 hits; wall `121.4s` AI-assisted; commands listed were executed locally.
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!1965
No description provided.