mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This implements part of https://github.com/flutter/flutter/issues/131345 --- Makes all porter-duff draw atlas blending avoid subpass creation, by tweaking the existing porter duff shader to support per-vertex colors and output opacity. This requires a small trick: What the blend shaders and what (drawAtlas/drawVertices) consider the source and destination is reversed. That is a blend mode color filter treats the color as the source whereas drawVertices/drawAtlas treat their per-vertex colors as the destination. Therefore I cannot simply make all color inputs per vertex and use the exact same shaders :( However, for the porter duff blends we should just be able to reverse the blend mode (srcover -> dstOver, xor->xor) (I'm pretty sure I did this correctly) so that the blending is still correct. I don't think we can do this for the advanced blends, but supporting those is less important than the common atlas blending parameters like dstIn. This PR only updates drawAtlas.