fix(victory-gpu): sanitize host_blend LogicOpEnable and stale RTFormats in PSO creation #447
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!447
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-447"
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?
@mauroalvare on GitHub · 2026-11-26 18:57 UTC · original
mauroalvare:fix/victory-pso-blend-rtformats→main· +385 −16 · 1 files · 3 commits · openSummary
Fixes two D3D12 graphics/mesh pipeline rejection bugs (
CreateGraphicsPipelineState/CreatePipelineStatereturningE_INVALIDARG,0x80070057) inthird_party/victory/crates/victory-gpu/src/pipeline/host.rs:host_blendleavingLogicOpEnable = TRUEwhile promotingIndependentBlendEnable = TRUE:IndependentBlendEnable = false,RenderTarget[0].LogicOpEnable = true, and any integer/non-blendable render target (even a singleR8_UINTtarget),host_blendpreviously setIndependentBlendEnable = true, copiedRenderTarget[0](includingLogicOpEnable = true) intoRenderTarget[1..8], and clearedLogicOpEnableonly on slots matchinginteger(format).LogicOpEnable = trueon non-integer slots and unusedDXGI_FORMAT_UNKNOWNslots (1..7) whileIndependentBlendEnable = true, which D3D12 unconditionally rejects withE_INVALIDARG.RTFormats[NumRenderTargets..8]inGraphicsState::read(subobject 15):GraphicsState::readcopiedD3D12_RT_FORMAT_ARRAYwithout clampingNumRenderTargetsto<= 8or clearing unusedRTFormats[NumRenderTargets..8]toDXGI_FORMAT_UNKNOWN.NumRenderTargetsare rejected by PC D3D12 withE_INVALIDARG(and also causedhost_blendto inspect inactive target slots).What changed
GraphicsState::read(subobject 15) (third_party/victory/crates/victory-gpu/src/pipeline/host.rs): ClampNumRenderTargetsto<= 8, map formats viatarget_format(pc_format(...))only for active targets0..NumRenderTargets, and clearRTFormats[NumRenderTargets..8]toDXGI_FORMAT_UNKNOWN.host_blend(third_party/victory/crates/victory-gpu/src/pipeline/host.rs):IndependentBlendEnable = truewhen slot 0 hasBlendEnableorLogicOpEnableactive and there is a blendable active target alongside an integer/non-blendable target.BlendEnableandLogicOpEnabledirectly onRenderTarget[0]without enablingIndependentBlendEnable.IndependentBlendEnableistrue(originally or after promotion), clearLogicOpEnable = falseacross all 8 slots and keep unusedDXGI_FORMAT_UNKNOWNslots unblended, while preserving blending on blendable targets (such asR8G8B8A8_UNORM).pipeline::host::testsinthird_party/victory/crates/victory-gpu/src/pipeline/host.rs): Added three tests compiling real VS/PS shaders (D3DCompile,vs_5_1/ps_5_1), creating real D3D12 PSOs, executing draws on GPU, and checking readback pixels for:R8_UINTand mixed[R8G8B8A8_UNORM, R8_UINT]PSOs withLogicOpEnable = trueandIndependentBlendEnable = false(verifying GPU readbacks42,255, and77).NumRenderTargets = 1and stale formats inRTFormats[1..3](verifying PSO acceptance and GPU readback255).[R8G8B8A8_UNORM, R8_UINT]with additive blending (ONE + ONE, verifying two0.25draws blend to~128on RT0 while RT1 receives unblended9).Reproduction and test results
91c15f2(LooperSalty/AnyXboxX:main)32.0.16.2140), Rust1.98.1.d3d12SDKLayers.dll) is not installed on this machine; validation checks real D3D12CreateGraphicsPipelineStateacceptance and GPU draw readbacks on both RTX 5070 Ti and WARP.Before fix (base
91c15f2+ tests, RTX 5070 Ti)Result: 3 passed, 2 failed:
host_blend_with_logic_op_and_integer_rt_creates_valid_pso_and_draws: FAILED —single R8_UINT PSO with LogicOpEnable must not be rejected: Error { code: HRESULT(0x80070057) }.rt_format_array_clears_stale_formats_past_num_render_targets: FAILED —PSO with stale formats cleared past NumRenderTargets must succeed: Error { code: HRESULT(0x80070057) }(andg.targets.RTFormats[1]remainedDXGI_FORMAT(62)).After fix (synthetic tests)
cargo test --locked -p victory-gpu pipeline:: -- --test-threads=1 --nocaptureVICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics pipeline::host::tests -- --test-threads=1diagnostics)VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics pipeline::host::tests -- --test-threads=1diagnostics)cargo test --locked -p victory-loader --test load_probehle-probe)cargo xtask policy(inthird_party/victory)cargo clippy --locked -p victory-gpu --testspipeline/host.rsAI assistance
Developed and verified with AI assistance (Antigravity / Gemini 4 Neon). All code changes, synthetic GPU tests, and local RTX 5070 Ti and WARP runs were inspected and verified on this machine.
615429a652to854b138652854b138652to9b3a39ec1b@mauroalvare on GitHub · 2026-11-26 23:37 UTC · original
The Vice-Tay port is up in
9b3a39e. The PSO tests passed for mixed integer and UNORM targets, including a draw that checked the blend result. The target-count regression also passed and confirmed that unused format slots are cleared.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.