GPU: integer render targets write unblended on the host (#2775) #2801
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!2801
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2801"
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?
@miatson on GitHub · 2026-11-25 20:56 UTC · original
miatson:gpu-integer-target-blend→main· +114 −0 · 1 files · 3 commits · openFixes #2775.
Problem
The console blends (MIN/MAX) into integer render targets; desktop D3D12 refuses a
pipeline that enables blending on a
_UINT/_SINTtarget. The title's blend state waspassed to the host unchanged, so pipelines like the mesh pipeline in #2775 (blending on
slot 2,
R8_UINT) were refused withE_INVALIDARGand all their draws were dropped.Change
GraphicsState::host_blend(inpipeline/host.rs) is now the blend state both host paths use(the graphics description and the mesh pipeline stream):
BlendEnable = FALSE; the others keep the title's blending.IndependentBlendEnablewas off, target 0's description is first copied to everytarget and independent blending turned on, so only the integer target changes.
It reuses
twin::integer(nowpub(crate)) for the format check.Trade-off
The integer target now overwrites instead of MIN/MAX-blending, as the issue suggests.
That can differ from the console's output for that target, but the pass is drawn instead
of dropped.
Tests
integer_targets_write_unblended: the blend state for both the independent and theshared description cases, and the unchanged case.
the_host_takes_a_pipeline_blending_into_an_integer_target: creates the pipeline on thehost device (skipped without one). Before the change it failed locally with
HRESULT(0x80070057), the error in the issue; it now passes.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsis clean, andcargo test --workspace --lockedpasses (782 passed, 0 failed) on Windows 11.Not tested in game: I have no game data. The mesh path uses the same
host_blendbutonly the graphics path is covered by the device test.
Written with the help of Claude Code.
@fuzeofficlal on GitHub · 2026-11-25 21:20 UTC · original
Reviewed and verified
28b7278fon Windows 11 (RTX 5090 + WARP) againstmain(13f91ca).Code review (and comparison with
#2790)main(13f91ca), keepingg.blend/g.describe()untouched viaGraphicsState::host_blend()for both graphics (host.rs:647) and mesh (host.rs:752) PSO creation.IndependentBlendEnable == FALSE(unlike#2790): inspectsblend.RenderTarget[if independent { i } else { 0 }].BlendEnableacross0..count, expands[blend.RenderTarget[0]; 8]and setsIndependentBlendEnable = truewhen any integer target is blended, and clearsBlendEnableonly on the integer slots—so both(RT0 float blended, RT2 integer)and(RT0 integer blended, RT1 float)MRT combinations work without rejecting the PSO or disabling blending on float targets.twin::integercovering all 21 DXGI_UINT/_SINTRTV formats. (Minor edge note: if a title ever set bothBlendEnable = TRUEandLogicOpEnable = TRUEsimultaneously withIndependentBlendEnable = FALSE, expanding toIndependentBlendEnable = TRUEwould also needLogicOpEnable = FALSE, though that combination is already invalid in D3D12.)Verification (Windows 11, RTX 5090 + WARP)
--features diagnostics --test-threads=1,pipeline::): 18/18 passed (includinginteger_targets_write_unblendedandthe_host_takes_a_pipeline_blending_into_an_integer_targetfor bothindependent = trueandfalse).victory-gpu --features diagnostics --lib -- --test-threads=1: 198 passed, 2 failed, 1 ignored (allpipeline::*pass; only the 2 pre-existing13f91caview-heap cap baselines fail).cargo clippy --locked -p victory-gpu --features diagnostics --all-targets -- -D warnings: 0 warnings;cargo xtask policy: 184 files ok; cleangit merge-treevs13f91caand#2803.@oni-swr on GitHub · 2026-11-25 21:25 UTC · original
Independent WARP/CPU verification of head
28b7278f6ddcce2bd9b7a01f6e989c2adc86534b, merged ontoorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca(clean merge).Environment: Windows 11 Pro 26200, WARP only (
VICTORY_D3D12_WARP=1with--features diagnostics, sohost()is WARP, plusVICTORY_WARP=1), Windows SDK 10.0.26100.0 x64dxil.dll1.8.2502.11.cargo test -j 4 -p victory-gpu --features diagnostics:memory::tests::a_submission_that_missed_leaves_the_copies_at_once("the written page counts as changed at once"), which is the known race onmainthat #2805 removes, unrelated to this change.the_host_takes_a_pipeline_blending_into_an_integer_targetran on the WARP host device.host_blendreturns the title'sself.blendunchanged, both new tests fail. The device test fails withHRESULT(0x80070057)forindependent: true, the error in #2775.RenderTargetentries the same blend, so the copy isn't exercised. In a translated state withIndependentBlendEnableoff, entries 1..7 need not match entry 0 (they could be default zeros). Without the copy, the float target 1 would silently lose its blending. LeavingRenderTarget[1..]at their defaults in theindependent == falsefixture would pin it down.cargo clippy -p victory-gpu --all-targets -- -D warningswas clean, with and without--all-features.cargo fmt --all --check: 897 hunks against 891 on the baseline. The 6 new hunks are all inpipeline/host.rs: theblendedclosure inhost_blend, twoassert!s ininteger_targets_write_unblended, and theD3DCompile,D3D12_SHADER_BYTECODEandCreateRootSignaturelines in the device test.Diff review:
host_blend,min(8)bounds the format index, andtwin::integer's list matches the DXGI_UINT/_SINTformats.Not tested: physical GPU, mesh pipeline path on a device, retail title.
AI use: Claude Code (Claude Opus 5.5)
0x80070057/ D3D12id=676):BlendOp=MAXenabled onDXGI_FORMAT_R8_UINTRT slot 2 ([mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35]) #2775@miatson on GitHub · 2026-11-25 21:53 UTC · original
Both points are addressed in
100605f:independent == falsethe fixture now describes onlyRenderTarget[0]and leavesRenderTarget[1..]at their defaults (unblended). With the[blend.RenderTarget[0]; 8]copy removed,integer_targets_write_unblendednow fails atRenderTarget[1].BlendEnable; with it, both tests pass. (The device test still passes without the copy, as expected: the pipeline is valid, target 1 just loses its blending.)pipeline/host.rsis back to main's 12cargo fmt --checkhunks, none in this change.Re-checked on Windows 11 / RX 7900 XT: Clippy clean with and without
--all-features,cargo test --workspace --locked781 passed, 0 failed.@Marvisak on GitHub · 2026-11-25 23:24 UTC · original
Automated triage for the maintainers.
The fix this PR first carried is now in
main(host_blendincrates/victory-gpu/src/pipeline/host.rs, from #1152), and after mergingmainthe diff only adds two tests:a_shared_blend_description_is_copied_to_every_target, which leavesRenderTarget[1..]at their defaults so it fails if the copy of target 0 is removed (the existinginteger_targets_do_not_blendgives every entry the same blend and does not catch that), andthe_host_takes_a_pipeline_blending_into_an_integer_target, which creates such a pipeline on the host device for bothIndependentBlendEnablevalues. I checked both againstmain'shost_blendand the default blend state; they are meaningful tests. No CI run is reported for the current head, and the title and description still describe the fix, so they would be best updated to say this is now tests only.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
@steven-seagull27 on GitHub · 2026-11-26 02:08 UTC · original
I checked the mesh dispatch from #2775 on head
36cfa002. The current head carries regression tests, and the production blend fix is already on main. With the D3D12 debug layer enabled, I dispatched a full-screen triangle through VIctory'smesh_pipelineand copied all three render targets back. This exercised the mixed formats together, with MAX blending requested by the guest.Counts are per run. All three repetitions on each adapter agreed. Each column includes a 16×16 full draw and a scissored draw covering 72 pixels, with the other 184 retaining their clear values. The drawn RGBA8 target read
[191,192,128,255], the RGBA16F neighbor read[0.75,0.75,0.5,1], and the R8_UINT target in slot 2 changed from 201 to the shader's 17.For a sensitivity check I locally removed just the shared-state copy for the RGBA16F neighbor. The mesh PSO still created and dispatched on both adapters. All 256 drawn pixels on that neighbor then differed in the full draw and exactly 72 differed in the scissored draw. The other targets and the independent-state cases stayed correct. That gives the shared-state regression test a concrete rendering consequence. These are synthetic mesh draws. I did not run the title.
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.