GPU: match host graphics pipelines to bound RTV formats #3109
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3109
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3109"
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?
@fuzeofficlal on GitHub · 2026-11-26 08:23 UTC · original
fuzeofficlal:fix/gpu-rtv-format-pipeline-variants→main· +952 −34 · 6 files · 1 commits · openSummary
When a title draws with a graphics pipeline whose declared
RTFormatsdiffer from the render target views currently bound viaOMSetRenderTargets(for example,R10G10B10A2_UNORMdeclared in the pipeline stream against a boundR11G11B10_FLOATor typelessR8G8B8A8_UNORM_SRGBtarget), D3D12 raises debug-layer error 613 (D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE) and leaves host render-target output conversion mismatched.This change tracks the host DXGI formats of the bound render targets and lazily builds and caches matching host graphics pipeline variants per title pipeline when any declared non-
UNKNOWNtarget slot differs from the bound format.Changes
crates/victory-gpu/src/draw.rs: track bound host RTV DXGI formats inState::set_targets(from the RTV desc format or resource desc fallback) and resolve graphics/mesh draws throughpipeline::host_pipeline_for(and diagnostics throughnote_drop_for).crates/victory-gpu/src/pipeline/host.rs: addGraphicsState::targets_for(overriding only declared non-UNKNOWNslots that differ from bound non-UNKNOWNformats, returningNonewhen already matching) andGraphicsState::with_targets(cloning input semantic names and re-pointingSemanticNamepointers).crates/victory-gpu/src/pipeline/make.rs: addPending::variantsharing translated shaders, inheritingskipped_shaderandhost_blendinteger-target handling, storing variants in the pipeline library, and keeping draw-time variants out of the early-start list (record_early: false); returnOption<Arc<HostPipeline>>fromready.crates/victory-gpu/src/pipeline.rs: add per-Pipelinelazy variant cache (Mutex<Vec<(TargetFormatsKey, Arc<make::Pending>)>>), keeping matching draws on the lock-free base path.crates/victory-gpu/src/pipeline/rtv_format_test.rs& unit tests: end-to-end D3D12 draw + pixel readback + D3D12 debug-layer zero-Error-613 tests coveringR10G10B10A2_UNORM -> R11G11B10_FLOATand multi-RT typelessR8G8B8A8_UNORM_SRGB, plus unit tests fortargets_for,with_targets(including integer-target blend disabling), andPending::variant.Testing
cargo test -p victory-gpu --locked pipeline::(RTX 5090 hardware &VICTORY_D3D12_WARP=1): 48 passed, 0 failed.VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --locked --features diagnostics pipeline::(RTX 5090 hardware & WARP): 51 passed, 0 failed, zero D3D12 error 613.cargo clippy -p victory-gpu --all-targets --locked -- -D warningsand--features diagnostics: 0 warnings.cargo test -p xtask --locked policy::tests::repository_passes_policy: passed.@Dukestar69 on GitHub · 2026-11-26 08:27 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: 28/28 passed on RTX 5090 and WARP (includingmismatched_rtv_format_builds_variant_and_draws_cleanly,multi_rt_and_srgb_mismatch_draws_both_targets_cleanly,targets_for_overrides_only_mismatched_declared_slots,with_targets_repoints_input_names_and_updates_description, andformat_variant_does_not_record_early_and_inherits_skip).cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed on RTX 5090.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Cleanly builds and caches RTV-format PSO variants on demand when bound RTV formats differ from the declared graphics pipeline formats.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Marvisak on GitHub · 2026-11-26 08:32 UTC · original
Automated triage for the maintainers.
Verdict: needs work. CI
checkpasses.This PR records the bound RTV formats in
draw::State::set_targets. When a declaredRTFormatsslot differs from the bound format, it builds and caches a host pipeline variant at draw time (Pipeline::variant_for,GraphicsState::targets_for/with_targets,make::Pending::variant). Every graphics lookup moves tohost_pipeline_for.This changes GPU state handling, and the PR gives no evidence from the title:
resource::pc_format: the pipeline inGraphicsState(pipeline/host.rs), and the RTV inRtvRecord::host_desc. If the mismatch comes from VIctory mapping the two differently, the fix belongs in that mapping, not in per-draw variants.The PR also edits
set_targets, as #3107 does. With title evidence, and a check that the mismatch is not in our own format mapping, this would be reviewed again.Generated by Claude Code
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.