startup: convert GPU-written rectangle-list indirect Draw arguments (Part of #1999) #2165

Merged
tedin7 merged 18 commits from upstream-pr/2173 into main 2026-11-25 13:14:36 +00:00
tedin7 commented 2026-11-25 02:50:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:50:59Z.


Part of #1999

What this unblocks: GPU-written indirect Draw records recorded under the console-only rectangle-list topology (0x11) now reach the desktop as a triangle-list draw (item E, non-indexed).

Changes:

  • ExecuteIndirect with topology 0x11 runs a one-thread compute pass that writes count / 3 * 6 (other words unchanged) into a scratch record; the desktop draw reads that record. The title's argument buffer is not modified. A count that would overflow 32 bits draws nothing.
  • Indexed rectangle-list draws stay refused (same as the direct draw). Other console-only topologies are out of scope.
  • The compute pass replaces the list's compute root signature (the title's last one is re-set, without its arguments); documented in docs/experiments.md.
  • Python model convert_indirect_draw_arguments with controls in tests/rectlist_topology_check.py.
  • New rect mode in startup_indirect_draw_indexed (ctest startup_indirect_rectlist_{warp,hardware}): compute-written 1 and 2 rectangles, D3D12 pixel readback against the expected halves, argument words checked unchanged, plus omitted-producer, short-argument, missing-viewport and overflowing-count cases.

Verification:

  • Linux: python3 -B tests/rectlist_topology_check.py (18 tests OK), python3 -B tests/docs_links_check.py (OK).
  • Win2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP, default 3-slot pool) at 4c70d27e, via python3 x2w_pipe.py win2025 2173 --force:
    • Dev: cmake --build --preset dev --target <25 targets> -- -j 3 OK (compilation failures 0); ctest --preset dev -R '^(cpu_native_shim_startup|cpu_shim_*_warp|d3d12x_*_warp|rectlist_draw_warp|rectlist_topology|startup_indirect_{counts_control,draw,draw_indexed,mesh,rectlist}_warp|startup_sampler_heap_wrapped_warp|startup_stubs|xgameruntime_preflight_stub_refused)$' --parallel 2 --no-tests=error --output-on-failure: 28/28 passed, 0 skipped.
    • Release: cmake --build --preset release --target <same 25 targets> -- -j 3 OK; same ctest --preset release -R ...: 28/28 passed, 0 skipped.
  • Hardware variants (*_hardware) not run: the Windows node only has WARP.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6596079342 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:50:59Z. --- Part of #1999 What this unblocks: GPU-written indirect `Draw` records recorded under the console-only rectangle-list topology (0x11) now reach the desktop as a triangle-list draw (item E, non-indexed). Changes: - `ExecuteIndirect` with topology 0x11 runs a one-thread compute pass that writes `count / 3 * 6` (other words unchanged) into a scratch record; the desktop draw reads that record. The title's argument buffer is not modified. A count that would overflow 32 bits draws nothing. - Indexed rectangle-list draws stay refused (same as the direct draw). Other console-only topologies are out of scope. - The compute pass replaces the list's compute root signature (the title's last one is re-set, without its arguments); documented in `docs/experiments.md`. - Python model `convert_indirect_draw_arguments` with controls in `tests/rectlist_topology_check.py`. - New `rect` mode in `startup_indirect_draw_indexed` (ctest `startup_indirect_rectlist_{warp,hardware}`): compute-written 1 and 2 rectangles, D3D12 pixel readback against the expected halves, argument words checked unchanged, plus omitted-producer, short-argument, missing-viewport and overflowing-count cases. Verification: - Linux: `python3 -B tests/rectlist_topology_check.py` (18 tests OK), `python3 -B tests/docs_links_check.py` (OK). - Win2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP, default 3-slot pool) at 4c70d27e, via `python3 x2w_pipe.py win2025 2173 --force`: - Dev: `cmake --build --preset dev --target <25 targets> -- -j 3` OK (compilation failures 0); `ctest --preset dev -R '^(cpu_native_shim_startup|cpu_shim_*_warp|d3d12x_*_warp|rectlist_draw_warp|rectlist_topology|startup_indirect_{counts_control,draw,draw_indexed,mesh,rectlist}_warp|startup_sampler_heap_wrapped_warp|startup_stubs|xgameruntime_preflight_stub_refused)$' --parallel 2 --no-tests=error --output-on-failure`: 28/28 passed, 0 skipped. - Release: `cmake --build --preset release --target <same 25 targets> -- -j 3` OK; same `ctest --preset release -R ...`: 28/28 passed, 0 skipped. - Hardware variants (`*_hardware`) not run: the Windows node only has WARP. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 05:04:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T04:19:17Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c70d27ed8

ℹ️ 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:6051801169 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#pullrequestreview-6051801169). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T04:19:17Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `4c70d27ed8` <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>
tedin7 commented 2026-11-25 05:04:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:40:03Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051946271 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#pullrequestreview-6051946271). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:40:03Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 05:04:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:40:05Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051946485 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#pullrequestreview-6051946485). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:40:05Z. **Review:** COMMENTED --- _No description provided._
chatgpt-codex-connector[bot commented 2026-11-25 05:04:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T04:13:09Z.


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-25T04:19:19.921229Z 4c70d27 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:7152640461 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7152640461). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T04:13:09Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"4c70d27ed846de4b097b821793a96087e3b220e0","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-25T04:19:19.921229Z">2026-11-25T04:19:19.921229Z</relative-time> | `4c70d27` | 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-25 05:04:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T04:19:17Z.

Code review location: src/startup_stubs/rect_indirect_args.h; line 34

@@ -0,0 +1,136 @@
+// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11).
+//
+// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is
+// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices),
+// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A
+// one-thread compute pass reads the title's four argument words and writes the converted four words into a
+// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is.
+//
+// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count
+// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping.
+// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments.
+#pragma once
+
+#include <d3d12.h>
+#include <d3dcompiler.h>
+#include <wrl/client.h>
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+namespace x2w_startup {
+
+inline constexpr char rect_indirect_args_hlsl[] = R"(
+ByteAddressBuffer source : register(t0);
+RWByteAddressBuffer converted : register(u0);
+
+[numthreads(1, 1, 1)]
+void convert() {
+    uint4 args = source.Load4(0);
+    uint rectangles = args.x / 3;
+    // 0x2AAAAAAA * 6 is the largest product below 2^32.
+    uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6;
+    converted.Store4(0, uint4(vertices, args.y, args.z, args.w));

P2 Badge Translate the start vertex into the expanded vertex domain

For a rectangle-list record with a nonzero start, such as (3, 1, 3, 0) selecting the second three-vertex rectangle, this expands the count but leaves StartVertexLocation in the original vertex domain. The new vertex_rect fixture shader computes the rectangle as SV_VertexID / 6, so the resulting desktop vertices 3 through 8 produce one triangle from each of two rectangles instead of both triangles of the second rectangle. Translate the start consistently with the expansion, including overflow handling, or reject unsupported nonzero starts.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4690338277 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#discussion_r4690338277). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T04:19:17Z. **Code review location:** `src/startup_stubs/rect_indirect_args.h`; line 34 ~~~~diff @@ -0,0 +1,136 @@ +// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11). +// +// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is +// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices), +// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A +// one-thread compute pass reads the title's four argument words and writes the converted four words into a +// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is. +// +// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count +// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping. +// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments. +#pragma once + +#include <d3d12.h> +#include <d3dcompiler.h> +#include <wrl/client.h> + +#include <memory> +#include <mutex> +#include <vector> + +namespace x2w_startup { + +inline constexpr char rect_indirect_args_hlsl[] = R"( +ByteAddressBuffer source : register(t0); +RWByteAddressBuffer converted : register(u0); + +[numthreads(1, 1, 1)] +void convert() { + uint4 args = source.Load4(0); + uint rectangles = args.x / 3; + // 0x2AAAAAAA * 6 is the largest product below 2^32. + uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6; + converted.Store4(0, uint4(vertices, args.y, args.z, args.w)); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Translate the start vertex into the expanded vertex domain** For a rectangle-list record with a nonzero start, such as `(3, 1, 3, 0)` selecting the second three-vertex rectangle, this expands the count but leaves `StartVertexLocation` in the original vertex domain. The new `vertex_rect` fixture shader computes the rectangle as `SV_VertexID / 6`, so the resulting desktop vertices 3 through 8 produce one triangle from each of two rectangles instead of both triangles of the second rectangle. Translate the start consistently with the expansion, including overflow handling, or reject unsupported nonzero starts. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 05:04:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T04:19:17Z.

Code review location: src/startup_stubs/rect_indirect_args.h; line 86

@@ -0,0 +1,136 @@
+// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11).
+//
+// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is
+// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices),
+// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A
+// one-thread compute pass reads the title's four argument words and writes the converted four words into a
+// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is.
+//
+// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count
+// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping.
+// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments.
+#pragma once
+
+#include <d3d12.h>
+#include <d3dcompiler.h>
+#include <wrl/client.h>
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+namespace x2w_startup {
+
+inline constexpr char rect_indirect_args_hlsl[] = R"(
+ByteAddressBuffer source : register(t0);
+RWByteAddressBuffer converted : register(u0);
+
+[numthreads(1, 1, 1)]
+void convert() {
+    uint4 args = source.Load4(0);
+    uint rectangles = args.x / 3;
+    // 0x2AAAAAAA * 6 is the largest product below 2^32.
+    uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6;
+    converted.Store4(0, uint4(vertices, args.y, args.z, args.w));
+}
+)";
+
+class RectIndirectArguments {
+public:
+    // Records the conversion of the four draw words at `source_address` and returns the scratch resource now
+    // in INDIRECT_ARGUMENT state, or nullptr if the pass could not be set up (nothing was recorded then).
+    // The scratch buffer rests in COMMON between draws; `finish` puts it back there.
+    ID3D12Resource* convert(ID3D12GraphicsCommandList* list, D3D12_GPU_VIRTUAL_ADDRESS source_address)
+    {
+        Microsoft::WRL::ComPtr<ID3D12Device> device;
+        if (!list || !source_address || FAILED(list->GetDevice(IID_PPV_ARGS(&device)))) return nullptr;
+        Entry* entry = entry_for(device.Get());
+        if (!entry) return nullptr;
+        transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+        list->SetComputeRootSignature(entry->root.Get());
+        list->SetPipelineState(entry->pipeline.Get());
+        list->SetComputeRootShaderResourceView(0, source_address);
+        list->SetComputeRootUnorderedAccessView(1, entry->scratch->GetGPUVirtualAddress());
+        list->Dispatch(1, 1, 1);
+        transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT);
+        return entry->scratch.Get();
+    }
+    static void finish(ID3D12GraphicsCommandList* list, ID3D12Resource* scratch)
+    {
+        transition(list, scratch, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, D3D12_RESOURCE_STATE_COMMON);
+    }
+
+private:
+    struct Entry {
+        ID3D12Device* device = nullptr;
+        Microsoft::WRL::ComPtr<ID3D12RootSignature> root;
+        Microsoft::WRL::ComPtr<ID3D12PipelineState> pipeline;
+        Microsoft::WRL::ComPtr<ID3D12Resource> scratch;
+    };
+    static void transition(ID3D12GraphicsCommandList* list, ID3D12Resource* resource, D3D12_RESOURCE_STATES before,
+                           D3D12_RESOURCE_STATES after)
+    {
+        D3D12_RESOURCE_BARRIER barrier{};
+        barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+        barrier.Transition.pResource = resource;
+        barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
+        barrier.Transition.StateBefore = before;
+        barrier.Transition.StateAfter = after;
+        list->ResourceBarrier(1, &barrier);
+    }
+    // Entries are never freed: a conversion may still be queued when its list is released.
+    Entry* entry_for(ID3D12Device* device)
+    {
+        std::lock_guard<std::mutex> guard(lock_);
+        for (auto& known : entries_)
+            if (known->device == device) return known->scratch ? known.get() : nullptr;

P2 Badge Isolate scratch arguments across concurrent queues

When two direct queues on the same device execute rectangle-list draws concurrently, this cache gives both recordings the same scratch buffer. queue_execute submits asynchronously, and neither its submission bookkeeping nor the transitions in convert and finish establish a cross-queue dependency. One queue can therefore overwrite the converted argument words while the other queue is consuming them, causing incorrect draw counts or resource-state hazards even when the application's original buffers are independent. Allocate scratch storage per in-flight use or synchronize its reuse across queues.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4690338278 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#discussion_r4690338278). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T04:19:17Z. **Code review location:** `src/startup_stubs/rect_indirect_args.h`; line 86 ~~~~diff @@ -0,0 +1,136 @@ +// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11). +// +// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is +// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices), +// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A +// one-thread compute pass reads the title's four argument words and writes the converted four words into a +// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is. +// +// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count +// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping. +// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments. +#pragma once + +#include <d3d12.h> +#include <d3dcompiler.h> +#include <wrl/client.h> + +#include <memory> +#include <mutex> +#include <vector> + +namespace x2w_startup { + +inline constexpr char rect_indirect_args_hlsl[] = R"( +ByteAddressBuffer source : register(t0); +RWByteAddressBuffer converted : register(u0); + +[numthreads(1, 1, 1)] +void convert() { + uint4 args = source.Load4(0); + uint rectangles = args.x / 3; + // 0x2AAAAAAA * 6 is the largest product below 2^32. + uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6; + converted.Store4(0, uint4(vertices, args.y, args.z, args.w)); +} +)"; + +class RectIndirectArguments { +public: + // Records the conversion of the four draw words at `source_address` and returns the scratch resource now + // in INDIRECT_ARGUMENT state, or nullptr if the pass could not be set up (nothing was recorded then). + // The scratch buffer rests in COMMON between draws; `finish` puts it back there. + ID3D12Resource* convert(ID3D12GraphicsCommandList* list, D3D12_GPU_VIRTUAL_ADDRESS source_address) + { + Microsoft::WRL::ComPtr<ID3D12Device> device; + if (!list || !source_address || FAILED(list->GetDevice(IID_PPV_ARGS(&device)))) return nullptr; + Entry* entry = entry_for(device.Get()); + if (!entry) return nullptr; + transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + list->SetComputeRootSignature(entry->root.Get()); + list->SetPipelineState(entry->pipeline.Get()); + list->SetComputeRootShaderResourceView(0, source_address); + list->SetComputeRootUnorderedAccessView(1, entry->scratch->GetGPUVirtualAddress()); + list->Dispatch(1, 1, 1); + transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT); + return entry->scratch.Get(); + } + static void finish(ID3D12GraphicsCommandList* list, ID3D12Resource* scratch) + { + transition(list, scratch, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, D3D12_RESOURCE_STATE_COMMON); + } + +private: + struct Entry { + ID3D12Device* device = nullptr; + Microsoft::WRL::ComPtr<ID3D12RootSignature> root; + Microsoft::WRL::ComPtr<ID3D12PipelineState> pipeline; + Microsoft::WRL::ComPtr<ID3D12Resource> scratch; + }; + static void transition(ID3D12GraphicsCommandList* list, ID3D12Resource* resource, D3D12_RESOURCE_STATES before, + D3D12_RESOURCE_STATES after) + { + D3D12_RESOURCE_BARRIER barrier{}; + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Transition.pResource = resource; + barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + barrier.Transition.StateBefore = before; + barrier.Transition.StateAfter = after; + list->ResourceBarrier(1, &barrier); + } + // Entries are never freed: a conversion may still be queued when its list is released. + Entry* entry_for(ID3D12Device* device) + { + std::lock_guard<std::mutex> guard(lock_); + for (auto& known : entries_) + if (known->device == device) return known->scratch ? known.get() : nullptr; ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Isolate scratch arguments across concurrent queues** When two direct queues on the same device execute rectangle-list draws concurrently, this cache gives both recordings the same scratch buffer. `queue_execute` submits asynchronously, and neither its submission bookkeeping nor the transitions in `convert` and `finish` establish a cross-queue dependency. One queue can therefore overwrite the converted argument words while the other queue is consuming them, causing incorrect draw counts or resource-state hazards even when the application's original buffers are independent. Allocate scratch storage per in-flight use or synchronize its reuse across queues. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-25 05:04:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:40:03Z.

Code review location: src/startup_stubs/rect_indirect_args.h; line 34

@@ -0,0 +1,136 @@
+// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11).
+//
+// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is
+// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices),
+// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A
+// one-thread compute pass reads the title's four argument words and writes the converted four words into a
+// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is.
+//
+// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count
+// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping.
+// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments.
+#pragma once
+
+#include <d3d12.h>
+#include <d3dcompiler.h>
+#include <wrl/client.h>
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+namespace x2w_startup {
+
+inline constexpr char rect_indirect_args_hlsl[] = R"(
+ByteAddressBuffer source : register(t0);
+RWByteAddressBuffer converted : register(u0);
+
+[numthreads(1, 1, 1)]
+void convert() {
+    uint4 args = source.Load4(0);
+    uint rectangles = args.x / 3;
+    // 0x2AAAAAAA * 6 is the largest product below 2^32.
+    uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6;
+    converted.Store4(0, uint4(vertices, args.y, args.z, args.w));

Fixed in d1837dde. A desktop draw's StartVertexLocation never reaches SV_VertexID (the fixture on WARP showed the record (3, 1, 3, 0) still drew the first rectangle), and an indirect draw has no root constant to pass the start to the shader as the direct draw does. A nonzero start vertex cannot be honoured, so the conversion pass now writes 0 vertices for it (nothing is drawn) instead of forwarding a start that names the wrong rectangle. Model, header comment and docs updated.

Regression: tests/rectlist_topology_check.py (test_nonzero_start_vertex_draws_nothing) and the startup_indirect_rectlist fixture case "nonzero start vertex" (record (3, 1, 3, 0), target stays clear, argument words intact). Executed locally: python3 -B tests/rectlist_topology_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py, tests/run_checks_parallel_check.py all OK. Win2025 3-slot x2w_pipe.py win2025 2173 --force: dev 28/28 and release 28/28 passed, 0 skips.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4690466307 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#discussion_r4690466307). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:40:03Z. **Code review location:** `src/startup_stubs/rect_indirect_args.h`; line 34 ~~~~diff @@ -0,0 +1,136 @@ +// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11). +// +// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is +// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices), +// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A +// one-thread compute pass reads the title's four argument words and writes the converted four words into a +// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is. +// +// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count +// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping. +// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments. +#pragma once + +#include <d3d12.h> +#include <d3dcompiler.h> +#include <wrl/client.h> + +#include <memory> +#include <mutex> +#include <vector> + +namespace x2w_startup { + +inline constexpr char rect_indirect_args_hlsl[] = R"( +ByteAddressBuffer source : register(t0); +RWByteAddressBuffer converted : register(u0); + +[numthreads(1, 1, 1)] +void convert() { + uint4 args = source.Load4(0); + uint rectangles = args.x / 3; + // 0x2AAAAAAA * 6 is the largest product below 2^32. + uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6; + converted.Store4(0, uint4(vertices, args.y, args.z, args.w)); ~~~~ --- Fixed in d1837dde. A desktop draw's StartVertexLocation never reaches SV_VertexID (the fixture on WARP showed the record `(3, 1, 3, 0)` still drew the first rectangle), and an indirect draw has no root constant to pass the start to the shader as the direct draw does. A nonzero start vertex cannot be honoured, so the conversion pass now writes 0 vertices for it (nothing is drawn) instead of forwarding a start that names the wrong rectangle. Model, header comment and docs updated. Regression: `tests/rectlist_topology_check.py` (`test_nonzero_start_vertex_draws_nothing`) and the `startup_indirect_rectlist` fixture case "nonzero start vertex" (record `(3, 1, 3, 0)`, target stays clear, argument words intact). Executed locally: `python3 -B tests/rectlist_topology_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/run_checks_parallel_check.py` all OK. Win2025 3-slot `x2w_pipe.py win2025 2173 --force`: dev 28/28 and release 28/28 passed, 0 skips. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 05:04:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:40:05Z.

Code review location: src/startup_stubs/rect_indirect_args.h; line 86

@@ -0,0 +1,136 @@
+// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11).
+//
+// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is
+// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices),
+// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A
+// one-thread compute pass reads the title's four argument words and writes the converted four words into a
+// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is.
+//
+// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count
+// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping.
+// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments.
+#pragma once
+
+#include <d3d12.h>
+#include <d3dcompiler.h>
+#include <wrl/client.h>
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+namespace x2w_startup {
+
+inline constexpr char rect_indirect_args_hlsl[] = R"(
+ByteAddressBuffer source : register(t0);
+RWByteAddressBuffer converted : register(u0);
+
+[numthreads(1, 1, 1)]
+void convert() {
+    uint4 args = source.Load4(0);
+    uint rectangles = args.x / 3;
+    // 0x2AAAAAAA * 6 is the largest product below 2^32.
+    uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6;
+    converted.Store4(0, uint4(vertices, args.y, args.z, args.w));
+}
+)";
+
+class RectIndirectArguments {
+public:
+    // Records the conversion of the four draw words at `source_address` and returns the scratch resource now
+    // in INDIRECT_ARGUMENT state, or nullptr if the pass could not be set up (nothing was recorded then).
+    // The scratch buffer rests in COMMON between draws; `finish` puts it back there.
+    ID3D12Resource* convert(ID3D12GraphicsCommandList* list, D3D12_GPU_VIRTUAL_ADDRESS source_address)
+    {
+        Microsoft::WRL::ComPtr<ID3D12Device> device;
+        if (!list || !source_address || FAILED(list->GetDevice(IID_PPV_ARGS(&device)))) return nullptr;
+        Entry* entry = entry_for(device.Get());
+        if (!entry) return nullptr;
+        transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+        list->SetComputeRootSignature(entry->root.Get());
+        list->SetPipelineState(entry->pipeline.Get());
+        list->SetComputeRootShaderResourceView(0, source_address);
+        list->SetComputeRootUnorderedAccessView(1, entry->scratch->GetGPUVirtualAddress());
+        list->Dispatch(1, 1, 1);
+        transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT);
+        return entry->scratch.Get();
+    }
+    static void finish(ID3D12GraphicsCommandList* list, ID3D12Resource* scratch)
+    {
+        transition(list, scratch, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, D3D12_RESOURCE_STATE_COMMON);
+    }
+
+private:
+    struct Entry {
+        ID3D12Device* device = nullptr;
+        Microsoft::WRL::ComPtr<ID3D12RootSignature> root;
+        Microsoft::WRL::ComPtr<ID3D12PipelineState> pipeline;
+        Microsoft::WRL::ComPtr<ID3D12Resource> scratch;
+    };
+    static void transition(ID3D12GraphicsCommandList* list, ID3D12Resource* resource, D3D12_RESOURCE_STATES before,
+                           D3D12_RESOURCE_STATES after)
+    {
+        D3D12_RESOURCE_BARRIER barrier{};
+        barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+        barrier.Transition.pResource = resource;
+        barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
+        barrier.Transition.StateBefore = before;
+        barrier.Transition.StateAfter = after;
+        list->ResourceBarrier(1, &barrier);
+    }
+    // Entries are never freed: a conversion may still be queued when its list is released.
+    Entry* entry_for(ID3D12Device* device)
+    {
+        std::lock_guard<std::mutex> guard(lock_);
+        for (auto& known : entries_)
+            if (known->device == device) return known->scratch ? known.get() : nullptr;

Fixed in 14a50ec4 (kept in d1837dde). The conversion no longer uses one scratch buffer per device. Each recorded conversion now takes its own scratch buffer from the allocator that holds the recording; buffers are reused only when that allocator is Reset, which already requires it to be idle. Lists running on different queues therefore never share scratch words or its resource state.

Regression: the startup_indirect_rectlist fixture now asserts that every recording holds exactly one scratch buffer on its own allocator (0 for refused draws) through a new fixture export. Executed locally: same Linux checks as above, and Win2025 3-slot x2w_pipe.py win2025 2173 --force: dev 28/28 and release 28/28 passed, 0 skips.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4690466498 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#discussion_r4690466498). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:40:05Z. **Code review location:** `src/startup_stubs/rect_indirect_args.h`; line 86 ~~~~diff @@ -0,0 +1,136 @@ +// Argument conversion for an indirect Draw with the console-only rectangle-list topology (0x11). +// +// A rectangle list names three vertices per rectangle, so the title's GPU-written VertexCountPerInstance is +// three times the rectangle count. The desktop draw covers each rectangle with two triangles (six vertices), +// so the count has to become rectangles * 6 on the GPU, after the title's producer has written it. A +// one-thread compute pass reads the title's four argument words and writes the converted four words into a +// scratch buffer that the desktop ExecuteIndirect then reads. The title's own argument buffer is left as it is. +// +// The conversion mirrors the direct draw (`count / 3 * 6`, a trailing partial rectangle is dropped). A count +// whose converted value would not fit 32 bits becomes 0 vertices (nothing is drawn) instead of wrapping. +// Python model: tools/rectlist_topology.py convert_indirect_draw_arguments. +#pragma once + +#include <d3d12.h> +#include <d3dcompiler.h> +#include <wrl/client.h> + +#include <memory> +#include <mutex> +#include <vector> + +namespace x2w_startup { + +inline constexpr char rect_indirect_args_hlsl[] = R"( +ByteAddressBuffer source : register(t0); +RWByteAddressBuffer converted : register(u0); + +[numthreads(1, 1, 1)] +void convert() { + uint4 args = source.Load4(0); + uint rectangles = args.x / 3; + // 0x2AAAAAAA * 6 is the largest product below 2^32. + uint vertices = rectangles > 0x2AAAAAAAu ? 0 : rectangles * 6; + converted.Store4(0, uint4(vertices, args.y, args.z, args.w)); +} +)"; + +class RectIndirectArguments { +public: + // Records the conversion of the four draw words at `source_address` and returns the scratch resource now + // in INDIRECT_ARGUMENT state, or nullptr if the pass could not be set up (nothing was recorded then). + // The scratch buffer rests in COMMON between draws; `finish` puts it back there. + ID3D12Resource* convert(ID3D12GraphicsCommandList* list, D3D12_GPU_VIRTUAL_ADDRESS source_address) + { + Microsoft::WRL::ComPtr<ID3D12Device> device; + if (!list || !source_address || FAILED(list->GetDevice(IID_PPV_ARGS(&device)))) return nullptr; + Entry* entry = entry_for(device.Get()); + if (!entry) return nullptr; + transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + list->SetComputeRootSignature(entry->root.Get()); + list->SetPipelineState(entry->pipeline.Get()); + list->SetComputeRootShaderResourceView(0, source_address); + list->SetComputeRootUnorderedAccessView(1, entry->scratch->GetGPUVirtualAddress()); + list->Dispatch(1, 1, 1); + transition(list, entry->scratch.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT); + return entry->scratch.Get(); + } + static void finish(ID3D12GraphicsCommandList* list, ID3D12Resource* scratch) + { + transition(list, scratch, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, D3D12_RESOURCE_STATE_COMMON); + } + +private: + struct Entry { + ID3D12Device* device = nullptr; + Microsoft::WRL::ComPtr<ID3D12RootSignature> root; + Microsoft::WRL::ComPtr<ID3D12PipelineState> pipeline; + Microsoft::WRL::ComPtr<ID3D12Resource> scratch; + }; + static void transition(ID3D12GraphicsCommandList* list, ID3D12Resource* resource, D3D12_RESOURCE_STATES before, + D3D12_RESOURCE_STATES after) + { + D3D12_RESOURCE_BARRIER barrier{}; + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Transition.pResource = resource; + barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + barrier.Transition.StateBefore = before; + barrier.Transition.StateAfter = after; + list->ResourceBarrier(1, &barrier); + } + // Entries are never freed: a conversion may still be queued when its list is released. + Entry* entry_for(ID3D12Device* device) + { + std::lock_guard<std::mutex> guard(lock_); + for (auto& known : entries_) + if (known->device == device) return known->scratch ? known.get() : nullptr; ~~~~ --- Fixed in 14a50ec4 (kept in d1837dde). The conversion no longer uses one scratch buffer per device. Each recorded conversion now takes its own scratch buffer from the allocator that holds the recording; buffers are reused only when that allocator is Reset, which already requires it to be idle. Lists running on different queues therefore never share scratch words or its resource state. Regression: the `startup_indirect_rectlist` fixture now asserts that every recording holds exactly one scratch buffer on its own allocator (0 for refused draws) through a new fixture export. Executed locally: same Linux checks as above, and Win2025 3-slot `x2w_pipe.py win2025 2173 --force`: dev 28/28 and release 28/28 passed, 0 skips. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 06:01:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T05:28:28Z.

Review: CHANGES_REQUESTED


This still needs the #2181 merge resolution, retaining the rooted Dispatch restrictions. The rectangle conversion also uses one scratch buffer per device. Two direct queues can execute their conversion passes concurrently, between another queue's conversion and ExecuteIndirect. One queue can then draw using the other queue's argument count. Please allocate scratch per recorded operation, retain it through the recording and every consuming queue fence, or refuse an unproved overlap. A two-queue fence-controlled case with different argument counts should match both expected targets, with shared scratch as the negative. The converter should also refuse before it mutates a live compute root with arguments unless it can restore those arguments.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052299179 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#pullrequestreview-6052299179). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T05:28:28Z. **Review:** CHANGES_REQUESTED --- This still needs the #2181 merge resolution, retaining the rooted Dispatch restrictions. The rectangle conversion also uses one scratch buffer per device. Two direct queues can execute their conversion passes concurrently, between another queue's conversion and ExecuteIndirect. One queue can then draw using the other queue's argument count. Please allocate scratch per recorded operation, retain it through the recording and every consuming queue fence, or refuse an unproved overlap. A two-queue fence-controlled case with different argument counts should match both expected targets, with shared scratch as the negative. The converter should also refuse before it mutates a live compute root with arguments unless it can restore those arguments.
tedin7 commented 2026-11-25 06:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:53:47Z.


Pushed 6430ac24 (merged current main on top; the code change is in 7ac8d821).

  • #2181 rooted Dispatch restrictions: retained. The merge was clean, and the rooted-signature checks (one command, no count buffer, matching bound compute root) are untouched.
  • Scratch: it is no longer one buffer per device. It is created per recording on the first rectangle conversion and owned by that recording's desktop allocator. That allocator is reused only after every queue that ran the recording has passed its fence, so two queues never read each other's converted count.
  • Live compute root: the draw is refused before anything is recorded if a compute root argument was set since the last compute root signature (the conversion replaces the root signature and cannot restore arguments).
  • Test: startup_indirect_rectlist_* now also runs two recordings with different counts (one and two rectangles) on two queues, 24 rounds each, with both submits released together. Each target must match its own count. I did not add a shared-scratch negative: that would need test-only production code, and the interleaving between the conversion and the draw sits inside one runtime call, so I cannot hold it open from the fixture. Tell me if you want a different shape.
  • Linux: tests/docs_links_check.py and tests/rectlist_topology_check.py pass.
  • Win2025 3-slot, x2w_pipe.py win2025 2173 --force: dev and release both 100% passed, 28 of 28, zero skips.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154241816 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7154241816). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:53:47Z. --- Pushed 6430ac24 (merged current main on top; the code change is in 7ac8d821). - #2181 rooted Dispatch restrictions: retained. The merge was clean, and the rooted-signature checks (one command, no count buffer, matching bound compute root) are untouched. - Scratch: it is no longer one buffer per device. It is created per recording on the first rectangle conversion and owned by that recording's desktop allocator. That allocator is reused only after every queue that ran the recording has passed its fence, so two queues never read each other's converted count. - Live compute root: the draw is refused before anything is recorded if a compute root argument was set since the last compute root signature (the conversion replaces the root signature and cannot restore arguments). - Test: `startup_indirect_rectlist_*` now also runs two recordings with different counts (one and two rectangles) on two queues, 24 rounds each, with both submits released together. Each target must match its own count. I did not add a shared-scratch negative: that would need test-only production code, and the interleaving between the conversion and the draw sits inside one runtime call, so I cannot hold it open from the fixture. Tell me if you want a different shape. - Linux: `tests/docs_links_check.py` and `tests/rectlist_topology_check.py` pass. - Win2025 3-slot, `x2w_pipe.py win2025 2173 --force`: dev and release both 100% passed, 28 of 28, zero skips. AI-assisted; commands listed were executed locally.
legacy-code-archaeologist commented 2026-11-25 07:01:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T06:02:39Z.


Ran head 6430ac24 (build target startup_indirect_draw_indexed). WARP passes; the hardware run fails on an Intel HD Graphics 530. Windows 11 build 26100, debug layer unavailable.

Test Adapter Result
startup_indirect_rectlist_warp WARP 10.0.26100.8972 pass: one rectangle 4/8, two 8/8, overflowing count 0/8, the concurrent cases as expected
startup_indirect_rectlist_hardware Intel HD Graphics 530 (Gen9), driver 31.0.101.2111 fail at the first case: one rectangle: 0/8 non-clear pixels, argument guards intact, with pixel (0,0): got 0xff000000, expected 0xff0000ff and the same for (1,0), (0,1), (1,1)

The draw writes nothing on Gen9. The argument guards stay intact, so the indirect arguments are not corrupted; the rectangle simply produces no pixels. The existing startup_indirect_draw_hardware, startup_indirect_draw_indexed_hardware and startup_indirect_dispatch_hardware from the same build pass on the same adapter. This looks specific to the rectangle-list path on that driver, but I have not pinned the cause.

A second point: this executable ignores XBOX2WINDOWS_ADAPTER. With XBOX2WINDOWS_ADAPTER=Quadro it still printed adapter: Intel(R) HD Graphics 530 (the first hardware adapter on this laptop), so I have no NVIDIA Quadro M1000M result for this test. Logs are available if useful.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154383591 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7154383591). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T06:02:39Z. --- Ran head `6430ac24` (build target `startup_indirect_draw_indexed`). WARP passes; **the hardware run fails on an Intel HD Graphics 530**. Windows 11 build 26100, debug layer unavailable. | Test | Adapter | Result | |---|---|---| | `startup_indirect_rectlist_warp` | WARP 10.0.26100.8972 | pass: one rectangle 4/8, two 8/8, overflowing count 0/8, the concurrent cases as expected | | `startup_indirect_rectlist_hardware` | Intel HD Graphics 530 (Gen9), driver 31.0.101.2111 | **fail** at the first case: `one rectangle: 0/8 non-clear pixels, argument guards intact`, with `pixel (0,0): got 0xff000000, expected 0xff0000ff` and the same for (1,0), (0,1), (1,1) | The draw writes nothing on Gen9. The argument guards stay intact, so the indirect arguments are not corrupted; the rectangle simply produces no pixels. The existing `startup_indirect_draw_hardware`, `startup_indirect_draw_indexed_hardware` and `startup_indirect_dispatch_hardware` from the same build pass on the same adapter. This looks specific to the rectangle-list path on that driver, but I have not pinned the cause. A second point: this executable ignores `XBOX2WINDOWS_ADAPTER`. With `XBOX2WINDOWS_ADAPTER=Quadro` it still printed `adapter: Intel(R) HD Graphics 530` (the first hardware adapter on this laptop), so I have **no** NVIDIA Quadro M1000M result for this test. Logs are available if useful. _AI-assisted._
tedin7 commented 2026-11-25 07:01:12 +00:00 (Migrated from github.com)

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


Thank you @legacy-code-archaeologist, this was a real find.

Root cause: the one-thread conversion pass read the four draw words with a single 16-byte Load4 from a root SRV address. The title's draw record can sit at any 4-byte offset (the fixture places it at byte 4), and that unaligned vector load is not valid on every GPU. WARP accepts it. On Gen9 the converted count was wrong, so nothing was drawn, while the guard words stayed intact, as you saw.

Fix in ae093613: the four words are now read and written as scalar 4-byte accesses. The existing startup_indirect_rectlist_* cases already use the 4-byte offset, so they cover this exact layout.

Verification:

  • python3 tests/docs_links_check.py and python3 tests/rectlist_topology_check.py: pass.
  • Win2025 3-slot, x2w_pipe.py win2025 2173 --force: dev and release both 100% passed, 28 of 28, zero skips.

Could you re-run startup_indirect_rectlist_hardware on the HD 530 with the new head? I have no Gen9 hardware here, so the hardware result is yours to confirm. Also noted: the executable ignoring XBOX2WINDOWS_ADAPTER. I'll look at that separately.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154558518 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7154558518). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:12:48Z. --- Thank you @legacy-code-archaeologist, this was a real find. Root cause: the one-thread conversion pass read the four draw words with a single 16-byte `Load4` from a root SRV address. The title's draw record can sit at any 4-byte offset (the fixture places it at byte 4), and that unaligned vector load is not valid on every GPU. WARP accepts it. On Gen9 the converted count was wrong, so nothing was drawn, while the guard words stayed intact, as you saw. Fix in ae093613: the four words are now read and written as scalar 4-byte accesses. The existing `startup_indirect_rectlist_*` cases already use the 4-byte offset, so they cover this exact layout. Verification: - `python3 tests/docs_links_check.py` and `python3 tests/rectlist_topology_check.py`: pass. - Win2025 3-slot, `x2w_pipe.py win2025 2173 --force`: dev and release both 100% passed, 28 of 28, zero skips. Could you re-run `startup_indirect_rectlist_hardware` on the HD 530 with the new head? I have no Gen9 hardware here, so the hardware result is yours to confirm. Also noted: the executable ignoring `XBOX2WINDOWS_ADAPTER`. I'll look at that separately. AI-assisted; commands listed were executed locally.
legacy-code-archaeologist commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T06:23:25Z.


@tedin7 I re-ran head ae093613 (worktree, startup_indirect_draw_indexed rebuilt). It still fails on the HD 530, identically to before:

Test Adapter Result
startup_indirect_rectlist_warp WARP 10.0.26100.8972 pass: one rectangle 4/8, two 8/8; omitted writer, short range, missing viewport and overflow 0/8; the concurrent cases as expected
startup_indirect_rectlist_hardware Intel HD Graphics 530, driver 31.0.101.2111, debug layer unavailable fail: one rectangle: 0/8 non-clear pixels, argument guards intact, and pixel (0,0)…(1,1): got 0xff000000, expected 0xff0000ff

So the scalar loads do not change the outcome on Gen9; the unaligned Load4 was not the cause there, or not the only one. Things I checked without finding anything:

  • convert() has the COMMON → UNORDERED_ACCESS → INDIRECT_ARGUMENT transitions around the dispatch, so a missing state transition on the scratch buffer is not it.
  • The same build's startup_indirect_draw_hardware, _draw_indexed_hardware and _dispatch_hardware pass on this adapter, so plain ExecuteIndirect works here.

I have not narrowed it further. What would separate the remaining possibilities on Gen9 is a readback of the scratch buffer after the conversion. It would show whether the converted count is wrong (the conversion, or how the source root SRV reads at byte offset 4) or the four words are right and the draw itself produces nothing. If you add a debug readback or a fixture case that dumps those words, I can run it here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154740427 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7154740427). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T06:23:25Z. --- @tedin7 I re-ran head `ae093613` (worktree, `startup_indirect_draw_indexed` rebuilt). **It still fails on the HD 530**, identically to before: | Test | Adapter | Result | |---|---|---| | `startup_indirect_rectlist_warp` | WARP 10.0.26100.8972 | pass: one rectangle 4/8, two 8/8; omitted writer, short range, missing viewport and overflow 0/8; the concurrent cases as expected | | `startup_indirect_rectlist_hardware` | Intel HD Graphics 530, driver 31.0.101.2111, debug layer unavailable | **fail**: `one rectangle: 0/8 non-clear pixels, argument guards intact`, and `pixel (0,0)…(1,1): got 0xff000000, expected 0xff0000ff` | So the scalar loads do not change the outcome on Gen9; the unaligned `Load4` was not the cause there, or not the only one. Things I checked without finding anything: - `convert()` has the COMMON → UNORDERED_ACCESS → INDIRECT_ARGUMENT transitions around the dispatch, so a missing state transition on the scratch buffer is not it. - The same build's `startup_indirect_draw_hardware`, `_draw_indexed_hardware` and `_dispatch_hardware` pass on this adapter, so plain `ExecuteIndirect` works here. I have not narrowed it further. What would separate the remaining possibilities on Gen9 is a readback of the scratch buffer after the conversion. It would show whether the converted count is wrong (the conversion, or how the source root SRV reads at byte offset 4) or the four words are right and the draw itself produces nothing. If you add a debug readback or a fixture case that dumps those words, I can run it here. _AI-assisted._
tedin7 commented 2026-11-25 07:01:14 +00:00 (Migrated from github.com)

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


Thank you @legacy-code-archaeologist, and sorry the scalar-load change did not help. Your point that the draw record and guards were intact, and that the plain indirect draw tests pass on the same adapter, narrowed this to what is special about the conversion pass.

I have not isolated the exact Gen9 cause, so this is a change that removes the suspect, not a confirmed diagnosis. The pass read the title's argument buffer through a raw-buffer root SRV at an arbitrary 4-byte offset into a very small placed buffer. That is the only binding in the rectangle path that no other passing indirect test uses.

Fix in 0bb97ff3:

  • The conversion no longer binds the title's buffer. A CopyBufferRegion copies the four draw words into the per-recording scratch buffer (a copy has no alignment rule).
  • The pass has one root UAV, on that scratch buffer, and reads and writes only there. The root signature has no SRV any more.
  • The source buffer is moved to its argument state plus COPY_SOURCE (it was argument state plus NON_PIXEL_SHADER_RESOURCE). The scratch goes COMMON, COPY_DEST, UNORDERED_ACCESS, INDIRECT_ARGUMENT, COMMON, so each use has its own transition.

I cannot run the debug layer or Gen9 here, so the hardware result is still yours to confirm. If startup_indirect_rectlist_hardware still shows 0/8 on the HD 530 with this head, a scratch readback fixture would be the next step, as you suggested, and I will add one.

Verification:

  • python3 tests/docs_links_check.py and python3 tests/rectlist_topology_check.py: pass.
  • Win2025 3-slot, x2w_pipe.py win2025 2173 --force: dev and release both 100% passed, 28 of 28, zero skips (startup_indirect_rectlist_warp included).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154890050 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7154890050). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:32:07Z. --- Thank you @legacy-code-archaeologist, and sorry the scalar-load change did not help. Your point that the draw record and guards were intact, and that the plain indirect draw tests pass on the same adapter, narrowed this to what is special about the conversion pass. I have not isolated the exact Gen9 cause, so this is a change that removes the suspect, not a confirmed diagnosis. The pass read the title's argument buffer through a raw-buffer root SRV at an arbitrary 4-byte offset into a very small placed buffer. That is the only binding in the rectangle path that no other passing indirect test uses. Fix in 0bb97ff3: - The conversion no longer binds the title's buffer. A `CopyBufferRegion` copies the four draw words into the per-recording scratch buffer (a copy has no alignment rule). - The pass has one root UAV, on that scratch buffer, and reads and writes only there. The root signature has no SRV any more. - The source buffer is moved to its argument state plus `COPY_SOURCE` (it was argument state plus `NON_PIXEL_SHADER_RESOURCE`). The scratch goes COMMON, COPY_DEST, UNORDERED_ACCESS, INDIRECT_ARGUMENT, COMMON, so each use has its own transition. I cannot run the debug layer or Gen9 here, so the hardware result is still yours to confirm. If `startup_indirect_rectlist_hardware` still shows 0/8 on the HD 530 with this head, a scratch readback fixture would be the next step, as you suggested, and I will add one. Verification: - `python3 tests/docs_links_check.py` and `python3 tests/rectlist_topology_check.py`: pass. - Win2025 3-slot, `x2w_pipe.py win2025 2173 --force`: dev and release both 100% passed, 28 of 28, zero skips (`startup_indirect_rectlist_warp` included). AI-assisted; commands listed were executed locally.
legacy-code-archaeologist commented 2026-11-25 07:01:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T06:40:12Z.


@tedin7 Re-ran head 0bb97ff3 (worktree, startup_indirect_draw_indexed rebuilt). No change on the HD 530: still 0/8.

Test Adapter Result
startup_indirect_rectlist_warp WARP 10.0.26100.8972 pass: one rectangle 4/8, two 8/8, omitted writer, short range, missing viewport and overflow 0/8; all concurrent cases as expected
startup_indirect_rectlist_hardware Intel HD Graphics 530, driver 31.0.101.2111, debug layer unavailable fail: one rectangle: 0/8 non-clear pixels, argument guards intact, with pixel (0,0)…(1,1): got 0xff000000, expected 0xff0000ff. The case is reported twice in the log with the same result.
startup_indirect_draw_hardware, startup_indirect_draw_indexed_hardware (same build, same adapter) Intel HD 530 pass

So the root-SRV binding of the title buffer was not the cause either. With the copy into owned scratch, the conversion pass now touches only its own buffer, and the result is identical. That points either at the conversion's output (count or the other words in the scratch) or at the six-vertex triangle draw that replaces the rectangle. Neither the plain nor the indexed indirect draw shows the problem. This suite has no non-indirect rectangle-list draw I could run to separate the two, so the scratch readback fixture is the next step. I'll run it here when it's up.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155034934 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7155034934). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T06:40:12Z. --- @tedin7 Re-ran head `0bb97ff3` (worktree, `startup_indirect_draw_indexed` rebuilt). **No change on the HD 530: still 0/8.** | Test | Adapter | Result | |---|---|---| | `startup_indirect_rectlist_warp` | WARP 10.0.26100.8972 | pass: one rectangle 4/8, two 8/8, omitted writer, short range, missing viewport and overflow 0/8; all concurrent cases as expected | | `startup_indirect_rectlist_hardware` | Intel HD Graphics 530, driver 31.0.101.2111, debug layer unavailable | **fail**: `one rectangle: 0/8 non-clear pixels, argument guards intact`, with `pixel (0,0)…(1,1): got 0xff000000, expected 0xff0000ff`. The case is reported twice in the log with the same result. | | `startup_indirect_draw_hardware`, `startup_indirect_draw_indexed_hardware` (same build, same adapter) | Intel HD 530 | pass | So the root-SRV binding of the title buffer was not the cause either. With the copy into owned scratch, the conversion pass now touches only its own buffer, and the result is identical. That points either at the conversion's output (count or the other words in the scratch) or at the six-vertex triangle draw that replaces the rectangle. Neither the plain nor the indexed indirect draw shows the problem. This suite has no non-indirect rectangle-list draw I could run to separate the two, so the scratch readback fixture is the next step. I'll run it here when it's up. _AI-assisted._
tedin7 commented 2026-11-25 07:01:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:48:55Z.


Thank you @legacy-code-archaeologist, the 0/8 with intact guards on the HD 530 is clear and the "same result after the copy" data rules out two suspects.

I compared every D3D12 call of the rectangle path against the passing indirect fixtures at head 0bb97ff3, and I do not find a concrete API fault, so I am not pushing another guess:

  • Scratch resource: DEFAULT heap, ALLOW_UNORDERED_ACCESS, COMMON -> COPY_DEST -> UNORDERED_ACCESS -> INDIRECT_ARGUMENT -> COMMON. Every transition has a matching before/after state; there is no UPLOAD/UAV mix.
  • Conversion pass: one root UAV, root flags NONE, cs_5_0 RWByteAddressBuffer, scalar accesses only. The graphics pipeline, graphics root signature, topology, viewport, scissor and targets are all re-applied after the compute pass, before ExecuteIndirect.
  • Command signature and draw stride are the same as the passing non-indexed indirect draw. Cull mode is NONE in the fixture.

What is left, and where the two cases differ from the passing plain draw:

  1. The converted count in the scratch (conversion pass or copy).
  2. The fixture's vertex_rect vertex shader: it indexes a local constant array with SV_VertexID % 6 and builds a fourth corner. The passing draws use a simpler vertex shader.

A scratch readback separates (1) from the rest. The next step is a small diagnostic fixture case that dumps the scratch words, to be run on the HD 530. The production path stays unchanged until then.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155186590 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7155186590). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:48:55Z. --- Thank you @legacy-code-archaeologist, the 0/8 with intact guards on the HD 530 is clear and the "same result after the copy" data rules out two suspects. I compared every D3D12 call of the rectangle path against the passing indirect fixtures at head `0bb97ff3`, and I do not find a concrete API fault, so I am not pushing another guess: - Scratch resource: DEFAULT heap, `ALLOW_UNORDERED_ACCESS`, COMMON -> COPY_DEST -> UNORDERED_ACCESS -> INDIRECT_ARGUMENT -> COMMON. Every transition has a matching before/after state; there is no UPLOAD/UAV mix. - Conversion pass: one root UAV, root flags NONE, `cs_5_0` `RWByteAddressBuffer`, scalar accesses only. The graphics pipeline, graphics root signature, topology, viewport, scissor and targets are all re-applied after the compute pass, before `ExecuteIndirect`. - Command signature and draw stride are the same as the passing non-indexed indirect draw. Cull mode is NONE in the fixture. What is left, and where the two cases differ from the passing plain draw: 1. The converted count in the scratch (conversion pass or copy). 2. The fixture's `vertex_rect` vertex shader: it indexes a local constant array with `SV_VertexID % 6` and builds a fourth corner. The passing draws use a simpler vertex shader. A scratch readback separates (1) from the rest. The next step is a small diagnostic fixture case that dumps the scratch words, to be run on the HD 530. The production path stays unchanged until then. AI-assisted; commands listed were executed locally.
legacy-code-archaeologist commented 2026-11-25 08:05:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T07:53:25Z.


@tedin7 One more data point while the readback case is pending, from main (e94e14ff) on the same HD 530 (driver 31.0.101.2111). rectlist_draw_check takes the first non-software adapter, which on this laptop is the Intel GPU.

Test Result
rectlist_draw_hardware pass: positive_draw=pass mismatches=0, reversed_winding_cull_control=pass culled_mismatches=900, wrong_corner_mutant_control=pass detected_mismatches=435, desktop_raw_topology_rejection=pass
rectlist_draw_warp pass, same lines

That path draws the rectangle-to-triangle conversion from a vertex buffer with a pass-through vertex shader (tests/rectlist_quad.hlsl), without ExecuteIndirect. So Gen9 rasterizes the replacement triangles correctly. Of your two remaining candidates, this does not separate them, but it narrows (2): the difference from the passing paths is specifically vertex_rect, the SV_VertexID-indexed local corner[6] array with the derived fourth corner, combined with the indirect count. The scratch readback is still the cleanest split. A variant of vertex_rect that computes c arithmetically instead of from the local array would be a second cheap check, and I can run either here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7156366441 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7156366441). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T07:53:25Z. --- @tedin7 One more data point while the readback case is pending, from `main` (`e94e14ff`) on the same HD 530 (driver 31.0.101.2111). `rectlist_draw_check` takes the first non-software adapter, which on this laptop is the Intel GPU. | Test | Result | |---|---| | `rectlist_draw_hardware` | pass: `positive_draw=pass mismatches=0`, `reversed_winding_cull_control=pass culled_mismatches=900`, `wrong_corner_mutant_control=pass detected_mismatches=435`, `desktop_raw_topology_rejection=pass` | | `rectlist_draw_warp` | pass, same lines | That path draws the rectangle-to-triangle conversion from a vertex buffer with a pass-through vertex shader (`tests/rectlist_quad.hlsl`), without `ExecuteIndirect`. So Gen9 rasterizes the replacement triangles correctly. Of your two remaining candidates, this does not separate them, but it narrows (2): the difference from the passing paths is specifically `vertex_rect`, the `SV_VertexID`-indexed local `corner[6]` array with the derived fourth corner, combined with the indirect count. The scratch readback is still the cleanest split. A variant of `vertex_rect` that computes `c` arithmetically instead of from the local array would be a second cheap check, and I can run either here. _AI-assisted._
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:50:40Z.


Thanks for the review, @legacy-code-archaeologist. Updated head: 88da5b31, rebased onto the latest main (including #2259 and #2283).

Changes:

  • Added an explicit UAV barrier on the scratch buffer between the conversion Dispatch and the transition to INDIRECT_ARGUMENT.
  • Added a failure-path diagnostic in startup_indirect_draw_indexed.cpp. If pixels mismatch, it prints the title's 4 draw words, the CPU reference count, and the 4 GPU-converted words from a readback copy. Passing runs are not affected.

Verification (Windows Server 2025, Build 26100, MSVC 14.44 + D3D12 WARP, 3-slot pool):

  • python3 x2w_pipe.py win2025 2173 --force
  • ctest --preset dev (focused WARP/startup set, including startup_indirect_rectlist_warp): 42/42 passed
  • ctest --preset release (same set): 42/42 passed

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160247757 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7160247757). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T10:50:40Z. --- Thanks for the review, @legacy-code-archaeologist. Updated head: `88da5b31`, rebased onto the latest `main` (including #2259 and #2283). Changes: - Added an explicit UAV barrier on the scratch buffer between the conversion `Dispatch` and the transition to `INDIRECT_ARGUMENT`. - Added a failure-path diagnostic in `startup_indirect_draw_indexed.cpp`. If pixels mismatch, it prints the title's 4 draw words, the CPU reference count, and the 4 GPU-converted words from a readback copy. Passing runs are not affected. Verification (Windows Server 2025, Build 26100, MSVC 14.44 + D3D12 WARP, 3-slot pool): - `python3 x2w_pipe.py win2025 2173 --force` - `ctest --preset dev` (focused WARP/startup set, including `startup_indirect_rectlist_warp`): 42/42 passed - `ctest --preset release` (same set): 42/42 passed AI-assisted; commands listed were executed locally.
legacy-code-archaeologist commented 2026-11-25 11:02:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T10:52:40Z.


@tedin7 Ran head 88da5b31 on the HD 530 (Intel HD Graphics 530, driver 31.0.101.2111, Windows 11 build 26100, debug layer unavailable). The diagnostic answers the question: the conversion is correct, the draw is not.

one rectangle: pixel (0,0): got 0xff000000, expected 0xff0000ff   (same for (1,0), (0,1), (1,1))
rect conversion diagnostic: title words 3 1 0 0, CPU reference vertices 6
rect conversion diagnostic: GPU scratch DrawInstanced words 6 1 0 0 (matches the CPU reference)
one rectangle: 0/8 non-clear pixels, argument guards intact

The case runs twice in the log with identical output. The explicit UAV barrier does not change the pixels. startup_indirect_rectlist_warp still passes all cases.

So on Gen9 the conversion pass, the copy and the barrier produce DrawInstanced(6, 1, 0, 0) as intended, and the 6-vertex draw still writes nothing. One caveat: the diagnostic converts a fresh copy of the words, not the scratch the recorded draw consumed. With the per-recording scratch, the barriers and identical code, I would expect the same words there.

That leaves the draw side. rectlist_draw_hardware (vertex buffer, pass-through VS) and startup_indirect_draw_hardware (indirect, plain VS) both pass on this adapter. What remains specific to this case is vertex_rect: the SV_VertexID-indexed local corner[6] array, the per-rectangle v0/v1/v2 selection, and the derived v3. A case that issues the same vertex_rect PSO with a direct DrawInstanced(6, 1, 0, 0) would confirm it without the indirect path. A variant of vertex_rect that computes the corner arithmetically, for example c = (id % 6 < 3) ? id % 6 : (id % 6 == 3 ? 0 : id % 6 - 2), would show whether the dynamic local array is the issue. I can run either on this adapter.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160292277 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7160292277). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T10:52:40Z. --- @tedin7 Ran head `88da5b31` on the HD 530 (Intel HD Graphics 530, driver 31.0.101.2111, Windows 11 build 26100, debug layer unavailable). The diagnostic answers the question: **the conversion is correct, the draw is not.** ``` one rectangle: pixel (0,0): got 0xff000000, expected 0xff0000ff (same for (1,0), (0,1), (1,1)) rect conversion diagnostic: title words 3 1 0 0, CPU reference vertices 6 rect conversion diagnostic: GPU scratch DrawInstanced words 6 1 0 0 (matches the CPU reference) one rectangle: 0/8 non-clear pixels, argument guards intact ``` The case runs twice in the log with identical output. The explicit UAV barrier does not change the pixels. `startup_indirect_rectlist_warp` still passes all cases. So on Gen9 the conversion pass, the copy and the barrier produce `DrawInstanced(6, 1, 0, 0)` as intended, and the 6-vertex draw still writes nothing. One caveat: the diagnostic converts a fresh copy of the words, not the scratch the recorded draw consumed. With the per-recording scratch, the barriers and identical code, I would expect the same words there. That leaves the draw side. `rectlist_draw_hardware` (vertex buffer, pass-through VS) and `startup_indirect_draw_hardware` (indirect, plain VS) both pass on this adapter. What remains specific to this case is `vertex_rect`: the `SV_VertexID`-indexed local `corner[6]` array, the per-rectangle `v0`/`v1`/`v2` selection, and the derived `v3`. A case that issues the same `vertex_rect` PSO with a direct `DrawInstanced(6, 1, 0, 0)` would confirm it without the indirect path. A variant of `vertex_rect` that computes the corner arithmetically, for example `c = (id % 6 < 3) ? id % 6 : (id % 6 == 3 ? 0 : id % 6 - 2)`, would show whether the dynamic local array is the issue. I can run either on this adapter. _AI-assisted._
legacy-code-archaeologist commented 2026-11-25 12:01:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T11:22:45Z.


@tedin7 Confirmed: head 303634a0 passes on the HD 530.

Test Adapter Result
startup_indirect_rectlist_hardware Intel HD Graphics 530, driver 31.0.101.2111, Windows 11 build 26100, debug layer unavailable pass (0.84 s): one rectangle 4/8, two rectangles 8/8; omitted writer, short argument range, missing viewport and overflowing count 0/8; every concurrent case 4/8 or 8/8; argument guards intact throughout
startup_indirect_rectlist_warp WARP 10.0.26100.8972 pass, same lines

Together with the previous run, where the conversion read back 6 1 0 0 and the draw still wrote nothing, this pins the Gen9 failure to the fixture's vertex_rect: an SV_VertexID-indexed local array. The arithmetic corner selection draws correctly on the same driver. The conversion pass and the production path were correct all along. The earlier scalar-load, scratch-copy and UAV-barrier changes were not needed for Gen9. Whether you keep them is your call.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160967198 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7160967198). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T11:22:45Z. --- @tedin7 Confirmed: head `303634a0` **passes on the HD 530**. | Test | Adapter | Result | |---|---|---| | `startup_indirect_rectlist_hardware` | Intel HD Graphics 530, driver 31.0.101.2111, Windows 11 build 26100, debug layer unavailable | **pass** (0.84 s): one rectangle 4/8, two rectangles 8/8; omitted writer, short argument range, missing viewport and overflowing count 0/8; every concurrent case 4/8 or 8/8; argument guards intact throughout | | `startup_indirect_rectlist_warp` | WARP 10.0.26100.8972 | pass, same lines | Together with the previous run, where the conversion read back `6 1 0 0` and the draw still wrote nothing, this pins the Gen9 failure to the fixture's `vertex_rect`: an `SV_VertexID`-indexed local array. The arithmetic corner selection draws correctly on the same driver. The conversion pass and the production path were correct all along. The earlier scalar-load, scratch-copy and UAV-barrier changes were not needed for Gen9. Whether you keep them is your call. _AI-assisted._
tedin7 commented 2026-11-25 12:01:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:41:07Z.


Thank you @legacy-code-archaeologist: the 4-DWORD readback on the HD 530 (6 1 0 0) showed that the rectangle-list conversion writes exactly the expected words, so the conversion itself is correct and the Gen9 difference sits in the vertex_rect vertex shader of tests/startup_indirect_draw_indexed.cpp.

Pushed 303634a0: vertex_rect no longer indexes a local array with SV_VertexID. The corner sequence 0,1,2,0,2,3 is computed with plain arithmetic (k = id % 6, c = (k < 3) ? k : (k == 3 ? 0 : k - 2)) and the position is picked with scalar selects. The other vertex shaders in that test and in tests/rectlist_quad.hlsl already had no dynamically indexed local arrays.

Verification (Windows Server 2025 build 26100, MSVC 14.44.35207, D3D12 WARP, commit 303634a0):

  • --preset dev: build OK, ctest 42/42 passed (100%), including startup_indirect_draw_indexed_warp, startup_indirect_rectlist_warp, rectlist_draw_warp, rectlist_topology.
  • --preset release (/O2): build OK, ctest 42/42 passed (100%), same tests.
  • Linux: tests/rectlist_topology_check.py 18 tests OK, git diff --check clean.

WARP is not the affected adapter, so these results do not prove the HD 530 now matches. Could you re-run the test on the HD 530 and tell us whether the pixels now agree?

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7161365450 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7161365450). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:41:07Z. --- Thank you @legacy-code-archaeologist: the 4-DWORD readback on the HD 530 (`6 1 0 0`) showed that the rectangle-list conversion writes exactly the expected words, so the conversion itself is correct and the Gen9 difference sits in the `vertex_rect` vertex shader of `tests/startup_indirect_draw_indexed.cpp`. Pushed `303634a0`: `vertex_rect` no longer indexes a local array with `SV_VertexID`. The corner sequence 0,1,2,0,2,3 is computed with plain arithmetic (`k = id % 6`, `c = (k < 3) ? k : (k == 3 ? 0 : k - 2)`) and the position is picked with scalar selects. The other vertex shaders in that test and in `tests/rectlist_quad.hlsl` already had no dynamically indexed local arrays. Verification (Windows Server 2025 build 26100, MSVC 14.44.35207, D3D12 WARP, commit `303634a0`): - `--preset dev`: build OK, ctest 42/42 passed (100%), including `startup_indirect_draw_indexed_warp`, `startup_indirect_rectlist_warp`, `rectlist_draw_warp`, `rectlist_topology`. - `--preset release` (`/O2`): build OK, ctest 42/42 passed (100%), same tests. - Linux: `tests/rectlist_topology_check.py` 18 tests OK, `git diff --check` clean. WARP is not the affected adapter, so these results do not prove the HD 530 now matches. Could you re-run the test on the HD 530 and tell us whether the pixels now agree? AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 13:00:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:25:09Z.


I checked the conflict-resolved head 7edfe068 with the combined Windows Release rectangle and mesh lease tests. All six passed on WARP and RTX 4060 Laptop. The independent HD 530 result at 303634a0 also covers the arithmetic-corner fixture change.

The remaining concurrency control is that the two recordings must demonstrably use different scratch resources while both queue submissions can still consume them. The existing two-thread gate releases both submits together, so it verifies their outputs but may miss a build where the driver happens to serialize a shared scratch buffer. A deterministic scratch-identity check with a deliberately shared negative would satisfy this part of the existing review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162346211 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#issuecomment-7162346211). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T12:25:09Z. --- I checked the conflict-resolved head `7edfe068` with the combined Windows Release rectangle and mesh lease tests. All six passed on WARP and RTX 4060 Laptop. The independent HD 530 result at `303634a0` also covers the arithmetic-corner fixture change. The remaining concurrency control is that the two recordings must demonstrably use different scratch resources while both queue submissions can still consume them. The existing two-thread gate releases both submits together, so it verifies their outputs but may miss a build where the driver happens to serialize a shared scratch buffer. A deterministic scratch-identity check with a deliberately shared negative would satisfy this part of the existing review.
upstream-sync closed this pull request 2026-11-25 14:04:42 +00:00
R0Y00 commented 2026-11-25 14:04:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T13:10:43Z.

Review: APPROVED


Re-reviewed 6a2c0442 against the original change request. The fixture rejects a deliberately shared scratch resource before either queue submits. The isolated scratch path preserves the one- and two-rectangle readbacks. The live desktop compute SRV now stays protected across both a repeated root binding and a guest root call that is not forwarded. Both draws were refused and the next compute dispatch read the preserved SRV word.

The conflict resolution keeps the rooted Dispatch checks and the #2332 argument lease. Windows Release passed all 10 selected rectangle, root-SRV lease and indirect argument lease cases on WARP and RTX 4060 Laptop.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058218414 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2173#pullrequestreview-6058218414). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T13:10:43Z. **Review:** APPROVED --- Re-reviewed 6a2c0442 against the original change request. The fixture rejects a deliberately shared scratch resource before either queue submits. The isolated scratch path preserves the one- and two-rectangle readbacks. The live desktop compute SRV now stays protected across both a repeated root binding and a guest root call that is not forwarded. Both draws were refused and the next compute dispatch read the preserved SRV word. The conflict resolution keeps the rooted Dispatch checks and the #2332 argument lease. Windows Release passed all 10 selected rectangle, root-SRV lease and indirect argument lease cases on WARP and RTX 4060 Laptop.
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!2165
No description provided.