fix(gpu): handle integer RT blend disable and target format variants #3340
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!3340
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3340"
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?
@legayclightning22 on GitHub · 2026-11-26 19:04 UTC · original
legayclightning22:fix/integer-rt-blend-and-target-variants→main· +342 −23 · 5 files · 1 commits · openSummary
Handles integer render-target blend disablement and cached target-format pipeline variants (
TargetKey, gated byVICTORY_TARGET_VARIANTS=0) acrossvictory-gpu(4eb0d71).Changes
set_targets(RtvRecord::formatincrates/victory-gpu/src/descriptor.rsandcrates/victory-gpu/src/draw.rs) and resolve graphics pipelines viapipeline::host_pipeline_for_targets.TargetKey+ cached target-format variant selection (VICTORY_TARGET_VARIANTS=0gate) incrates/victory-gpu/src/pipeline/make.rsandcrates/victory-gpu/src/pipeline/host.rs.Verification
cargo test -p victory-gpu --lib pipelinecargo clippy --locked -p victory-gpu --all-targets -- -D warningscargo xtask policy@Dukestar69 on GitHub · 2026-11-26 19:07 UTC · original · reviewed
Tested on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).All checks pass:
cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: 28 passed, 0 failed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.One scope note before merge: commit
4eb0d71appears to bundle the changes from both #3337 (bounded single-descriptor tables for root SRVs/UAVs indraw.rs/pipeline/host.rs) and #3339 (CBV caps and typed buffer view validation indescriptor.rs/descriptor/host.rs) alongside the integer RT blend / target format variant work. If this is meant to be reviewed independently, dropping the #3337/#3339 hunks (or noting that it supersedes them) would avoid merge conflicts.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
4eb0d712b7to24fd8e83ca@legayclightning22 on GitHub · 2026-11-26 19:46 UTC · original
Pushed
24fd8e8trimming out all#3337and#3339hunks (descriptor/host.rsreverted toupstream/main;descriptor.rsanddraw.rskeep onlyRtvRecord::format()and target-format variant selection) so this PR stands cleanly on its own. Re-verifiedpipeline::tests (28/28 passing),clippy -- -D warnings, andcargo xtask policy.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 19:52 UTC · original
I found a target-variant selection edge case on
24fd8e8. Once the base pipeline finishes with a refusal,ready_for_targetsreturns before looking at the formats that were actually bound. The regression sets up a completed refusal and requests a differentR32_UINTtarget. On the PR head, the variant cache stays empty.e17b393lets a different target key reach the variant builder in that case. The regression checks that the requested key is attempted and cached once. The disabled switch, same-format request, and explicitly skipped shader paths still leave the cache empty.The 31 pipeline checks passed with
VICTORY_TARGET_VARIANTS=1and again with0, excluding the depth-bounds draw that timed out on both the untouched PR and the follow-up on this host. Both strict all-target Clippy configurations and the repository policy check passed. The new regression checks CPU selection and caching; hardware creation of the resulting format variant is the next check.legayclightning22, please consider applying the follow-up and trying the bound-format case on your adapter. If you fold the change into another commit, please preserve its Git author or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 20:07 UTC · original
There is a second format-selection issue on
24fd8e8. For a typed texture with a default view,view_formatmay returnNonebecause the host texture already has the right format. A view descriptor withDXGI_FORMAT_UNKNOWNlikewise inherits the resource’s format in D3D12. The original key path reads either case as format 0. My local explicit-UNKNOWN control returned 0 where the typed resource selected RGBA8 (28).c2cfe74gets the key from the same RTV/DSV descriptions passed to D3D12, using the host resource format for default or UNKNOWN views. It retains explicitly described formats. The regression, both strict all-target Clippy runs, and the policy check passed. The RTV and DSV rules are the same here.I also tested both follow-ups together with #2626 in
5581f9f. The recorded RTV and graphics stream keys agree for 86 and 115 with native format support. A test-only CPU capability control made both fall back to RGBA8, and both keys still agreed. The combined pipeline checks passed 31/31 with the separately reproduced depth-bounds timeout excluded. This verifies the chosen formats and keys in the CPU code.Please consider taking the two follow-ups together. If you fold them into another commit, please preserve the Git author or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@fuzeofficlal on GitHub · 2026-11-26 20:38 UTC · original · requested changes
Tested locally merged onto
origin/main(63bcca43) at PR head24fd8e83on Windows 11 x64 (NVIDIA GeForce RTX 5090 + Microsoft WARP,--features diagnostics,VICTORY_D3D12_DEBUG=1).While
pipeline::(31/31) anddraw::(20/20) unit tests compile and pass, there are four blocking issues reproduced on24fd8e83:1. Critical: half-trimmed
#3337leaves a root-signature vs command-list binding mismatch (pipeline/host.rs:306-369, 624-655vsdraw.rs:805-851)Commit
24fd8e8reverted#3337's binding changes fromdraw.rs, but left#3337's root-signature changes incrates/victory-gpu/src/pipeline/host.rs(root_srv_direct,root_view_range,root_view_parameter, andHostPipeline::newlines624-655). As a result:HostPipeline::newdeclares every root SRV and root UAV parameter (includingVIEW_STRIDES) asD3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLEby default.draw.rs(L824-L848) still binds them with raw GPU addresses viaSetComputeRootShaderResourceView/SetGraphicsRootShaderResourceView/SetComputeRootUnorderedAccessView/SetGraphicsRootUnorderedAccessView.Reproduced live on both RTX 5090 and WARP with
VICTORY_D3D12_DEBUG=1by building a computeHostPipelinewithVIEW_STRIDESinroot_srvsand callingState::bind(after materializing the heaps and clearingInfoQueue):#3340(24fd8e83), both RTX 5090 and WARP immediately fail D3D12 Debug Layer validation with:ID3D12CommandList::SetComputeRootShaderResourceView: The currently set root signature declares parameter [0] with type descriptor table, so it is invalid to set a root SRV here.origin/main(63bcca43), the exact same test producesNone(0 D3D12 Debug Layer errors) on both RTX 5090 and WARP.Please also drop the remaining
#3337hunks fromcrates/victory-gpu/src/pipeline/host.rs(and their testsroot_srvs_and_uavs_are_bounded_one_descriptor_tables,root_srv_direct_opt_out_keeps_raw_addresses,root_srv_direct_only_for_one).2.
RtvRecord::format()returnsDXGI_FORMAT_UNKNOWN (0)for typed textures with default orUNKNOWNviews (descriptor.rs:363-373)crate::resource::view_format()returnsNonewhenever the host texture already has the typed format (format == own), and explicit RTV/DSV descriptors withFormat == DXGI_FORMAT_UNKNOWN (0)also inherit the resource's format in D3D12.Reproduced locally with a typed
R8G8B8A8_UNORM(28) render target texture:described = 0):record.format()returnsDXGI_FORMAT(0)instead of28.UNKNOWNRTV (described = 1, desc[0] = 0):record.format()returnsDXGI_FORMAT(0)instead of28.When bound in
draw.rs::set_targets, this recordsRTFormats[0] = DXGI_FORMAT_UNKNOWN, causingready_for_targetsto build broken target variants. Resolve the effective format from the view desc when non-zero, falling back to the host resource's actualGetDesc().Format(orview_format().unwrap_or(host_format)).3.
ready_for_targetsreturnsNonebefore trying variants when the base PSO was refused (pipeline/make.rs:772)let base = p.made.get()?.as_ref()?;exits early whenp.madecompleted withNone(e.g. a base PSO created with incompatible/unknown target formats), somake_variant(want)is never reached for compatible bound RTV/DSV formats.4. UTF-8 mojibake corruption in comments
crates/victory-gpu/src/descriptor/host.rs:688(×->×) andcrates/victory-gpu/src/draw.rs:76, 88, 1012, 3518(→->→,—->—) introduce corrupted UTF-8 characters in untouched comments; please restore clean UTF-8.(Note:
host_blendonmainalready preserves float RT blending while disabling integer RT blending in MRT configurations;integer_blend_disable_covers_signed_and_unsigned_formatspasses cleanly.) Synthetic tests only.@evan-kolberg on GitHub · 2026-11-26 20:50 UTC · original
On an M4 Pro with CrossOver 26.3 and D3DMetal 4.0 beta 3, the generated offscreen draw selected and reused a native pipeline for the new integer target format. legayclightning22’s exact head
24fd8e83VICTORY_TARGET_VARIANTS=1, a workingR32_UINTpipeline returned a distinct host PSO when asked forR16_UINT. A second request reused the single cached variant. Each format read back0x6a5bat all 64 pixels.R16_UINTpipeline matched all 64 pixels as the adapter control.The fixture used explicit format keys, a resource-free pixel shader, and r4tedx’s fullscreen vertex shader. This adds hardware coverage for the working-base case. Refused-base recovery and format inference remain open. r4tedx’s fixture · andrewpozdnakov7-jpg’s recovery test · Format-inference follow-up
Prepared and tested with Codex.
24fd8e83catof8df6ee376@legayclightning22 on GitHub · 2026-11-26 22:07 UTC · original
Pushed
f8df6eeaddressing all four blocking items:#3337root-signature hunks and tests frompipeline/host.rsso root signatures matchdraw.rsraw root bindings cleanly under D3D12 Debug Layer.RtvRecord::format()(and DSV parity) to fall back to the host resource's actual format for default andDXGI_FORMAT_UNKNOWNviews.ready_for_targetsso a refused base PSO still reachesmake_variant(want)when bound formats differ, with a regression test.descriptor/host.rsanddraw.rs.Re-verified
pipeline::tests (26/26 passing),clippy --all-features -- -D warnings, andcargo xtask policy.@fuzeofficlal on GitHub · 2026-11-26 22:44 UTC · original · approved these changes
Verified the updated head (
f8df6ee3) merged cleanly ontomain(63bcca43) — all four blocking items from the previous review are resolved.Verification
cargo xtask policy: 191 files ok;cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): 0 warnings; zero UTF-8 mojibake across all changed files.pipeline::(29/29) anddraw::(20/20) unit tests passed on both a discrete NVIDIA RTX 5090 and WARP with--features diagnosticsandVICTORY_D3D12_DEBUG=1.VICTORY_D3D12_DEBUG=1):VIEW_STRIDESbinding executes with 0 Debug Layer errors.RtvRecord::format()(crates/victory-gpu/src/descriptor.rs:365-380) returnsR8G8B8A8_UNORMfor null/UNKNOWN RTV descriptors,D32_FLOATfor null DSV descriptors on a typeless host depth texture, andR8G8B8A8_UNORM_SRGBfor explicit RTV descriptors.ready_for_targets(crates/victory-gpu/src/pipeline/make.rs:305-327) after a refused base PSO (p.made == Some(None)) compiles and caches liveR8G8B8A8_UNORMandR16G16B16A16_FLOAT + D32_FLOATvariants, returnsNonewithout retrying on the failed base key, and compiles anR8_UINTvariant from aBlendEnable = truebase state viahost_blend— all with 0 Debug Layer errors.State::resetresetsrt_formats/dsv_formatandState::cutreplaysset_targetsacross command-list segments.Minor non-blocking note
--features diagnostics,ready_for_targets(crates/victory-gpu/src/pipeline/make.rs:305-327) does not short-circuit whenp.skipped_shader.is_some(), so a query such ascompletes_rectangles()with a non-base target key can still compile a variant for a skipped shader (draws are still dropped byis_skippedinprepare()andexecute_indirect()). Adding#[cfg(feature = "diagnostics")] if p.skipped_shader.is_some() { return None; }would keep skipped pipelines completely off compilation.Approving as all blocking issues are fixed and verified cleanly on hardware and WARP.
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.