-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Skip mask blur with 0 sigma. #48457
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| #include "impeller/entity/contents/texture_contents.h" | ||
| #include "impeller/entity/contents/vertices_contents.h" | ||
| #include "impeller/entity/geometry/geometry.h" | ||
| #include "impeller/geometry/constants.h" | ||
| #include "impeller/geometry/path_builder.h" | ||
|
|
||
| namespace impeller { | ||
|
|
@@ -202,6 +203,11 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect, | |
| paint.mask_blur_descriptor->style != FilterContents::BlurStyle::kNormal) { | ||
| return false; | ||
| } | ||
| // A blur sigma that is close to zero should not result in any shadow. | ||
| if (paint.mask_blur_descriptor->sigma.sigma <= kEhCloseEnough && | ||
| paint.mask_blur_descriptor->sigma.sigma >= -kEhCloseEnough) { | ||
| return true; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add an early return to SolidRRectBlurContents too? Because there's no guard against zero sigma, nothing is protecting us from div by zero in IPGaussian, so NaNs are probably propagating from the shader and getting mapped to a negative number on the float format we use for wide gamut.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Sorry for the late red light, I just realized what's probably happening here.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! Yes the nan issue, I remember it now. Thanks @bdero :) |
||
|
|
||
| Paint new_paint = paint; | ||
|
|
||
|
|
||
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.
fabsf(paint.mask_blur_descriptor->sigma.sigma) <= kEhCloseEnough?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.
Done