Repository navigation
feat(agc): implement dual-source blending from the MRT1 export - #1492
Conversation
7726354 to
66b1396
Compare
66b1396 to
67d4c89
Compare
|
Tested on top of main Head AI-assisted: yes (Claude Code). |
67d4c89 to
74197a0
Compare
74197a0 to
a6573b9
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Thanks. This is stacked on #1485, which isn't merged yet, so this branch still carries its commit (d41f24f29) and can't land as is. It also conflicts with main in core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp (the color-export validation changed with #1073/#1074).
- Please wait for #1485 to land (or drop the dependency), then rebase so the branch contains only the dual-source commit, and resolve the
ShaderValidation.cppconflict. - After the rebase, rerun the PR's tests (
agc_driver_dual_source_blend,DualSourceBlendTests,agc_shader_memory) and update the request-version number ifmainor a merged PR took it meanwhile.
I haven't reviewed the code itself yet; it'll be reviewed once the diff is just this change.
a6573b9 to
f97c100
Compare
CB_BLENDn_CONTROL factors 15-18 (BLEND_SRC1_COLOR, BLEND_INV_SRC1_COLOR, BLEND_SRC1_ALPHA, BLEND_INV_SRC1_ALPHA) threw "unsupported blend factor". They blend MRT0 with the pixel shader's MRT1 export as the second source, as RADV and radeonsi program it. DecodeState maps them to the VK_BLEND_FACTOR_SRC1_* factors and accepts them only with pixel exports to slots 0 and 1, color writes to slot 0 alone, an MRT1 export with MRT0's export format and shader mask, an ADD, SUBTRACT or REVERSE_SUBTRACT operation and an identity component order. The blend is draw state, so the specialized module of the registered pixel shader moves its MRT1 output to location 0 index 1, which ValidateShaders requires; pipelines need dualSrcBlend, now enabled when present. The request field dualSourceBlend is in the module key, the result memo, the draw key and the serialized request (version 15).
f97c100 to
b8cc4ad
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Checked on current main: build + ctest of libSceAgcDriver/libSceAgc green, agc_driver_dual_source_blend runs on RADV and on CI's lavapipe, the new tests don't compile without the change, blend factors 15-18 match Mesa's gfx103 encodings, unmodelled layouts and MIN/MAX still throw and the assumption is in TechnicalDebt. Windows runs by @yahya308 on NVIDIA and AMD also pass. Merging once the full Linux/Windows build is green.
What
Blend factors 15–18 currently throw. This maps them to
VK_BLEND_FACTOR_SRC1_*, using the pixel shader's MRT1 export as MRT0's second source. The factor encodings follow Mesa's gfx103 register definitions.Accepted draws export slots 0 and 1, write only slot 0, use matching export formats and shader masks, identity component order, and ADD, SUBTRACT or REVERSE_SUBTRACT. Other layouts and MIN/MAX still throw; the remaining restrictions are recorded in TechnicalDebt.
Registered pixel shaders remain generic. Draw specialization places MRT1 at
Location 0, Index 1; pipelines requiredualSrcBlend, enabled when available. The flag participates in draw and materialization keys. Request version 15 follows main's packed-export version 14; older requests default the flag to false. Cache format 23 and runtime ABI 11 are unchanged.An earlier PPSA26344 v1.008 capture uses
ONE + SRC1_COLORwith FP16 MRT0/MRT1 exports into an RGBA16F target. This restack contains only dual-source changes now that #1485 has merged.Tested
mainf6af6d11. Current headb8cc4adbresolves only the TechnicalDebt conflict; all 599 added/removed topic lines are unchanged. Source reviews, conventions and whitespace checks pass. This head has not been rebuilt or retested.f97c1009, tested as merge0f3c7b5cwith frozen main092e133e, on Windows 11, MinGW-w64 GCC 15.2.0, RTX 3080 Laptop,-DBUILD_TESTING=ON: configure, five-target build, registration and 5/5 CTests pass; zero skips, 14.42 s.agc_driver_dual_source_blend),DualSourceBlendTestsinagc_driver_graphics, request compatibility inagc_shader_memory, packed-UNORM color targets and UINT16 exports.f1451396: Windows 490/490, Linux/llvmpipe 499/499. Not tested for this rebase: a fresh full suite, Linux, game execution or console behavior.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)