Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Will it blend? #33817

Merged
merged 4 commits into from
Jun 4, 2022
Merged

Conversation

bdero
Copy link
Member

@bdero bdero commented Jun 4, 2022

That is the question... and the answer is yes.

Adds all the remaining "separable" blend modes. I plan to land the 4 remaining ("non-separable") blends (Hue, Saturation, Color, and Luminosity) in a separate patch.

Screen.Recording.2022-06-03.at.5.01.56.PM.mov

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Left a few comments inline but they are mostly nits.

return BlendHardLight(dst, src);
}

#include "advanced_blend.glsl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Newline at EOF

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

#include "advanced_blend_utils.glsl"

vec3 Blend(vec3 dst, vec3 src) {
vec3 D = MixComponents(((16 * dst - 12) * dst + 4) * dst, //
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to look up which variant you'd used on Wikipedia. I think it'd be good to document this is W3C variant here. Adding documentation for all blend modes either inline here or in a new doc in the docs/ folder would be great (in a separate patch is fine).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all of these come from https://www.w3.org/TR/compositing-1/#blendingseparable. Added comments to each of these shaders linking the relevant sections. Documenting this along with the blend situation in general seems like a good idea -- I'll start working on a doc add it in a later patch.

@bdero bdero force-pushed the bdero/add-seperable-blends branch from 2c26386 to ae5cb9d Compare June 4, 2022 02:00
@bdero bdero merged commit 356618c into flutter:main Jun 4, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2022
houhuayong pushed a commit to houhuayong/engine that referenced this pull request Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants