D3D12.X: preserve extended state in translated graphics PSO streams #2621
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2621
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2621"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Decodere on GitHub · 2026-11-26 02:45 UTC · original
Decodere:fix-extended-graphics-pso-streams-2606→main· +469 −49 · 1 files · 1 commits · openWhat 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):known_subobjectsintoknown_subobjects_checked(buf) -> (Vec<(u32, &[u8])>, bool)to report unknown trailing subobjects or truncated tails, and threadscacheable: boolthroughStreamPipeline::Graphics(Box<D3D12_GRAPHICS_PIPELINE_STATE_DESC>, bool)->graphics_pso->translated_graphics_pso/translated_graphics_pso_once(includingbuild_graphics_uncacheablefor async builds) so streams with unknown suffixes bypassGRAPHICS_BLOBS/driver_cachelookup and storage.depth_bias_is_exact_i32,stream_needs_extended_graphics, andStreamPipeline::GraphicsStream:DEPTH_STENCIL1(DepthBoundsTestEnable),VIEW_INSTANCING(ViewInstanceCount > 0 || Flags != 0),DEPTH_STENCIL2(DepthBoundsTestEnableor distinct front/back stencil read/write masks),RASTERIZER1(non-exact-i32DepthBias), andRASTERIZER2(non-exact-i32DepthBiasorLineRasterizationMode != ALIASED) toStreamPipeline::GraphicsStream, while keeping consoleGSstreams onStreamPipeline::Graphicssotranslated_gs_psocontinues handling them.27(RASTERIZER1) and28(RASTERIZER2) instream_pipelineso faithfully representable streams keepMultisampleEnable,AntialiasedLineEnable,ForcedSampleCount, andConservativeRasteronRASTERIZER1, andForcedSampleCount/ConservativeRasteronRASTERIZER2.rewrite_graphics_streamandtranslated_graphics_stream(wired intodev_create_pipeline_stateandbuild_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 ->TRIANGLEorPATCH), stripCACHED_PSO, applyXCL_DEBUG_NO_STENCIL/XCL_DEBUG_NO_CULL(including synthesizing a defaultRASTERIZERsubobject withCullMode = NONEwhenno_cullis set on a stream that omits rasterizer types10/27/28), preserve extended subobjects verbatim, and submit via nativeCreatePipelineStatewithout letting console bytecode reach the driver or pollutingGRAPHICS_BLOBS/driver_cache.VIEW_INSTANCINGstreams: extendsOwnedDesc::Streamandown_streamto copyD3D12_VIEW_INSTANCE_LOCATIONarrays into dedicated owned storage (Vec<Vec<D3D12_VIEW_INSTANCE_LOCATION>>, keepingshaders_keyunchanged), rebasingpViewInstanceLocations(or clearing it whenViewInstanceCount == 0) and rejecting null/unreadable location pointers so cold-missVIEW_INSTANCINGgraphics streams can queue onto the async PSO worker instead of falling back synchronously.stream_pipeline_extended_classification_and_rewrite: covers faithfully representable legacy streams, all extended-state routing cases + console GS exception, verbatimrewrite_graphics_streamoutput,no_stencil/no_culloverrides on existingDS2/R2and defaultRASTERIZERemission 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 rewrittenVIEW_INSTANCING,DEPTH_STENCIL1,DEPTH_STENCIL2, andRASTERIZER1streams toID3D12Device2::CreatePipelineState.own_stream_rejects_null_truncated_and_unreadable_streams: additionally verifiesown_streamrejects null/unreadableVIEW_INSTANCINGpointers, clears stale pointers onViewInstanceCount == 0, and copies a 2-location array into owned storage that survives clobbering and dropping the caller's original array and stream buffer without alteringshaders_key.Part of #2606
Part of #2508
Part of #1833
Tested
origin/main(b49be183) withstream_pipeline_extended_state_not_downgraded: 0 passed, 1 failed (RASTERIZER1 MultisampleEnable lostandVIEW_INSTANCINGdowngraded toStreamPipeline::Graphics).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.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.cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=4 --nocapture): 62 passed, 0 failed, 0 ignored, 0 skipped.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, 29SKIPPEDlines:no wave64on wave32-only RTX 4060 (dispatch_chain_native_wave64_builds_whole, 4 ingpu::recomp::lower, 14 ingpu::recomp::lower_dxil, 2 ingpu::recomp::tests)per-lane form: refusedingpu::recomp::lower_dxil(f16 arithmetic, f16 packed, f32 conversions on wave32)no d3d12SDKLayers.dllx2,uploads_start_from_each_subresources_state)cannot disable the driver cache(shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)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/mainancestor (889ef3e8aa7f267323ab4879e735e65da6bcef10, ancestor ofb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR head:
Base (
origin/mainancestor):Both runs exit
0x0with steady61 60 60/60 60 60presents per 2 s, 0 device removals, and 0 crashes (1611 vs 1550 frames, 103.9%; peak commit 10755 MB vs 13981 MB).Not tested
d3d12SDKLayers.dllis not installed on this host; 3 tests skipped).GRAPHICS_BLOBS/driver_cacheintentionally bypassed for extended streams and streams with unknown trailing subobjects).HS/DS(refused withE_INVALIDARGso console bytecode never reaches the driver) or consoleGS(kept onStreamPipeline::Graphics->translated_gs_pso).#[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 on GitHub · 2026-11-26 03:05 UTC · original · edited 2026-11-26 06:30 UTC
Update for head
aad6434: rerun onmainb49be18, same cards and--nocapture.translated_graphics_stream_creates_native_d3d12_extended_pipelinesis 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
211fc6bapplied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_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 wave64gpu::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.dllhere either), a title.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@Decodere on GitHub · 2026-11-26 06:18 UTC · original
@luckyteagirl Good catches on both points — pushed
aad6434caddressing both:XCL_DEBUG_NO_CULLwithout a rasterizer subobject:rewrite_graphics_streamnow trackssaw_rasterizeracross subobject types10 | 27 | 28and emits a defaultD3D12_RASTERIZER_DESC(FillMode: SOLID,CullMode: NONE,DepthClipEnable: true) whenno_cull && !saw_rasterizer. Covered instream_pipeline_extended_classification_and_rewritefor both existingDS2/R2overrides and omitted-rasterizer streams.VIEW_INSTANCINGlocations:OwnedDesc::Streamnow holds a dedicatedVec<Vec<D3D12_VIEW_INSTANCE_LOCATION>>(keepingshaders_keyunchanged) andown_streamcopies readablepViewInstanceLocationsarrays and rebases the subobject pointer (clearing stale pointers whenViewInstanceCount == 0, rejecting null/unreadable pointers whenViewInstanceCount > 0) so cold-missVIEW_INSTANCINGstreams queue onto the background PSO worker. Covered inown_stream_rejects_null_truncated_and_unreadable_streamswith a 2-location fixture that clobbers and drops the original array and stream buffer before checking the owned stream.hle::d3d12x::real::(62/0/0), full release workspace (1437/0/47), and paired 60 s RTX 4060 smoke (1611frames,61 60 60,0removals/crashes).@luckyteagirl on GitHub · 2026-11-26 04:51 UTC · original · reviewed
For an accepted console graphics stream with VS/PS and
VIEW_INSTANCINGbut no rasterizer subobject, a matchingXCL_DEBUG_NO_CULLsetsno_cullyet 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 setCullMode = NONEfor 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 05:52 UTC · original · reviewed
Can the async path own the view-instance locations? A console VS stream selected as
GraphicsStreambecauseViewInstanceCount > 0always failsown_stream: its type-22 payload is nonzero and that function returnsNone. On a cold cache miss, this branch therefore re-enterstranslated_graphics_streamon 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 at211fc6b7cadbd8650c2e9fdeb2c1e88047a1805a; no measured runtime stall or GPU test. AI-assisted review with Codex.211fc6b7catoaad6434c1c@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.
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 asbackend 'real' - NVIDIA GeForce RTX 5070 Ti) andown_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 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
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.