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

Open
Decodere wants to merge 1 commit from upstream-pr/2621 into main
Decodere commented 2026-11-26 02:45:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T02:45:08Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:5503050938 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T02:45:08Z. --- **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.
DarkPanda69 commented 2026-11-26 03:06:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T03:05:50Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7181391713 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7181391713). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-26T03:05:50Z. --- **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.
luckyteagirl commented 2026-11-26 04:51:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T04:51:40Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ivall/xcl:review:6068718721 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#pullrequestreview-6068718721). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T04:51:40Z. **Review:** COMMENTED --- 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.
luckyteagirl commented 2026-11-26 05:52:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:52:28Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ivall/xcl:review:6069177261 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#pullrequestreview-6069177261). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:52:28Z. **Review:** COMMENTED --- 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.
Decodere commented 2026-11-26 07:03:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T06:18:05Z.


@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).
<!-- greyfinch-sync:ivall/xcl:comment:7184293646 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7184293646). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T06:18:05Z. --- @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).
Aniseto commented 2026-11-26 07:03:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T06:54:05Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7184894729 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7184894729). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-26T06:54:05Z. --- 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.
DavidM1911 commented 2026-11-26 09:07:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T08:29:24Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7186655802 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7186655802). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T08:29:24Z. --- 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
Foniass commented 2026-12-01 08:29:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:29:49Z.


Triage (#1607) – head aad6434

Part of this PR is on main. Commit a076293 ("preserve extended rasterizer stream state", adapted from this PR) adds StreamPipeline::GraphicsStream, rewrite_graphics_stream, translated_graphics_stream and known_subobjects_checked, and 5fb5791 adds driver-blob caching for those streams.
Main only routes RASTERIZER1/2 there, for a fractional depth bias or a non-aliased line mode (stream_needs_extended_rasterizer).
The rest of this PR is not on main:

  • DEPTH_STENCIL1/2 depth bounds and asymmetric stencil masks;
  • VIEW_INSTANCING (main's own_stream still refuses a non-zero subobject 22);
  • the cacheable flag on translated_graphics_pso.
    Please rebase onto main's path with only those parts.
    Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305394510 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2621#issuecomment-7305394510). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:29:49Z. --- **Triage (#1607)** – head aad6434 Part of this PR is on main. Commit a076293 ("preserve extended rasterizer stream state", adapted from this PR) adds `StreamPipeline::GraphicsStream`, `rewrite_graphics_stream`, `translated_graphics_stream` and `known_subobjects_checked`, and 5fb5791 adds driver-blob caching for those streams. Main only routes RASTERIZER1/2 there, for a fractional depth bias or a non-aliased line mode (`stream_needs_extended_rasterizer`). The rest of this PR is not on main: - DEPTH_STENCIL1/2 depth bounds and asymmetric stencil masks; - VIEW_INSTANCING (main's `own_stream` still refuses a non-zero subobject 22); - the `cacheable` flag on `translated_graphics_pso`. Please rebase onto main's path with only those parts. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2621:upstream-pr/2621'
git switch 'upstream-pr/2621'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2621'
git switch 'upstream-pr/2621'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2621'
git switch 'upstream-pr/2621'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2621'
git switch 'main'
git merge --squash 'upstream-pr/2621'
git switch 'main'
git merge --ff-only 'upstream-pr/2621'
git switch 'main'
git merge 'upstream-pr/2621'
git push origin 'main'
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
xcl-dev/xcl!2611
No description provided.