fix(agc): allow independent MIN and MAX in dual-source blends #17187
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17187"
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 boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-08T14:13:10Z.
What
A dual-source draw was rejected whenever either the RGB or alpha blend equation used MIN or MAX, including an independent equation with both factors set to ONE. Accept that equation while retaining dual-source blending in the other channels. MIN/MAX with other factors still throws; the existing target, export-layout and device-feature checks remain in force.
Sniper Ghost Warrior Contracts 2 (PPSA03131, 01.004.000) reaches this at entry to the tutorial:
CB_BLEND0_CONTROL = 0x61411211,CB_COLOR0_INFO = 0x00040730, target mask0xf, exports0x44. RGB isSRC1_ALPHA + ONE_MINUS_SRC1_ALPHA; alpha is MIN with ONE/ONE. Main aborts withdual-source blending with a MIN or MAX operation is unsupported. With this change the tutorial renders and accepts movement, looking and firing input.The translation uses Vulkan's independent color and alpha equations, where MIN/MAX ignore factors, only when both guest factors are ONE. AMD's PAL Gfx9 color blend setup explicitly sets those factors for unscaled MIN/MAX. Console behavior was not measured and is recorded in debt. There is no shader arithmetic change, title-specific branch or performance claim.
Tested
Windows 11 build 26200, WinLibs MinGW-w64 GCC 15.2.0, Release; NVIDIA GeForce RTX 5070, driver 616.64. Based on main
1086833f9a.The same focused tests ran on main's graphics implementation and the change:
agc_driver_dual_source_blendpasses; the newagc_driver_dual_source_blend_statefails on the previously rejected MIN/MAX equation. 1/2 pass, 1.47 s.VUID-errors, zero missing-validation-layer messages and no skipped tests. Reference implementation: this PR's main base1086833f9a, rebuilt after its shader changes. Final test registration and executable are identical in the two runs.--windows --no-patches, offline, dummy audio, validation enabled: a diagnostic-only error detail on main522df1e176confirms the registers above before abort at 246 s. That base plus the same State.cpp fix stays alive until stopped at 471 s; tutorial HUD and weapon are visible at 363 s, then controller input moves the view and a shot changes ammunition from 11 to 10. This title run preceded the final rebase; the focused tests above use the final base. A follow-up diagnostic run of final headf466758d19, with all staged runtime libraries refreshed, draw profiling and worker/committer sampling, also reaches the tutorial and keeps rendering until deliberately stopped at 463 s. This profiling run is not a performance measurement. No other open PR or local functional patch is applied to the staged AGC library. Both title logs have zero VUIDs or missing-layer messages; the candidate has no fatal or driver failure. Shader-output-not-consumed warnings remain.f466758d19. Linux and the unrelated relinker jobs were skipped by the workflow.python tools/check_conventions.py --base HEAD^passes. The required--base origin/mainrun reports 122 findings / 18 errors in existing upstream changes because the fork's origin/main is behind; none belongs to this commit.The required overlap scan inspected 1,804 other open PRs against main
1086833f9a; 159 share files or exports. There are no confirmed intersecting hunks, duplicate exports or new-file collisions. It exits 2 because 57 existing branches conflict with main, rather than reporting a clean check. I compared all 57 branch heads against their merge bases across the five shared files: 51 retain the dual-source guard unchanged, and six predate it. The only related additions are #9748 refusing dual-source factors in packed 10_11_11 target merges and #17056 changing typed storage-image access for merges that still refuse dual-source blending. Neither implements this translation. The reported heads, patches and guard comparisons were retained locally; these old branches can still need their own rebases. Depends on none.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-11-08T20:48:04Z.
Review: APPROVED
The decoder now checks color and alpha independently. That lets a MIN/MAX equation with ONE factors coexist with an ADD equation that uses the second source, while preserving the refusal for non-ONE factors in the MIN/MAX equation. The state test covers both operations in both channels and checks that the second-source factor survives in the other channel. I verified that
agc_driver_dual_source_blend_stateran and passed on this head in hosted Windows. The hosted GPU execution test skipped. The PR reports the pixel-output tests and baseline control on an RTX 5070. I did not independently rerun that hardware test.