-
Notifications
You must be signed in to change notification settings - Fork 6k
Changes DlColor to support wide gamut colors (#54473) #54648
Changes DlColor to support wide gamut colors (#54473) #54648
Conversation
issue: flutter/flutter#127855 integration test: flutter#54415 This is the engine side changes required for wide gamut framework support. It changes the internal representation of DlColor to be floats. It will be married with flutter#54415 when it lands in flutter#54567. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
impeller_Play_AiksTest_BlendModeSrcAlphaColorBurn_Metal still looks very wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I had a question about clamping vs dcheck...
display_list/dl_color.h
Outdated
color_space_(colorspace) {} | ||
color_space_(colorspace) { | ||
FML_DCHECK(alpha >= 0.0); | ||
FML_DCHECK(alpha <= 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we dcheck or clamp? This is currently, in this PR, helping to catch a problem in a test conversion that we crossed paths with, but that bug-in-a-test would have normally been caught by the test creator. If we dcheck then we might annoy someone who calculated the alpha and ended up with a barely-out-of-range value. They could just have easily have provided 255 for one of the color values and we'd take it as a potential non-normalized Color Space float...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than dcheck I think we should clamp right? Certain blend modes (plus) can lead to alpha greater than one without a clamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than dcheck I think we should clamp right? Certain blend modes (plus) can lead to alpha greater than one without a clamp
My concern with that is that it will mask problems like we had where someone is sending in 255 to create a color. The assert forces people creating colors to have a clamp if they are doing arithmetic that will get it out of bounds. I didn't have to change any code as a result of all our tests, so that's a good sign. I think this leaves us in a better position considering we control all the locations where DlColors are created. A public API would be a different story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should clamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the asserts to duplicate the behavior of impeller::Color
. There may be transitory colors that are not valid, clamping or the asserts could mess with that. I don't think we blend with DlColor today, it's more of a transmission format, but I think we plan to use it more broadly in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will be CPU blending once we merge DlColor and impeller::Color. This will happen sooner than you'd think
@jonahwilliams very wrong? The only thing I'm seeing is the checkerboard looks more that 1/255th brighter. I can dig into those colors to see if this is expected. Different colors will be expected since we were converting floats to uint8 before. We don't want to duplicate that behavior. beforeafter |
Here are the before and after colors for SolidColorContents before
after
|
It looks like the grid moved? or changed colors. |
@jonahwilliams oh, yea this was a bug with the old code. This is coming from the same colors defined in
Notice that the old colors would be drawn as ((41/255)/255). Now they are drawn as 41/255. Looking at the test, the intention was actually to draw 41/255. |
ack ack! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Golden file changes are available for triage from new commit, Click here to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…153804) flutter/engine@3d18f65...5cbf96d 2024-08-20 [email protected] Roll Dart SDK from 04c57423f90d to 49f655b526c7 (2 revisions) (flutter/engine#54660) 2024-08-20 [email protected] Roll Skia from b472cacb48d6 to 51d7e221fef0 (2 revisions) (flutter/engine#54656) 2024-08-20 [email protected] Changes DlColor to support wide gamut colors (#54473) (flutter/engine#54648) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#153804) flutter/engine@3d18f65...5cbf96d 2024-08-20 [email protected] Roll Dart SDK from 04c57423f90d to 49f655b526c7 (2 revisions) (flutter/engine#54660) 2024-08-20 [email protected] Roll Skia from b472cacb48d6 to 51d7e221fef0 (2 revisions) (flutter/engine#54656) 2024-08-20 [email protected] Changes DlColor to support wide gamut colors (flutter#54473) (flutter/engine#54648) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
relands #54473
issue: flutter/flutter#127855
integration test: #54415
This is the engine side changes required for wide gamut framework support. It changes the internal representation of DlColor to be floats. It will be married with #54415 when it lands in #54567.
Difference from last attempt
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.