Bug 232705 - [GPU Process] [Filters 17/23] Make FilterEffect calculate the primitive subregion only when needed
Summary: [GPU Process] [Filters 17/23] Make FilterEffect calculate the primitive subre...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 231253
  Show dependency treegraph
 
Reported: 2021-11-04 02:40 PDT by Said Abou-Hallawa
Modified: 2021-12-06 16:37 PST (History)
26 users (show)

See Also:


Attachments
Patch (393.13 KB, patch)
2021-11-04 03:04 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (394.50 KB, patch)
2021-11-07 02:16 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (395.09 KB, patch)
2021-11-07 02:20 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (395.15 KB, patch)
2021-11-07 02:58 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (395.42 KB, patch)
2021-11-07 11:58 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (395.21 KB, patch)
2021-11-07 12:17 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch for review (203.45 KB, patch)
2021-11-08 20:37 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (29.42 KB, patch)
2021-12-04 01:49 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (31.55 KB, patch)
2021-12-06 11:02 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (31.57 KB, patch)
2021-12-06 11:03 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (32.08 KB, patch)
2021-12-06 13:19 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2021-11-04 02:40:13 PDT
FilterEffect should be able to calculate and hold only two rectangles:

1) primitiveSubRegion which is defined here https://www.w3.org/TR/filter-effects-1/#FilterPrimitiveSubRegion
2) imageRect which is the rectangle of the result FilterImage.

And to simplify the calculation we can keep these two rectangles as FloatRects and they will be in filter coordinates. But

1) Only when drawing to a FilterImage, we should convert from filter coordinates to absolute coordinates. 
2) And when getting pixels from or putting pixels in a FilterImage, we will convert the FloatRect to a IntRect.

And since the plan is to remove the result FilterImage from the FilterEffect, we are going to keep these rectangles in FilterImage. The conversion from filter coordinates to absolute coordinates will happen through the Filter class.
Comment 1 Said Abou-Hallawa 2021-11-04 03:04:15 PDT
Created attachment 443290 [details]
Patch
Comment 2 Said Abou-Hallawa 2021-11-07 02:16:19 PST
Created attachment 443503 [details]
Patch
Comment 3 Said Abou-Hallawa 2021-11-07 02:20:46 PST
Created attachment 443504 [details]
Patch
Comment 4 Said Abou-Hallawa 2021-11-07 02:58:14 PST
Created attachment 443505 [details]
Patch
Comment 5 Said Abou-Hallawa 2021-11-07 11:58:14 PST
Created attachment 443516 [details]
Patch
Comment 6 Said Abou-Hallawa 2021-11-07 12:17:53 PST
Created attachment 443517 [details]
Patch
Comment 7 Said Abou-Hallawa 2021-11-08 20:37:34 PST
Created attachment 443652 [details]
Patch for review
Comment 8 Radar WebKit Bug Importer 2021-11-11 01:41:20 PST
<rdar://problem/85290142>
Comment 9 Said Abou-Hallawa 2021-12-04 01:49:41 PST
Created attachment 445965 [details]
Patch
Comment 10 Said Abou-Hallawa 2021-12-06 11:02:09 PST
Created attachment 446055 [details]
Patch
Comment 11 Said Abou-Hallawa 2021-12-06 11:03:36 PST
Created attachment 446057 [details]
Patch
Comment 12 Said Abou-Hallawa 2021-12-06 13:19:35 PST
Created attachment 446074 [details]
Patch
Comment 13 Cameron McCormack (:heycam) 2021-12-06 15:35:26 PST
Comment on attachment 446074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446074&action=review

> Source/WebCore/platform/graphics/filters/FilterEffect.cpp:52
> +        for (auto& input : inputs)
> +            primitiveSubregion.unite(input->primitiveSubregion());

I guess we're guaranteed that input's primitive subregion has already been calculated at this point, because of the ordering of the filter effects in the overall expression?
Comment 14 Said Abou-Hallawa 2021-12-06 15:50:45 PST
Comment on attachment 446074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446074&action=review

>> Source/WebCore/platform/graphics/filters/FilterEffect.cpp:52
>> +            primitiveSubregion.unite(input->primitiveSubregion());
> 
> I guess we're guaranteed that input's primitive subregion has already been calculated at this point, because of the ordering of the filter effects in the overall expression?

Yes this correct. In SVGFilter we apply the effects from the SVGFilterExpression which is the post-fix notation of the filter. For CSSFilter we apply the effects from left to right since every effect is the input to the next effect.
Comment 15 EWS 2021-12-06 16:37:04 PST
Committed r286578 (?): <https://commits.webkit.org/r286578>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446074 [details].