d3d12_xs: skip compute pipelines quietly in the rect-list path #324

Closed
github-bot wants to merge 3 commits from gh-pr/324/head into gh-pr/324/base
Owner

@⁠GDAgent on GitHub · 2026-11-23 19:02 UTC · original
GDAgent:fix/d3d12-rectlist-skip-compute-pso → main · +401 −26 · 7 files · 3 commits · closed without merging

Builds on #280 (rect-list pipelines from PSO streams). This branch carries #280's two commits (5441680, 025cc11); only the third commit (09ecfe5) belongs to this PR. Once #280 lands I will rebase onto main; until then please review the last commit only (git diff 025cc11..).

What

d3d12_xs: cl2_state.rs (apply_rect), with two small lookups in device_x.rs and pso_async.rs. No exports change.

A title can bind a compute pipeline on a graphics command list while the primitive topology is still 17 (rect list). apply_rect then treated the PSO as a graphics pipeline, found neither a recorded PC description nor a pipeline stream, and logged an "unknown pipeline" refusal. A compute pipeline draws nothing, so there is nothing to expand and nothing to warn about.

  • apply_rect returns without a refusal when the PSO is a known compute pipeline: one registered through device_x::register_compute (CreateComputePSO_X, the PC compute entry point that forwards to it, deserialised and derived compute PSOs) or a pso_async compute placeholder handle.
  • A PSO that is neither a known graphics nor a known compute pipeline is still refused and logged, as before.
  • device_x::is_compute and pso_async::is_compute_placeholder are the two lookups; rectlist::was_refused is #[cfg(test)] only.

Why

Evidence from DRED-marked runs of The Matrix Awakens (Xbox Series X build), native Windows 11 on an RDNA2 GPU (gfx1032): two runs logged 26 and 35 unknown-pipeline refusals. With TOMBOX_DRED=2 each refusal line was extended locally with the PSO's shader hashes, and every one of them was vs 0, ps 0, cs <non-zero>: all compute pipelines. The refusals were only logged; nothing was drawn wrongly because of them.

Tests

  • New WARP test warp_rectlist_compute_pso_bound_under_topology_17_is_skipped_quietly (ignored by default like the other rect-list tests): binds a registered compute PSO and an unregistered one under topology 17, checks that only the unregistered one is refused, then draws a graphics rect on the same list and checks all four corners. With the new match arm removed it fails with "registered compute PSO ... was reported as an unknown rect-list pipeline".
  • cargo test -p d3d12_xs --lib warp_rectlist -- --ignored: 3 passed, 0 failed.
  • cargo test -p d3d12_xs --lib -- --test-threads=1 (TOMBOX_REMOVED_EXIT_MS=off): 661 passed, 4 failed, 73 ignored. The four failures are not touched by this PR and also fail on main on this GPU (placement tests: see the separate PR; fixture test: no console DLL): alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement, placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap, title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes (placement tests that fail on an RDNA2 GPU; separate PR), and xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs (needs a console d3d12_xs.dll fixture). dred::tests::report_is_one_shot_and_needs_an_armed_device passes when run on its own without TOMBOX_REMOVED_EXIT_MS.
  • pr_gate.py --base 025cc11 (the head of #280): 0 problems (5 files checked).
  • Native Windows 11; not run under Proton.

Not verified

  • The pso_async placeholder lookup has no dedicated test (it needs the async PSO machinery); it reads the kind of the existing placeholder map.
  • Not run in a title with this change. The refusals were only logged, so the effect is on log output, not rendering.
  • Not rebased onto current main: the branch stays on the base of #280 so that the stack is exactly #280 plus one commit.
**@⁠GDAgent** on GitHub · 2026-11-23 19:02 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/324) `GDAgent:fix/d3d12-rectlist-skip-compute-pso` → `main` · +401 −26 · 7 files · 3 commits · closed without merging Builds on #280 (rect-list pipelines from PSO streams). This branch carries #280's two commits (`5441680`, `025cc11`); only the third commit (`09ecfe5`) belongs to this PR. Once #280 lands I will rebase onto `main`; until then please review the last commit only (`git diff 025cc11..`). ## What `d3d12_xs`: `cl2_state.rs` (`apply_rect`), with two small lookups in `device_x.rs` and `pso_async.rs`. No exports change. A title can bind a compute pipeline on a graphics command list while the primitive topology is still 17 (rect list). `apply_rect` then treated the PSO as a graphics pipeline, found neither a recorded PC description nor a pipeline stream, and logged an "unknown pipeline" refusal. A compute pipeline draws nothing, so there is nothing to expand and nothing to warn about. - `apply_rect` returns without a refusal when the PSO is a known compute pipeline: one registered through `device_x::register_compute` (`CreateComputePSO_X`, the PC compute entry point that forwards to it, deserialised and derived compute PSOs) or a `pso_async` compute placeholder handle. - A PSO that is neither a known graphics nor a known compute pipeline is still refused and logged, as before. - `device_x::is_compute` and `pso_async::is_compute_placeholder` are the two lookups; `rectlist::was_refused` is `#[cfg(test)]` only. ## Why Evidence from DRED-marked runs of The Matrix Awakens (Xbox Series X build), native Windows 11 on an RDNA2 GPU (gfx1032): two runs logged 26 and 35 unknown-pipeline refusals. With `TOMBOX_DRED=2` each refusal line was extended locally with the PSO's shader hashes, and every one of them was `vs 0, ps 0, cs <non-zero>`: all compute pipelines. The refusals were only logged; nothing was drawn wrongly because of them. ## Tests - New WARP test `warp_rectlist_compute_pso_bound_under_topology_17_is_skipped_quietly` (ignored by default like the other rect-list tests): binds a registered compute PSO and an unregistered one under topology 17, checks that only the unregistered one is refused, then draws a graphics rect on the same list and checks all four corners. With the new match arm removed it fails with "registered compute PSO ... was reported as an unknown rect-list pipeline". - `cargo test -p d3d12_xs --lib warp_rectlist -- --ignored`: 3 passed, 0 failed. - `cargo test -p d3d12_xs --lib -- --test-threads=1` (`TOMBOX_REMOVED_EXIT_MS=off`): 661 passed, 4 failed, 73 ignored. The four failures are not touched by this PR and also fail on `main` on this GPU (placement tests: see the separate PR; fixture test: no console DLL): `alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement`, `placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap`, `title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes` (placement tests that fail on an RDNA2 GPU; separate PR), and `xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs` (needs a console `d3d12_xs.dll` fixture). `dred::tests::report_is_one_shot_and_needs_an_armed_device` passes when run on its own without `TOMBOX_REMOVED_EXIT_MS`. - `pr_gate.py --base 025cc11` (the head of #280): 0 problems (5 files checked). - Native Windows 11; not run under Proton. ## Not verified - The `pso_async` placeholder lookup has no dedicated test (it needs the async PSO machinery); it reads the `kind` of the existing placeholder map. - Not run in a title with this change. The refusals were only logged, so the effect is on log output, not rendering. - Not rebased onto current `main`: the branch stays on the base of #280 so that the stack is exactly #280 plus one commit.
Console PSO streams for rect-list pipelines carry PRIMITIVE_TOPOLOGY
type 0x13. The PC runtime only accepts types 1..4, so these pipelines
were created with a type it rejects.

Evidence:
- The console debug D3D12 driver (xgs12_10d.dll 10.0.22000.3160)
  validates CreateGraphicsPipelineState topology types for non-mesh
  pipelines with "t <= 0x20 && bit t of 0x1_0008_001E" (RVA
  0x7b16b..0x7b185, message 674 "Invalid primitive topology type."):
  besides 1..4 it accepts 0x13 and 0x20. Its IASetPrimitiveTopology
  accepts the extra IA topologies 17..20, which its table at RVA
  0x231960 sends to the hardware primitive types 0x11 (RECTLIST),
  0x12 (LINELOOP), 0x13 (QUADLIST) and 0x14 (QUADSTRIP).
- In The Matrix Awakens (Xbox Series X build) a logging run saw stream
  PSOs of console type 0x3 (44), 0x13 (27), 0x1 (2) and 0x2 (1); the
  title set IA topologies 4, 5, 1 and 17 (never 19 or 20), and 24 of
  the 30 PSOs that RECTLIST (17) draws were issued with were console
  type 0x13 (the other 6 were not stream-built, so their type was not
  logged).

So type 0x13 is the rect-list pipeline type. translate_stream now
rewrites it to TRIANGLE (3) in streams without a mesh shader, the type
the existing RECTLIST expansion also gives its pipelines, and logs the
first eight rewrites. Mesh streams keep the PSV0-derived topology
(#176). Type 0x20 is accepted by the console validator too, but no
title use of it has been seen, so it is passed through unchanged.

Test: mesh_pso tests cover 0x13 (rewritten to 3) and 0x20, 2 and 4
(unchanged) in a VS/PS stream.
A rect-list draw (topology 17) is expanded by binding a variant of the
current pipeline with a generated geometry shader that emits the fourth
corner. Until now only pipelines created from a
D3D12_GRAPHICS_PIPELINE_STATE_DESC had a recorded description to build
that variant from. Pipelines created through CreatePipelineState (a
subobject stream) were refused with "no recorded PC description", so each
rect drew only its first triangle.

The stream of every pipeline is already kept by dbcount::note_stream_pso.
rectlist::expand_stream builds the variant from it: the same refusal rules
as the desc path (no vertex shader, an existing GS/HS/DS, stream output,
non-triangle topology type), plus mesh pipelines and view instancing; the
GS subobject is filled or appended, the primitive topology type subobject
is set to TRIANGLE (or appended), and a cached pipeline blob is cleared
because it cannot match the new pipeline. cl2_state binds the variant when
topology 17 is set or a stream-built graphics pipeline is set while it is
active, and rebinds the original pipeline when the topology changes.
Setting a stream-built graphics pipeline now also clears the
"variant bound" flag, as setting a desc-built one already did.

Occlusion counting replays (dbcount) of a rect draw on a stream-built
pipeline now get the rect expansion in their stream variants too.

Tests: CPU tests for the stream refusals and the subobject edits; the WARP
rect-list test now runs its draw checks (Draw, DrawIndexed with
perspective, pipeline set after the topology, RSSetDepthBiasX, rect then
triangle list) against a stream-built pipeline as well. That test fails
without this change and passes with it.
A title can bind a compute pipeline on a graphics command list while
the primitive topology is still 17 (rect list). The rect-list path then
looked the PSO up as a graphics pipeline, found neither a recorded PC
description nor a pipeline stream, and logged it as an "unknown
pipeline" refusal. Compute pipelines draw nothing, so there is nothing
to expand.

apply_rect now returns without a refusal when the PSO is a compute
pipeline: either one registered by CreateComputePSO_X (and the other
paths that call device_x::register_compute) or a pso_async compute
placeholder. A PSO that is neither graphics nor known compute is still
refused and logged as before.

Seen in The Matrix Awakens (native Windows 11, RDNA2): two runs with
DRED markers logged 26 and 35 unknown-pipeline refusals, and every one
of them carried only a compute shader hash (vs 0, ps 0, cs non-zero).

Test: warp_rectlist_compute_pso_bound_under_topology_17_is_skipped_quietly
(WARP, ignored by default) binds a registered compute PSO and an
unregistered one under topology 17, checks that only the unregistered
one is refused, then checks that a graphics rect drawn afterwards on
the same list still covers all four corners. With the new match arm
removed the test fails ("registered compute PSO ... was reported as an
unknown rect-list pipeline").
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:18:49 +00:00
github-bot closed this pull request 2026-11-26 06:18:49 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:49 UTC · original

Applied on main in 56944cf (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:49 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/324#issuecomment-7164350135) Applied on main in 56944cf (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.