D3D12.X: preserve extended state in translated graphics PSO streams #2621

Open
github-bot wants to merge 1 commit from github-bot/gh-2621 into main AGit
Owner

@⁠Decodere on GitHub · 2026-11-26 02:45 UTC · original
Decodere:fix-extended-graphics-pso-streams-2606 → main · +469 −49 · 1 files · 1 commits · open

What is in it

Preserves extended pipeline state in translated D3D12.X graphics pipeline state streams instead of silently downgrading them to legacy D3D12_GRAPHICS_PIPELINE_STATE_DESC (crates/xcl/src/hle/d3d12x/real.rs):

  1. Unknown-suffix detection & uncacheable prefix handling: refactors known_subobjects into known_subobjects_checked(buf) -> (Vec<(u32, &[u8])>, bool) to report unknown trailing subobjects or truncated tails, and threads cacheable: bool through StreamPipeline::Graphics(Box<D3D12_GRAPHICS_PIPELINE_STATE_DESC>, bool) -> graphics_pso -> translated_graphics_pso / translated_graphics_pso_once (including build_graphics_uncacheable for async builds) so streams with unknown suffixes bypass GRAPHICS_BLOBS / driver_cache lookup and storage.
  2. Extended-state classification & faithful legacy projection: adds depth_bias_is_exact_i32, stream_needs_extended_graphics, and StreamPipeline::GraphicsStream:
    • Routes DEPTH_STENCIL1 (DepthBoundsTestEnable), VIEW_INSTANCING (ViewInstanceCount > 0 || Flags != 0), DEPTH_STENCIL2 (DepthBoundsTestEnable or distinct front/back stencil read/write masks), RASTERIZER1 (non-exact-i32 DepthBias), and RASTERIZER2 (non-exact-i32 DepthBias or LineRasterizationMode != ALIASED) to StreamPipeline::GraphicsStream, while keeping console GS streams on StreamPipeline::Graphics so translated_gs_pso continues handling them.
    • Splits 27 (RASTERIZER1) and 28 (RASTERIZER2) in stream_pipeline so faithfully representable streams keep MultisampleEnable, AntialiasedLineEnable, ForcedSampleCount, and ConservativeRaster on RASTERIZER1, and ForcedSampleCount / ConservativeRaster on RASTERIZER2.
  3. Native translated graphics stream path: adds rewrite_graphics_stream and translated_graphics_stream (wired into dev_create_pipeline_state and build_stream) to translate console VS/PS (and rect-list GS with single retry without GS on refusal), map console RTV/DSV formats, sanitize integer RT blending, map console topology (RECT_LIST_TYPE / out-of-range -> TRIANGLE or PATCH), strip CACHED_PSO, apply XCL_DEBUG_NO_STENCIL / XCL_DEBUG_NO_CULL (including synthesizing a default RASTERIZER subobject with CullMode = NONE when no_cull is set on a stream that omits rasterizer types 10/27/28), preserve extended subobjects verbatim, and submit via native CreatePipelineState without letting console bytecode reach the driver or polluting GRAPHICS_BLOBS / driver_cache.
  4. Async ownership for VIEW_INSTANCING streams: extends OwnedDesc::Stream and own_stream to copy D3D12_VIEW_INSTANCE_LOCATION arrays into dedicated owned storage (Vec<Vec<D3D12_VIEW_INSTANCE_LOCATION>>, keeping shaders_key unchanged), rebasing pViewInstanceLocations (or clearing it when ViewInstanceCount == 0) and rejecting null/unreadable location pointers so cold-miss VIEW_INSTANCING graphics streams can queue onto the async PSO worker instead of falling back synchronously.
  5. Tests:
    • stream_pipeline_extended_classification_and_rewrite: covers faithfully representable legacy streams, all extended-state routing cases + console GS exception, verbatim rewrite_graphics_stream output, no_stencil/no_cull overrides on existing DS2/R2 and default RASTERIZER emission when rasterizer is omitted, and unknown trailing subobject uncacheability.
    • translated_graphics_stream_creates_native_d3d12_extended_pipelines: translates a minimal console VS container and submits rewritten VIEW_INSTANCING, DEPTH_STENCIL1, DEPTH_STENCIL2, and RASTERIZER1 streams to ID3D12Device2::CreatePipelineState.
    • own_stream_rejects_null_truncated_and_unreadable_streams: additionally verifies own_stream rejects null/unreadable VIEW_INSTANCING pointers, clears stale pointers on ViewInstanceCount == 0, and copies a 2-location array into owned storage that survives clobbering and dropping the caller's original array and stream buffer without altering shaders_key.

Part of #2606
Part of #2508
Part of #1833

Tested

  • Failing-first check on unmodified origin/main (b49be183) with stream_pipeline_extended_state_not_downgraded: 0 passed, 1 failed (RASTERIZER1 MultisampleEnable lost and VIEW_INSTANCING downgraded to StreamPipeline::Graphics).
  • Post-fix targeted debug tests on WARP (XCL_ADAPTER=warp, XCL_WARP=1, cargo test -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture): 62 passed, 0 failed, 0 ignored, 0 skipped.
  • Post-fix targeted release tests on WARP (XCL_ADAPTER=warp, XCL_WARP=1, cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture): 62 passed, 0 failed, 0 ignored, 0 skipped.
  • Post-fix targeted release tests on NVIDIA GeForce RTX 4060 (cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture): 62 passed, 0 failed, 0 ignored, 0 skipped.
  • Full release workspace on NVIDIA GeForce RTX 4060 (cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture): 37 test binaries (36 compiled + 1 doc-test), 1437 passed, 0 failed, 47 ignored, 29 SKIPPED lines:
    • 21 no wave64 on wave32-only RTX 4060 (dispatch_chain_native_wave64_builds_whole, 4 in gpu::recomp::lower, 14 in gpu::recomp::lower_dxil, 2 in gpu::recomp::tests)
    • 3 per-lane form: refused in gpu::recomp::lower_dxil (f16 arithmetic, f16 packed, f32 conversions on wave32)
    • 3 D3D12 debug layer unavailable (no d3d12SDKLayers.dll x2, uploads_start_from_each_subresources_state)
    • 1 cannot disable the driver cache (shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)
    • 1 no heap windows (heap_window_out_of_memory_falls_back_to_the_switch_form)

Regression run

Paired 60-second smoke runs on NVIDIA GeForce RTX 4060 against origin/main ancestor (889ef3e8aa7f267323ab4879e735e65da6bcef10, ancestor of b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):

PR head:

xcl-smoke v1
commit: aad6434c1c6a77e12d5e1e21874f184ac943f4ae
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 10755 MB

Base (origin/main ancestor):

xcl-smoke v1
commit: 889ef3e8aa7f267323ab4879e735e65da6bcef10
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1550 (PresentX 1550)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13981 MB

Both runs exit 0x0 with steady 61 60 60 / 60 60 60 presents per 2 s, 0 device removals, and 0 crashes (1611 vs 1550 frames, 103.9%; peak commit 10755 MB vs 13981 MB).

Not tested

  • Native wave64 GPU hardware tests (RTX 4060 is wave32-only; 21 wave64 GPU tests skipped).
  • D3D12 debug-layer tests (d3d12SDKLayers.dll is not installed on this host; 3 tests skipped).
  • Extended graphics stream caching (GRAPHICS_BLOBS / driver_cache intentionally bypassed for extended streams and streams with unknown trailing subobjects).
  • Extended graphics streams with console HS/DS (refused with E_INVALIDARG so console bytecode never reaches the driver) or console GS (kept on StreamPipeline::Graphics -> translated_gs_pso).
  • The 47 #[ignore] tests.

AI use

Written and verified with Google Antigravity (Gemini 4 Neon). Every change in real.rs, the failing-first reproducer, the debug/release WARP, RTX 4060, and full workspace test runs, and the paired 60 s smoke runs were verified locally.

**@⁠Decodere** on GitHub · 2026-11-26 02:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621) `Decodere:fix-extended-graphics-pso-streams-2606` → `main` · +469 −49 · 1 files · 1 commits · open **What is in it** Preserves extended pipeline state in translated D3D12.X graphics pipeline state streams instead of silently downgrading them to legacy `D3D12_GRAPHICS_PIPELINE_STATE_DESC` (`crates/xcl/src/hle/d3d12x/real.rs`): 1. **Unknown-suffix detection & uncacheable prefix handling:** refactors `known_subobjects` into `known_subobjects_checked(buf) -> (Vec<(u32, &[u8])>, bool)` to report unknown trailing subobjects or truncated tails, and threads `cacheable: bool` through `StreamPipeline::Graphics(Box<D3D12_GRAPHICS_PIPELINE_STATE_DESC>, bool)` -> `graphics_pso` -> `translated_graphics_pso` / `translated_graphics_pso_once` (including `build_graphics_uncacheable` for async builds) so streams with unknown suffixes bypass `GRAPHICS_BLOBS` / `driver_cache` lookup and storage. 2. **Extended-state classification & faithful legacy projection:** adds `depth_bias_is_exact_i32`, `stream_needs_extended_graphics`, and `StreamPipeline::GraphicsStream`: - Routes `DEPTH_STENCIL1` (`DepthBoundsTestEnable`), `VIEW_INSTANCING` (`ViewInstanceCount > 0 || Flags != 0`), `DEPTH_STENCIL2` (`DepthBoundsTestEnable` or distinct front/back stencil read/write masks), `RASTERIZER1` (non-exact-i32 `DepthBias`), and `RASTERIZER2` (non-exact-i32 `DepthBias` or `LineRasterizationMode != ALIASED`) to `StreamPipeline::GraphicsStream`, while keeping console `GS` streams on `StreamPipeline::Graphics` so `translated_gs_pso` continues handling them. - Splits `27` (`RASTERIZER1`) and `28` (`RASTERIZER2`) in `stream_pipeline` so faithfully representable streams keep `MultisampleEnable`, `AntialiasedLineEnable`, `ForcedSampleCount`, and `ConservativeRaster` on `RASTERIZER1`, and `ForcedSampleCount` / `ConservativeRaster` on `RASTERIZER2`. 3. **Native translated graphics stream path:** adds `rewrite_graphics_stream` and `translated_graphics_stream` (wired into `dev_create_pipeline_state` and `build_stream`) to translate console VS/PS (and rect-list GS with single retry without GS on refusal), map console RTV/DSV formats, sanitize integer RT blending, map console topology (`RECT_LIST_TYPE` / out-of-range -> `TRIANGLE` or `PATCH`), strip `CACHED_PSO`, apply `XCL_DEBUG_NO_STENCIL` / `XCL_DEBUG_NO_CULL` (including synthesizing a default `RASTERIZER` subobject with `CullMode = NONE` when `no_cull` is set on a stream that omits rasterizer types `10`/`27`/`28`), preserve extended subobjects verbatim, and submit via native `CreatePipelineState` without letting console bytecode reach the driver or polluting `GRAPHICS_BLOBS` / `driver_cache`. 4. **Async ownership for `VIEW_INSTANCING` streams:** extends `OwnedDesc::Stream` and `own_stream` to copy `D3D12_VIEW_INSTANCE_LOCATION` arrays into dedicated owned storage (`Vec<Vec<D3D12_VIEW_INSTANCE_LOCATION>>`, keeping `shaders_key` unchanged), rebasing `pViewInstanceLocations` (or clearing it when `ViewInstanceCount == 0`) and rejecting null/unreadable location pointers so cold-miss `VIEW_INSTANCING` graphics streams can queue onto the async PSO worker instead of falling back synchronously. 5. **Tests:** - `stream_pipeline_extended_classification_and_rewrite`: covers faithfully representable legacy streams, all extended-state routing cases + console GS exception, verbatim `rewrite_graphics_stream` output, `no_stencil`/`no_cull` overrides on existing `DS2`/`R2` and default `RASTERIZER` emission when rasterizer is omitted, and unknown trailing subobject uncacheability. - `translated_graphics_stream_creates_native_d3d12_extended_pipelines`: translates a minimal console VS container and submits rewritten `VIEW_INSTANCING`, `DEPTH_STENCIL1`, `DEPTH_STENCIL2`, and `RASTERIZER1` streams to `ID3D12Device2::CreatePipelineState`. - `own_stream_rejects_null_truncated_and_unreadable_streams`: additionally verifies `own_stream` rejects null/unreadable `VIEW_INSTANCING` pointers, clears stale pointers on `ViewInstanceCount == 0`, and copies a 2-location array into owned storage that survives clobbering and dropping the caller's original array and stream buffer without altering `shaders_key`. Part of #2606 Part of #2508 Part of #1833 **Tested** - Failing-first check on unmodified `origin/main` (`b49be183`) with `stream_pipeline_extended_state_not_downgraded`: 0 passed, 1 failed (`RASTERIZER1 MultisampleEnable lost` and `VIEW_INSTANCING` downgraded to `StreamPipeline::Graphics`). - Post-fix targeted debug tests on WARP (`XCL_ADAPTER=warp`, `XCL_WARP=1`, `cargo test -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture`): 62 passed, 0 failed, 0 ignored, 0 skipped. - Post-fix targeted release tests on WARP (`XCL_ADAPTER=warp`, `XCL_WARP=1`, `cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture`): 62 passed, 0 failed, 0 ignored, 0 skipped. - Post-fix targeted release tests on NVIDIA GeForce RTX 4060 (`cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture`): 62 passed, 0 failed, 0 ignored, 0 skipped. - Full release workspace on NVIDIA GeForce RTX 4060 (`cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture`): 37 test binaries (36 compiled + 1 doc-test), 1437 passed, 0 failed, 47 ignored, 29 `SKIPPED` lines: - 21 `no wave64` on wave32-only RTX 4060 (`dispatch_chain_native_wave64_builds_whole`, 4 in `gpu::recomp::lower`, 14 in `gpu::recomp::lower_dxil`, 2 in `gpu::recomp::tests`) - 3 `per-lane form: refused` in `gpu::recomp::lower_dxil` (f16 arithmetic, f16 packed, f32 conversions on wave32) - 3 D3D12 debug layer unavailable (`no d3d12SDKLayers.dll` x2, `uploads_start_from_each_subresources_state`) - 1 `cannot disable the driver cache` (`shaders::tests::pso_measurement_compiles_an_exact_synthetic_record`) - 1 `no heap windows` (`heap_window_out_of_memory_falls_back_to_the_switch_form`) **Regression run** Paired 60-second smoke runs on NVIDIA GeForce RTX 4060 against `origin/main` ancestor (`889ef3e8aa7f267323ab4879e735e65da6bcef10`, ancestor of `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`): PR head: ``` xcl-smoke v1 commit: aad6434c1c6a77e12d5e1e21874f184ac943f4ae gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1611 (PresentX 1611) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 10755 MB ``` Base (`origin/main` ancestor): ``` xcl-smoke v1 commit: 889ef3e8aa7f267323ab4879e735e65da6bcef10 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1550 (PresentX 1550) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13981 MB ``` Both runs exit `0x0` with steady `61 60 60` / `60 60 60` presents per 2 s, 0 device removals, and 0 crashes (1611 vs 1550 frames, 103.9%; peak commit 10755 MB vs 13981 MB). **Not tested** - Native wave64 GPU hardware tests (RTX 4060 is wave32-only; 21 wave64 GPU tests skipped). - D3D12 debug-layer tests (`d3d12SDKLayers.dll` is not installed on this host; 3 tests skipped). - Extended graphics stream caching (`GRAPHICS_BLOBS` / `driver_cache` intentionally bypassed for extended streams and streams with unknown trailing subobjects). - Extended graphics streams with console `HS`/`DS` (refused with `E_INVALIDARG` so console bytecode never reaches the driver) or console `GS` (kept on `StreamPipeline::Graphics` -> `translated_gs_pso`). - The 47 `#[ignore]` tests. **AI use** Written and verified with Google Antigravity (Gemini 4 Neon). Every change in `real.rs`, the failing-first reproducer, the debug/release WARP, RTX 4060, and full workspace test runs, and the paired 60 s smoke runs were verified locally.
Keep graphics pipeline state streams carrying extended state that cannot be faithfully represented in `D3D12_GRAPHICS_PIPELINE_STATE_DESC` on the native `CreatePipelineState` stream path instead of downgrading them:

- Add `known_subobjects_checked` to report unknown trailing subobjects or truncated tails, and thread `cacheable: bool` through `StreamPipeline::Graphics(_, cacheable)` -> `graphics_pso` -> `translated_graphics_pso` so streams with unknown suffixes bypass `GRAPHICS_BLOBS` / `driver_cache` lookup and storage.
- Add `stream_needs_extended_graphics` classifying `DEPTH_STENCIL1` (`DepthBoundsTestEnable`), `VIEW_INSTANCING` (`ViewInstanceCount > 0 || Flags != 0`), `DEPTH_STENCIL2` (`DepthBoundsTestEnable` or distinct front/back stencil masks), `RASTERIZER1` (non-exact-i32 `DepthBias`), and `RASTERIZER2` (non-exact-i32 `DepthBias` or non-aliased `LineRasterizationMode`) as `StreamPipeline::GraphicsStream` (while keeping console `GS` on `StreamPipeline::Graphics` for `translated_gs_pso`).
- Preserve `MultisampleEnable`, `AntialiasedLineEnable`, `ForcedSampleCount`, and `ConservativeRaster` on the legacy projection for `RASTERIZER1`, and `ForcedSampleCount` / `ConservativeRaster` for `RASTERIZER2`.
- Add `rewrite_graphics_stream` and `translated_graphics_stream` (wired into `dev_create_pipeline_state` and `build_stream`) to translate console VS/PS (and rect-list GS with single retry on refusal), map console RTV/DSV formats, sanitize integer RT blending, map console topology, strip `CACHED_PSO`, preserve extended subobjects verbatim, and submit via native `CreatePipelineState` without letting console bytecode reach the driver or polluting `GRAPHICS_BLOBS` / `driver_cache`.

Part of #2606
Part of #2508
Part of #1833
Assisted-by: Google Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:35:03 +00:00
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 03:05 UTC · original · edited 2026-11-26 06:30 UTC

Update for head aad6434: rerun on main b49be18, same cards and --nocapture. translated_graphics_stream_creates_native_d3d12_extended_pipelines is ok on the RX 9070 XT, with no SKIPPED. d3d12x:: gives 256 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060.

AMD RDNA4 run, plus an RTX 3060: the new pipeline test passes on an RX 9070 XT, and the d3d12x:: tests pass on both cards.

Head 211fc6b applied on main b49be18, debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER, run with --nocapture:

  • translated_graphics_stream_creates_native_d3d12_extended_pipelines: ok on the RX 9070 XT (RDNA4, driver 32.0.32029.2010), no SKIPPED. The test makes its device on the default adapter, which is the RX 9070 XT here, so its extended-state pipelines were created by the AMD driver.
  • cargo test -p xcl --lib -- d3d12x::: 256 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060 (driver 32.0.16.1088).

This change is in real.rs's graphics PSO streams, so I did not run the wave64 gpu:: suite for it.

Not tested: the new pipeline test on the RTX 3060 (it uses the default adapter), the D3D12 debug-layer tests (no d3d12SDKLayers.dll here either), a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-26 03:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7181391713) · edited 2026-11-26 06:30 UTC **Update for head `aad6434`:** rerun on `main` `b49be18`, same cards and `--nocapture`. `translated_graphics_stream_creates_native_d3d12_extended_pipelines` is ok on the RX 9070 XT, with no SKIPPED. `d3d12x::` gives 256 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060. AMD RDNA4 run, plus an RTX 3060: the new pipeline test passes on an RX 9070 XT, and the `d3d12x::` tests pass on both cards. Head `211fc6b` applied on `main` `b49be18`, debug, Windows 11 Pro 26200, card chosen with `XCL_ADAPTER`, run with `--nocapture`: - `translated_graphics_stream_creates_native_d3d12_extended_pipelines`: ok on the **RX 9070 XT** (RDNA4, driver 32.0.32029.2010), no SKIPPED. The test makes its device on the default adapter, which is the RX 9070 XT here, so its extended-state pipelines were created by the AMD driver. - `cargo test -p xcl --lib -- d3d12x::`: 256 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the **RTX 3060** (driver 32.0.16.1088). This change is in `real.rs`'s graphics PSO streams, so I did not run the wave64 `gpu::` suite for it. Not tested: the new pipeline test on the RTX 3060 (it uses the default adapter), the D3D12 debug-layer tests (no `d3d12SDKLayers.dll` here either), a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠Decodere on GitHub · 2026-11-26 06:18 UTC · original

@⁠luckyteagirl Good catches on both points — pushed aad6434c addressing both:

  1. XCL_DEBUG_NO_CULL without a rasterizer subobject: rewrite_graphics_stream now tracks saw_rasterizer across subobject types 10 | 27 | 28 and emits a default D3D12_RASTERIZER_DESC (FillMode: SOLID, CullMode: NONE, DepthClipEnable: true) when no_cull && !saw_rasterizer. Covered in stream_pipeline_extended_classification_and_rewrite for both existing DS2/R2 overrides and omitted-rasterizer streams.
  2. Async ownership of VIEW_INSTANCING locations: OwnedDesc::Stream now holds a dedicated Vec<Vec<D3D12_VIEW_INSTANCE_LOCATION>> (keeping shaders_key unchanged) and own_stream copies readable pViewInstanceLocations arrays and rebases the subobject pointer (clearing stale pointers when ViewInstanceCount == 0, rejecting null/unreadable pointers when ViewInstanceCount > 0) so cold-miss VIEW_INSTANCING streams queue onto the background PSO worker. Covered in own_stream_rejects_null_truncated_and_unreadable_streams with a 2-location fixture that clobbers and drops the original array and stream buffer before checking the owned stream.
  3. Re-verified debug/release WARP & RTX 4060 hle::d3d12x::real:: (62/0/0), full release workspace (1437/0/47), and paired 60 s RTX 4060 smoke (1611 frames, 61 60 60, 0 removals/crashes).
**@⁠Decodere** on GitHub · 2026-11-26 06:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7184293646) @⁠luckyteagirl Good catches on both points — pushed `aad6434c` addressing both: 1. **`XCL_DEBUG_NO_CULL` without a rasterizer subobject:** `rewrite_graphics_stream` now tracks `saw_rasterizer` across subobject types `10 | 27 | 28` and emits a default `D3D12_RASTERIZER_DESC` (`FillMode: SOLID`, `CullMode: NONE`, `DepthClipEnable: true`) when `no_cull && !saw_rasterizer`. Covered in `stream_pipeline_extended_classification_and_rewrite` for both existing `DS2`/`R2` overrides and omitted-rasterizer streams. 2. **Async ownership of `VIEW_INSTANCING` locations:** `OwnedDesc::Stream` now holds a dedicated `Vec<Vec<D3D12_VIEW_INSTANCE_LOCATION>>` (keeping `shaders_key` unchanged) and `own_stream` copies readable `pViewInstanceLocations` arrays and rebases the subobject pointer (clearing stale pointers when `ViewInstanceCount == 0`, rejecting null/unreadable pointers when `ViewInstanceCount > 0`) so cold-miss `VIEW_INSTANCING` streams queue onto the background PSO worker. Covered in `own_stream_rejects_null_truncated_and_unreadable_streams` with a 2-location fixture that clobbers and drops the original array and stream buffer before checking the owned stream. 3. Re-verified debug/release WARP & RTX 4060 `hle::d3d12x::real::` (`62/0/0`), full release workspace (`1437/0/47`), and paired 60 s RTX 4060 smoke (`1611` frames, `61 60 60`, `0` removals/crashes).
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 04:51 UTC · original · reviewed

For an accepted console graphics stream with VS/PS and VIEW_INSTANCING but no rasterizer subobject, a matching XCL_DEBUG_NO_CULL sets no_cull yet this rewrite only changes existing rasterizer types 10/27/28. It emits no rasterizer override, so D3D12 uses its stream-subobject default, whose CullMode is BACK. The previous path synthesized rasterizer defaults and then set CullMode = NONE for this switch. Could the no-rasterizer/no-cull case emit a default rasterizer with culling disabled, and have a stream rewrite test cover both switch settings? This is source review; I did not run the stream on a GPU.

**@⁠luckyteagirl** on GitHub · 2026-11-26 04:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#pullrequestreview-6068718721) · **reviewed** For an accepted console graphics stream with VS/PS and `VIEW_INSTANCING` but no rasterizer subobject, a matching `XCL_DEBUG_NO_CULL` sets `no_cull` yet this rewrite only changes existing rasterizer types 10/27/28. It emits no rasterizer override, so D3D12 uses its [stream-subobject default](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_pipeline_state_stream_desc), whose [CullMode is BACK](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_rasterizer_desc). The previous path synthesized rasterizer defaults and then set `CullMode = NONE` for this switch. Could the no-rasterizer/no-cull case emit a default rasterizer with culling disabled, and have a stream rewrite test cover both switch settings? This is source review; I did not run the stream on a GPU.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 05:52 UTC · original · reviewed

Can the async path own the view-instance locations? A console VS stream selected as GraphicsStream because ViewInstanceCount > 0 always fails own_stream: its type-22 payload is nonzero and that function returns None. On a cold cache miss, this branch therefore re-enters translated_graphics_stream on the caller's thread instead of queuing the build. The old projected descriptor of a simple console VS could use the background worker. A fixture with two locations that drops the original array after creating an owned stream would exercise the needed pointer ownership. Exact-head source review at 211fc6b7cadbd8650c2e9fdeb2c1e88047a1805a; no measured runtime stall or GPU test. AI-assisted review with Codex.

**@⁠luckyteagirl** on GitHub · 2026-11-26 05:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#pullrequestreview-6069177261) · **reviewed** Can the async path own the view-instance locations? A console VS stream selected as `GraphicsStream` because `ViewInstanceCount > 0` always fails `own_stream`: its type-22 payload is nonzero and that function returns `None`. On a cold cache miss, this branch therefore re-enters `translated_graphics_stream` on the caller's thread instead of queuing the build. The old projected descriptor of a simple console VS could use the background worker. A fixture with two locations that drops the original array after creating an owned stream would exercise the needed pointer ownership. Exact-head source review at `211fc6b7cadbd8650c2e9fdeb2c1e88047a1805a`; no measured runtime stall or GPU test. AI-assisted review with Codex.
github-bot force-pushed github-bot/gh-2621 from 211fc6b7ca to aad6434c1c 2026-11-26 06:35:27 +00:00 Compare
Author
Owner

@⁠Aniseto on GitHub · 2026-11-26 06:54 UTC · original

Ran the translated graphics stream tests at aad6434c:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib hle::d3d12x::real:: -- --test-threads=4
62 passed; 0 failed; 0 ignored; 1276 filtered out      (exit 0)

All three new tests pass here: stream_pipeline_extended_classification_and_rewrite, translated_graphics_stream_creates_native_d3d12_extended_pipelines (which submits VIEW_INSTANCING, DEPTH_STENCIL1, DEPTH_STENCIL2 and RASTERIZER1 streams to the real D3D12 device, reported as backend 'real' - NVIDIA GeForce RTX 5070 Ti) and own_stream_rejects_null_truncated_and_unreadable_streams.

What this adds: the author ran this filter on an RTX 4060 (Ada) and WARP; this is a Blackwell wave32 part with a different driver and DXC version, and the thread has no report from another machine on the current head.

Not tested: the full workspace suite, a paired 60 s smoke run, native wave64 hardware, the D3D12 debug layer, AMD and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-26 06:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7184894729) Ran the translated graphics stream tests at `aad6434c`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib hle::d3d12x::real:: -- --test-threads=4 62 passed; 0 failed; 0 ignored; 1276 filtered out (exit 0) ``` All three new tests pass here: `stream_pipeline_extended_classification_and_rewrite`, `translated_graphics_stream_creates_native_d3d12_extended_pipelines` (which submits VIEW_INSTANCING, DEPTH_STENCIL1, DEPTH_STENCIL2 and RASTERIZER1 streams to the real D3D12 device, reported as `backend 'real' - NVIDIA GeForce RTX 5070 Ti`) and `own_stream_rejects_null_truncated_and_unreadable_streams`. What this adds: the author ran this filter on an RTX 4060 (Ada) and WARP; this is a Blackwell wave32 part with a different driver and DXC version, and the thread has no report from another machine on the current head. Not tested: the full workspace suite, a paired 60 s smoke run, native wave64 hardware, the D3D12 debug layer, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 08:29 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 08:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7186655802) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2621/head:github-bot/gh-2621'
git switch 'github-bot/gh-2621'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2621'
git switch 'github-bot/gh-2621'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2621'
git switch 'github-bot/gh-2621'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2621'
git switch 'main'
git merge --squash 'github-bot/gh-2621'
git switch 'main'
git merge --ff-only 'github-bot/gh-2621'
git switch 'main'
git merge 'github-bot/gh-2621'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.