GPU: forward pipeline view instancing (subobject 22) to the host #3060
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3062"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:52:06Z.
Summary
Forwards D3D12 pipeline stream subobject
22(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING) to host graphics and mesh pipelines instead of silently dropping it.Details
crates/victory-gpu/src/pipeline.rs,crates/victory-gpu/src/pipeline/host.rs):22(D3D12_VIEW_INSTANCING_DESC, 32 bytes:ViewInstanceCount+ 4-byte padding +pViewInstanceLocations+Flags, clamped toD3D12_MAX_VIEW_INSTANCE_COUNT = 4locations) inGraphicsState::read.view_instancinginGraphicsState::describe()so host pipeline library cache keys distinguish view-instanced pipelines from plain ones.crates/victory-gpu/src/host.rs):D3D12_FEATURE_D3D12_OPTIONS3::ViewInstancingTier != D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTEDand recordsDXGI_ADAPTER_FLAG_SOFTWAREat device creation.crates/victory-gpu/src/pipeline/host.rs,crates/victory-gpu/src/draw.rs):stream_pipelinewith an optional trailing subobject so vertex and mesh pipelines can includeDEPTH_STENCIL1(depth bounds),VIEW_INSTANCING, or both.D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED.D3D12_VIEW_INSTANCING_FLAG_ENABLE_VIEW_INSTANCE_MASKINGwith a one-time warning because D3D12 defaults the view instance mask to0(all views disabled) when masking is enabled andSetViewInstanceMaskis not yet wired.(0, 0)D3D12_VIEW_INSTANCING_DESCto SM 6.x (PSV0) plain graphics pipelines and pairs graphics pipeline binds withID3D12GraphicsCommandList1::SetViewInstanceMask(1for plain,0xFfor view-instanced), working around a WARP (d3d10warp.dll) state leak where a previous multi-view PSO's view-instancing configuration bleeds into subsequent plain PSO draws across command lists (including older WARP builds such as Windows Server 2022 where an unmasked 1-view subobject alone still leaks). Hardware GPUs and legacy SM 5.1 test shaders are untouched.crates/victory-gpu/src/pipeline/view_instancing_test.rs):view_instancing_changes_the_stream_state).victory-shader:ENABLE_VIEW_INSTANCE_MASKINGfallback (view_instancing_routes_one_title_draw_to_multiple_viewports).Texture2DArrayrouting (view_instancing_routes_one_title_draw_to_multiple_array_slices).subobject 14) + view instancing (subobject 22) (view_instancing_combines_with_depth_bounds).Verification
cargo test -p victory-gpu --locked pipeline::on NVIDIA GeForce RTX 5090 (27/27 passed,VICTORY_D3D12_DEBUG=1).cargo test -p victory-gpu --locked --features diagnostics pipeline::on Microsoft Basic Render Driver / WARP (VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1, 30/30 passed).cargo clippy -p victory-gpu --locked --all-targets -- -D warnings(default and--features diagnostics) — clean.cargo test -p xtask --locked policy::tests::repository_passes_policy— passed.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T06:06:12Z.
Review: APPROVED
Verified: the console subobject-22 read uses the PC layout like depth_stencil1; locations are copied into owned storage (the title pointer would dangle), count/null/D3D12_MAX_VIEW_INSTANCE_COUNT validated, and ENABLE_VIEW_INSTANCE_MASKING is stripped — right, since the default mask is 0 and would discard every draw until SetViewInstanceMask is wired. The stream dispatch covers all four combinations with V=() adding zero bytes. The WARP reset is the clever-but-correct part: WARP latches instancing across PSO switches, so a cached anonymous 1-view (0,0) PSO bound before any non-instanced graphics pipeline returns it to view 0; bind_pipeline is correctly inside take_rebind and leaves compute binds alone. The test asserts key changes per locations/flags and count==0 restore.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:18Z.
Automated triage for the maintainers.
Needs work. The plumbing is careful: the subobject is parsed in
GraphicsState::read, kept out of the pipeline key when inactive, and the masking flag is cleared because noSetViewInstanceMaskslot exists yet. But this changes GPU state handling without evidence for the two things it depends on:GraphicsState::read(crates/victory-gpu/src/pipeline/host.rs, arm22) reads it with the PCD3D12_VIEW_INSTANCING_DESClayout, and the description says the console layout "still needs title-side verification". Please add evidence: the title's own pipeline streams, or a trace showing a non-zeroViewInstanceCount. Without it, this adds unused code paths, and the title's location pointer is dereferenced on a layout nobody has checked.bind_pipeline(draw.rs) binds an extraWARP_VIEW_RESETPSO before every plain graphics pipeline on software adapters. That PSO is built once from the first view-instancing pipeline's root signature and shaders, and is then set on lists using unrelated root signatures. It works around a WARP behaviour, not anything the title does. It would fit better in the tests, or behind a specific, documented WARP bug, than indraw.rs.Also: the new
view_instancing_test.rsis 910 lines for a feature the title has not been shown to use. A smaller test of stream parsing and keys would do until (1) is settled.CI:
checkwas still running when this was written.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T06:28:41Z.
Agreed with the triage review — closing this for now:
22is emitted with non-zeroViewInstanceCountor confirming its exact console struct layout before dereferencingpViewInstanceLocations.windows-latest/ Server 2022d3d10warp.dll) also exposed a WARP driver state-leak quirk across plain PSOs that should not push workarounds into the production bind path.Happy to revisit with a smaller, verified patch if a title trace later confirms subobject
22usage and layout.Pull request closed