feat(agc): blend into color targets with a reversed component order #5200
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5200"
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 nikowolf123 on 2026-10-13T14:26:33Z.
What
Gran Turismo 7 (PPSA01317) stops at this refusal in #4782 ("Next stop"), once the earlier stops are past:
The register values come from the reporter's local build. On
mainthe same throw inDecodeState(State.cpp) prints no values.#1425 renders 8_8_8_8 and 16_16_16_16 targets with
COMP_SWAP2 (SWAP_STD_REV) or 3 (SWAP_ALT_REV). It does this by permuting the pixel exports onto an RGBA attachment. Mapping 0x1b leaves the attachment holding (A, B, G, R) and 0x93 leaves it holding (A, R, G, B). Vulkan blends channels 0-2 with the color equation and channel 3 with the alpha equation. A plain Vulkan blend would therefore blend the exported alpha as a color and read source alpha from red or blue. That is why #1425 refused blending.GT7's
CB_BLEND0_CONTROL0x65010504 has separate alpha. Field layout and factor numbering from Mesa 26.2.2's gfx10.json (the same as CIK pp. 226-228):SRC_ALPHA * src + ONE_MINUS_SRC_ALPHA * dstONE * src + ONE_MINUS_SRC_ALPHA * dstSemantics. The color block blends in shader export order and applies
COMP_SWAPafterwards. This means:Sources:
CB_TARGET_MASKis described in "the order of components after blending and before COMP_SWAP is applied". The same CIK reference (p. 233) hasBLEND_CLAMPclamp UNORM, SNORM and sRGB sources to the format range before blending.CB_BLENDn_CONTROLfrom the Vulkan state without looking at the swap (radv_pipeline_graphics.c). It rendersR4G4B4A4,B4G4R4A4,R5G5B5A1andB5G5R5A1throughSWAP_STD_REVandSWAP_ALT_REV(vk_format.c, ac_formats.c).results.csv.zstartifacts pass all 400blend.format.<format>.statescases for each of those four formats. Those cases use separate color and alpha factors, includingDST_ALPHA, against a reference blended in API order. Mesa treats the PS5's gfx1013 as GFX10 like Navi10 (ac_gpu_info.c).This has not been measured on gfx1013 or on 8_8_8_8 and 16_16_16_16 targets. Carrying it over to them relies on
COMP_SWAPbeing the same field for every format. The new entry indocs/dev/debt/libSceAgcDriver.mdsays so.Design.
TranslateReversedBlend(State.cpp) keeps factor pairs that Vulkan applies per channel as Vulkan factors. These areZERO/ZERO,ONE/ONE,SRC_COLOR/SRC_ALPHA,DST_COLOR/DST_ALPHAand theONE_MINUSforms. For other combinations it searches for Vulkan factors that reproduce the guest blend from copies of the export (since 086613813; see the update of 2026-10-14 below):ONEmay become 1, with its export moved into the factor;1 -and product throughSRC1_COLOR,SRC1_ALPHAand theirONE_MINUSforms. The shader computes nothing.For GT7 that gives the following in attachment order, which equals the guest blend for both mappings:
(1, a, a, a)SRC1_COLOR/ONE_MINUS_SRC1_ALPHA,SRC1_ALPHA/ONE_MINUS_SRC1_ALPHA,ADDThe shader side reuses #1492's fragment output post-pass (
FragmentOutputSpecialization.hpp). It adds the location 0 index 1 output and rewrites each whole store to MRT0. The emitter is unchanged. The code is a pipeline specialization constant (ReversedBlend), so it is in the module and draw keys but not in the prepared shader key, and a registered pixel shader is reused. Request serialization goes to version 26. Pipelines with a code needdualSrcBlend, and shader validation accepts the index 1 output for them.Still refused, each with its own message that now includes the blend control, the mapping and the format:
DST_ALPHA,ONE_MINUS_DST_ALPHAandSRC_ALPHA_SATURATEin the color equation (they need the first channel in the other three);ONE_MINUS_SRC_ALPHAin the alpha equation withSRC_COLORin the color equation;MIN/MAXwith factors other thanONE(CIK p. 228: MIN and MAX do not force the factors to ONE);dualSrcBlend.GT7's
CB_COLOR0_INFOandCB_SHADER_MASKfor that draw are unknown. If the target is sRGB or the shader exports more than one MRT, GT7 stops at the new, more specific message instead.Overlaps:
main, leaves blending off for a target withCB_COLOR_INFO.BLEND_BYPASS, so a bypassed reversed-order target is written without blending and never reachesTranslateReversedBlend.maintook request version 22 for the tessellation patches per group (#4114), version 23 with specialization id 8234 for the layer export flag (#5097), version 24 for the tessellation primitive group size (#4201) and version 25 for the dithered alpha-to-coverage flag (#4451), so this PR uses version 26 and id 8235. Open PR #4706 also writes version 26, #4450, #4650, #5314 and #5500 write versions 22 to 24, and #5466 and #5500 use id 8235; whichever lands later renumbers.wip/ppsa01317-world-map-testbranch, marked "do not upstream" and not opened as a pull request. This PR does not use them.Tested
WSL2 Ubuntu 26.04, GCC 15.2.0, Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON. Tests ran on lavapipe (llvmpipe, LLVM 21.1.8) with CI'sVK_ICD_FILENAMES=<lvp_icd>,ANYPS5_REQUIRE_VULKAN=1andGALLIUM_OVERRIDE_CPU_CAPS=avx.main14036cb0e, with only the declarations they need added (the tworeversedBlendfields, theReversedBlendstruct, twoReversedBlendCodeconstants and aTranslateReversedBlendthat throwsmain's message):agc_driver_reversed_order_blendandagc_driver_graphicsstop withblending into a color target with a reversed component order is not implemented;agc_shader_memoryfails with "pixel fields or export mappings were lost in serialization".main.ctest: 1050 tests, no failures (1007 pass, 43 skip).main14036cb0e: 1049 tests, no failures (1006 pass, 43 skip).agc_driver_reversed_order_blendtakes 0.3 s.maine152ba8f6without conflicts: 1062 tests, no failures (1019 pass, 43 skip).maine152ba8f6alone: 1061 tests, no failures (1018 pass, 43 skip). The only difference is the new test.CB_BLEND_CONTROLwith factors 0-10 and 13-20 and functions 0-4, with and without separate alpha, went throughTranslateReversedBlendfor both mappings, the three accepted formats andFORCE_DST_ALPHA_1on and off (39 million cases). The 217,620 accepted cases were blended through a model of the post-pass and the Vulkan blend, with 12 inputs each, including UNORM exports outside [0, 1]. Each result equals theCB_BLEND_CONTROLdefinition applied in export order and then swapped.FORCE_DST_ALPHA_1,SRC_ALPHA_SATURATEin the color equation becomesZERO, asmainalready does for every target. That differs from min(As, 0) when a float target gets a negative alpha.spirv-valaccepts, and its stores matched the model on 600 inputs each, including NaN and infinities. It accepts exactly the 1,201 valid codes.agc_driver_reversed_order_blendfail:Windows 11 Pro, NVIDIA GeForce RTX 5080 (driver 616.92, Vulkan 1.4.351), WinLibs GCC 15.2.0 r7, Release.
ctest -R agc_gives 475 tests with no failures. One skip is expected:agc_driver_stencil_ref_export, because the driver has noVK_EXT_shader_stencil_export.agc_driver_reversed_order_blend,agc_driver_dual_source_blend,agc_driver_swap_alt_blend,agc_driver_graphicsandagc_shader_memorypass with--repeat until-fail:3.agc_driver_reversed_order_blendtakes 0.4 s.New tests:
agc_driver_reversed_order_blend, a GPU execution test.SWAP_STD_REVandSWAP_ALT_REV.DecodeStateon a register set. The draw goes through the registered-shader path.0x65010504(with all four channels written and with only red, green and blue),0x65810584,0x40000501,0x61000104,0x61020302,0x61010504(since 1d6edc4f0),0x60060008,0x40000101and0x40000141.CB_BLEND_CONTROLfields, blends in logical RGBA with the AMD factor definitions (clamping the source for UNORM), and places the channels in memory by the AMDCOMP_SWAPtext. Tolerance is ±1 code for UNORM8 and 2^-11 · max(1, |value|) for FP16. Pixels outside the scissor and channels outside the write mask must be unchanged.agc_driver_graphics:TranslateReversedBlendcalled directly;ValidateShaders;agc_shader_memory: version 26 round-trip; the version 25 layout read without the new four bytes, the 23 and 24 layouts without the dither flag as well, and the 19 to 22 layouts without the layer export flag as well.request_serializer:main's fixtures now upgrade to version 26 with the four zero bytes, and its version 24 fixtures are also read as version 25, with and without the dither flag.maintest that expected a ONE/ZERO blend into a reversed target to be refused now expects it to be accepted.This change was not run on AMD hardware or on a PS5. A request for a reviewer with an RDNA GPU and RADV:
deqp-vk --deqp-case='dEQP-VK.pipeline.monolithic.blend.format.*_unorm_pack16.states.*'. Itsr4g4b4a4,b4g4r4a4,r5g5b5a1andb5g5r5a1cases exercise exactly this export-order blend onSWAP_STD_REV/SWAP_ALT_REVtargets. The Navi10 run covers GFX10, the PS5's generation in Mesa; a GFX10.3 or later pass would show the behaviour did not change after it.ctest -R agc_driver_reversed_order_blendthere.Whether GT7 runs past this stop was not verified by us.
main'stools/check_conventions.py --base origin/main --title ... --body ...passes.Final branch, one commit (64071f564) on
main759c66564, after moving the request serialization from version 22 to 23 becausemaintook 22 for #4114:agc_driver_reversed_order_blend,agc_shader_memory,agc_driver_graphics,agc_driver_dual_source_blendandagc_driver_swap_alt_blendpass, and the fullctestpasses 1063 of 1063.ctest -R 'agc_shader|agc_driver|shader|recompiler'passes 386 of 386.Rebased onto
mainfdefd7660(66ae60306). #5097 had taken request version 23 and specialization id 8234 for the layer export flag, so the reversed-order blend code moved to version 24; the writer emits the layer flag and then the code, the reader reads the flag from version 23 and the code from version 24, and the module key and specialization constants keep the same order. WSL2 Ubuntu 26.04, lavapipe (Mesa 26.0.8), CI configuration: the five blend and serialization tests pass, and the fullctestpasses 1074 of 1074.Rebased on 2026-10-14 onto
main0b6d033b8(8c9a9396a). Two conflicts:State.cpp: #4862 changed theblendEnableline next to the removed throw and dropped the BLEND_BYPASSRequireat the top of the blend branch. Resolved by keepingmain's line and its removal of theRequire, and removing only the reversed-order throw.docs/dev/debt/libSceAgcDriver.md: #4895 added the INDEX_ATTRIBUTES_INDIRECT entry above the 16-bit RGBA entry this PR edits; both are kept.The added and removed lines against the merge base are the same before and after the rebase; only context lines changed.
mainstill writes request version 23 and its highest pixel specialization id is still 8234, so version 24 and id 8235 stay. #5137's version 21 and 22 trailer handling onmainreads after the pixel info and is unaffected. The refusal is unchanged onmain0b6d033b8. #4782 was closed on 2026-10-14 with its earlier stops (#4834, #4809, #1418) onmainand this stop left to this PR; we did not run GT7.agc_driver_reversed_order_blend,agc_shader_memory,agc_driver_graphics,agc_driver_dual_source_blend,agc_driver_swap_alt_blendandrequest_serializerpass. The fullctestruns 1111 tests with no failures (1068 pass, 43 skip).ANYPS5_REQUIRE_VULKAN=1.Rebased again on 2026-10-14 onto
main1015c55ee(9a8816126). #4201 took request version 24 for the tessellation primitive group size and #4451 took version 25 for a dithered alpha-to-coverage flag written after the layer export flag. That conflicted inRequestSerializer.cpp,Recompiler.hpp,DrawRegisterKey.cppandShaderMemory.cpp. The reversed-order blend code moved to version 26: it follows the dither flag inShaderPixelStageInfoand in the writer, the reader reads it from version 26, andsameDecodecompares both fields.mainhas no specialization id 8235, so it stays; the module key and the specialization constants are unchanged, because #4451 put its flag in the prepared shader key instead.agc_shader_memorynow also reads the version 23 to 25 layouts, andmain'srequest_serializerexpects version 26 with the four extra bytes. Apart from that, the added and removed lines against the merge base are the same as before.mainrefuses alpha-to-coverage into a component-swapped MRT0 target, dithered or not, so #4451's coverage never reads a reversed-order export.agc_driver_reversed_order_blend,agc_shader_memory,agc_driver_graphics,agc_driver_dual_source_blend,agc_driver_swap_alt_blendandrequest_serializerpass. The fullctestruns 1149 tests: 1102 pass, 46 skip for device or display limits, andagc_driver_waterfall_imagesfails SPIR-V validation (DerivativeGroupQuadsKHRwith an 8x1 local size).main1015c55eefails that test the same way in its own linux CI job.request_serializerandagc_shader_memoryfail.Update 2026-10-14 (086613813 and 1d6edc4f0, on top of 9a8816126): the reversed-order path now rounds like the plain blend.
1 - x(and, for some rows, the premultiplied export) in the pixel shader and handed it to the blend as the second color. A plain blend converts the export once and forms1 - xfrom that converted value; the split path converted 0.5 forSRC_COLORand, separately, the shader's1 - 0.5for the destination factor. Vulkan only asks the blend for a precision no lower than the destination's (Blending), so the inputs may sit on the 8-bit grid, and a conversion to that grid may go to either neighbour (fundamentals, conversion to normalized fixed-point: "one of the two ... closest", round to nearest only recommended), and 0.5 · 255 = 127.5 is a tie. With 0.5 converted to 128/255 on both inputs, the plain blend gives 64.25 + 192 · 127/255 = 159.87 → 160 and the split path 64.25 + 192 · 128/255 = 160.63 → 161, which matches the reported values; the RTX 5080 rounds this tie down and stored 160 and 159. So it was not Intel-specific: on the RTX 5080 and lavapipe the old split path differed from the same draw into aSWAP_STDtarget by up to 2 steps on other inputs, and on the RTX 5080 in 27% to 68% of the 16_16_16_16 FLOAT values for every swept control except 0x61000104.ONEsource factor moved into the factor, as1 · xinstead ofx · 1). Vulkan gives the second color no precision rule of its own (Dual-Source Blending), so bit equality with the plain blend rests on the device converting it like the first color. It does on the RTX 5080 and lavapipe, and RADV exports the second color in the first one's format (radv_pipeline_graphics.c); the test checks it on each device instead of widening the bound. Factor combinations that need shader arithmetic throw again, as onmain: of the 1,995 combinations of factors 0-10 (color and separate alpha) that the previous revision computed in the shader, 932 are routed (GT7's 0x65010504 among them) and 1,063 throw. No tolerance was widened.agc_driver_reversed_order_blendalso draws every case into aSWAP_STDtarget, which Vulkan blends alone, and requires identical stored bits, besides the ±1 comparison with the exact blend.agc_driver_graphicschecks every factor combinationTranslateReversedBlendaccepts against the guest equations (121 plain, 932 routed) and that the post-pass emits no arithmetic. With the new test on 9a8816126, the comparison fails on both devices in the first case,0x65010504intoSWAP_STD_REV: 160 whereSWAP_STDstores 159 (channel 1 on the RTX 5080, channel 0 on lavapipe); the ±1 comparison alone passed there. Letting the test continue past failures on the RTX 5080, 14 cases fail on 9a8816126, among them0x61020302with exports outside [0, 1]: channel 2 of pixel (3, 0) holds 159 whereSWAP_STDholds 160, the pixel of the Intel report rounded the other way. 1d6edc4f0 adds0x61010504(SRC_ALPHA + ONE_MINUS_SRC_ALPHA, alphaONE + ONE), which moves the export into the factor; it also fails on 9a8816126.agc_driver_reversed_order_blendpasses 10 of 10 runs andagc_driver_graphics,agc_shader_memory,agc_driver_dual_source_blend,agc_driver_swap_alt_blendandrequest_serializerpass. A local sweep of seven routed controls (export values on and between the 1/255 grid, outside [0, 1], hashed destinations) found 0 of 1,179,648 channel values different fromSWAP_STDper control, format (8_8_8_8 UNORM and 16_16_16_16 FLOAT) and swap on both devices. The full WSLctestruns 1149 tests: 1102 pass, 46 skip for device or display limits, andagc_driver_waterfall_imagesfails as onmain1015c55ee. The fullctestran at 086613813; 1d6edc4f0 changes only the execution test. The branch still merges intomain84b01f9cdwithout conflicts, andmainstill writes request version 25 and has no specialization id 8235.Rebased on 2026-10-14 onto
maine27ff7c54(313c29604). The only conflict wasGraphics/include/State.hpp: #4767 gaveDecodeColorBufferanallowMultisampleDccparameter next to this PR'sReversedBlenddeclarations; both are kept, and every existing call still matches through the default argument. The added and removed lines against the merge base are identical to before.mainstill writes request version 25, so this PR's version 26 and specialization id 8235 stay. WSL2 Ubuntu 26.04, GCC 15.2.0, lavapipe (Mesa 26.0.8), CI configuration:request_serializer,agc_shader_memory,agc_driver_graphics,agc_driver_dual_source_blend,agc_driver_reversed_order_blendandagc_driver_swap_alt_blendpass, andagc_driver_reversed_order_blendpasses 10 of 10 repeats. The fullctestpasses 1189 of 1191; the two failures are the relinker'sfile_writer_binaryandfile_writer_text, which stop withcoreutils: unknown program 'running'because Ubuntu 26.04 ships coreutils as one multi-call program. They are unrelated to this PR, which does not touch the relinker.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-13T16:39:34Z.
agc_driver_reversed_order_blendfails every time on an Intel iGPU, on one value in one case. It passes on NVIDIA.Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU (NVIDIA 595.97) and an Intel Raptor Lake-S iGPU (32.0.101.6790). Both run the split cases, so neither skips for lack of dual-source blending. I tested the head 66ae60306 as pushed, and the earlier 64071f564 merged into
main3b94f923a. The rebase did not change the blend code or the test.Intel: 0 of 10 direct runs pass on either head. Each fails with:
The full suite on 66ae60306 passes 1091 of 1092, and this test is the only failure.
NVIDIA: 10 of 10 runs pass on each head, and the full suite on 64071f564 merged into
mainpasses 1087 of 1087.I ran a local copy of the test that reports every mismatch instead of stopping at the first. On Intel this is the only wrong value. It is wrong in both swaps (
SWAP_STD_REVandSWAP_ALT_REV), in channel 2 of all 4096 pixels whose destination is (128, 64, 192, 255), and nowhere else. That channel exports 0.5, so the expected value is 0.5 × 0.5 × 255 + (1 − 0.5) × 192 = 159.75.For comparison I added
SWAP_STDto that copy. With itreversedBlendis 0, so Vulkan applies the whole blend. Channel 2 of those pixels holds:SWAP_STD)SWAP_STD_REV,SWAP_ALT_REV)So on both GPUs the split rounds this value one step away from the result of the native blend, in opposite directions, and only Intel's result falls outside the ±1 tolerance. With the in-range export (0.125), the same channel reads 172 against 171.98 on both paths and both GPUs.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T03:05:35Z.
agc_driver_reversed_order_blendfails on every one of kr4y4's Intel runs (161 against 159.75, outside the ±1 tolerance). Please make the split blend round like the native one, or show why that case needs a wider tolerance.It also conflicts with main in
State.cppafter #4862; please rebase.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:38:10Z.
Review: CHANGES_REQUESTED
Checked on Linux (lavapipe):
agc_driver_reversed_order_blend,agc_driver_graphicsandagc_shader_memorypass on this head. Two things block the merge:agc_driver_reversed_order_blendfails on an Intel iGPU (161 vs 159.75, tolerance ±1), while the same blend through Vulkan alone gives 160 on both vendors. Either make the split path round like the native one, or show from the Vulkan blend-precision rules why this case needs a wider tolerance and pin it with that reason. Widening it without that leaves the test unable to catch a real regression on that row.main.mainnow writes request version 25 (dithered alpha-to-coverage), so version 24 is taken:RequestSerializer.cpp,Recompiler.hpp,DrawRegisterKey.cppandtests/ShaderMemory.cppconflict. The code needs to move to the next free version and the legacy-request cases inShaderMemory.cppmust keep their layouts. Please rebase after the first point, rerun the five tests you list, and note the new version in the body.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:29:31Z.
Review: CHANGES_REQUESTED
Thanks for the rebase; the version 26 move resolves the conflicts. The first point of the last review is still open:
agc_driver_reversed_order_blendstill compares UNORM8 with<= 1.0(ReversedOrderBlend.cpp:392), and the blend code is unchanged, so the Intel iGPU run reported by @kr4y4 and @oneandonlydean (161 vs 159.75) should still fail. Either make the split path round like the native one, or show from the Vulkan blend-precision rules why this case needs a wider tolerance and pin it with that reason. Widening it without that leaves the test unable to catch a real regression on that row.Checked on Linux with the rebased head:
agc_driver_graphics,agc_shader_memoryandagc_driver_reversed_order_blendpass.Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-14T15:10:29Z.
@adriadam10 Thanks. I took the first option: the split path now rounds like the native blend, and the ±1 bound is unchanged. Thanks also to @kr4y4 for the Intel runs.
Cause of the 161. The previous revision computed the factor in the pixel shader. For
SRC_COLOR + ONE_MINUS_SRC_COLORthe shader wrote1 - 0.5into the second color. A plain blend converts the export once and forms1 - xfrom that converted value. The split path instead converted 0.5 forSRC_COLORand, separately, the shader's1 - 0.5for the destination factor. Vulkan only asks the blend for a precision no lower than the destination's (Blending), so the inputs may sit on the 8-bit grid, and a conversion to that grid may go to either neighbour (round to nearest is only recommended, fundamentals-fpfixedconv). 0.5 · 255 = 127.5 is a tie:So this was not specific to Intel. On the RTX 5080 and lavapipe, the old split path also differed from the same draw into a
SWAP_STDtarget by up to 2 steps on other inputs.What changed (086613813 and 1d6edc4f0, on top of 9a8816126). The pixel shader now only copies the export. Each channel of the second color is the exported alpha, the channel's own export, 0 or 1. An MRT0 channel whose source factor is
ONEmay become 1, with its export moved into the factor. The blend then forms every factor,1 -and product throughSRC1_*/ONE_MINUS_SRC1_*, so it converts the same values a plain blend converts.SRC_COLOR/ONE_MINUS_SRC1_COLORwith the second color(0, own, own, own), so the blend forms1 -the converted 0.5 itself, as in the plain blend, instead of converting a1 - 0.5from the shader.SRC1_COLOR/ONE_MINUS_SRC1_ALPHA,SRC1_ALPHA/ONE_MINUS_SRC1_ALPHAwith(1, a, a, a).main. Of the 1,995 combinations the shader used to compute, 932 are routed and 1,063 throw.What Vulkan does and does not promise here. The two paths now ask the blend for the same expression on the same values; they differ only in that some values arrive as the second color (and, for the
ONEcase above, as1 · xinstead ofx · 1). Vulkan does not say that the second color is converted like the first (Dual-Source Blending gives it no precision rule of its own), so bit equality rests on the device doing so. It holds on the RTX 5080 and lavapipe, and RADV exports the second color in the first one's format (radv_pipeline_graphics.c). That is why the test compares with the device's ownSWAP_STDblend instead of a wider bound.How it was verified.
agc_driver_reversed_order_blendnow also draws every case into aSWAP_STDtarget, which Vulkan blends alone, and requires identical stored bits. The ±1 comparison with the exact blend stays as it was. 1d6edc4f0 adds 0x61010504 (SRC_ALPHA + ONE_MINUS_SRC_ALPHA, alphaONE + ONE), the case that moves the export into the factor.SWAP_STDstores 159). Letting the test continue on the RTX 5080, 14 cases fail, including this row with exports outside [0, 1]: channel 2 of pixel (3, 0) holds 159 whereSWAP_STDholds 160, the pixel of the Intel report rounded the other way.SWAP_STDon both devices, for each of seven routed controls, 8_8_8_8 UNORM and 16_16_16_16 FLOAT, and both swaps.agc_driver_graphicschecks every factor combination the decoder accepts against the guest equations, and checks that the post-pass adds no arithmetic.ctestresults are in the description's update of 2026-10-14.@kr4y4, could you re-run
ctest -R agc_driver_reversed_order_blend --output-on-failureon the Intel iGPU at 1d6edc4f0? If the Intel driver converts the second color differently from the first, theSWAP_STDcomparison will report the pixel and both values.AI-assisted: written with Claude Code; I checked the change and ran the tests described.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T18:06:56Z.
Review: APPROVED
Re-checked 086613813 and 1d6edc4f0: the pixel shader now only copies the export (alpha, own channel, 0/1) into the second color, so the blend forms
1 - xand the products from the same converted values as a plain Vulkan blend, and the ±1 bound stays. The newagc_driver_reversed_order_blendcomparison against the same draw into aSWAP_STDtarget pins this bit for bit, and the combinations that still needed shader arithmetic throw again.Checked on Linux with the merged tree:
agc_driver_graphics,agc_shader_memory,agc_driver_reversed_order_blendandrequest_serializer_testspass; without the change the tests do not compile. Not run here: Intel/AMD hardware (@kr4y4, a rerun of the Intel iGPU on this head would close the original report). Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:10:56Z.
Re-checked 313c29604 after the rebase: the added and removed lines are identical to 1d6edc4f0, which we approved. On the merged tree
agc_driver_graphics,agc_shader_memory,agc_driver_reversed_order_blendand the prepared-graphics tests pass. Not run here: Intel/AMD hardware. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:42:20Z.
maintook request serialization version 26 (linked call fallbacks), which collided with this PR's version 26. We rebased and moved the reversed-order blend code to version 27:RequestSerializer.cpp(reader, writer, accepted range), the base64 prefixes inShaderMemory.cppand the byte offsets inRequestSerializerTests.cpp. We added one commit: the pre-26 fixtures inShaderMemory.cppdrop the 8-byte fallbacks trailer. Otherwise the added and removed lines are the ones we approved.On the rebased tree
request_serializer,agc_shader_memory,agc_driver_graphics,agc_driver_reversed_order_blendand the other AGC driver tests pass;agc_driver_tessellationsegfaults as it does onmain. Not run here: Intel/AMD hardware. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T21:30:22Z.
maintook request serialization version 27 (front-face all-bits flag) and specialization id 8235, which collided with this PR. We rebased and moved the reversed-order blend code to version 28 and id 8236:RequestSerializer.cpp(reader, writer, accepted range),PipelineSpecialization.hpp, the base64 prefixes and the unsupported-version fixture inShaderMemory.cpp, and the byte offsets inRequestSerializerTests.cpp. The version fixtures inShaderMemory.cppnow also replay the version 27 and 26 layouts and drop the 8-byte fallbacks trailer for the older ones. Otherwise the added and removed lines are the ones we approved.On the rebased tree
request_serializer,agc_shader_memory,agc_driver_graphics,agc_driver_reversed_order_blendand the other AGC driver tests pass;agc_driver_tessellationsegfaults as it does onmain. Not run here: Intel/AMD hardware. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:02:34Z.
The full Build on the previous head failed
request_serializeron Windows (abort,0xc0000409). It was our rebase: the "future version" fixture inRequestSerializerTests.cppstill used 28, which is a valid version since we moved the blend code to 28.mainhas also taken request serialization version 28 (quad pixel mask) and 29 (quad sample masks), so we rebased again and moved the reversed-order blend code to version 30, after the quad masks:RequestSerializer.cpp(reader, writer, accepted range), the base64 prefixes and the version 26 to 29 fixtures inShaderMemory.cpp, and the byte offsets and the future version (31) inRequestSerializerTests.cpp. Otherwise the added and removed lines are the ones we approved.On the rebased tree
request_serializer,agc_shader_memory,agc_driver_graphics,agc_driver_reversed_order_blendand the other AGC driver tests pass;agc_driver_tessellationsegfaults as it does onmain. Theagc_interpolant_mappingtimeout in that run is in a test this PR does not touch and passes in 0.01 s here; the next full Build will show whether it repeats. Not run here: Intel/AMD hardware. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T11:13:28Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL2995, L3113, L3238-3242, L3252-3254, L3259, L3262-3264core/shader/recompiler/tests/RequestSerializerTests.cppL209, L248, L273, L275-276, L397, L399-401, L413, L415core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL147core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL1010-1011core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL2995, L3113, L3227, L3234, L3252-3254, L3257-3259core/shader/recompiler/Recompiler.hppL158