Bug 233487 - [GPU Process] [Filters 10/23] Make FilterEffect appliers take FilterImages in their apply() methods
Summary: [GPU Process] [Filters 10/23] Make FilterEffect appliers take FilterImages in...
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-24 21:50 PST by Said Abou-Hallawa
Modified: 2021-11-29 21:34 PST (History)
16 users (show)

See Also:


Attachments
Patch (101.56 KB, patch)
2021-11-24 22:03 PST, Said Abou-Hallawa
heycam: review+
Details | Formatted Diff | Diff
Patch (101.29 KB, patch)
2021-11-25 02:34 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-24 21:50:23 PST
Eventually the FilterImage will be removed from FilterEffect. So this is a step towards making the FilterEffect hold the effect data only. To do this change, FilterImage needs to hold two new members: primitiveSubregion and isAlphaImage.
Comment 1 Said Abou-Hallawa 2021-11-24 22:03:23 PST
Created attachment 445118 [details]
Patch
Comment 2 Cameron McCormack (:heycam) 2021-11-24 22:54:48 PST
Comment on attachment 445118 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        his change, FilterImage needs to hold two new members: primitiveSubregion

"this change"

> Source/WebCore/ChangeLog:13
> +        FilterEffect::setIsAlphaImage() is not needed and isAlphaImage() will be

"will be a"

> Source/WebCore/platform/graphics/filters/FEBlend.cpp:56
> +    FilterImageVector inputs { { *inputEffect(0)->filterImage() }, { *inputEffect(1)->filterImage() } };

Are the inner braces needed? The Ref constructor that takes a T& is not explicit, so I think they shouldn't be needed. (Throughout this patch.)

Also: maybe this helps subsequent patches in your queue, but wouldn't it be easier to have a function that returns the FilterImageVector by iterating over m_inputEffects and calling `filterImage()` on them all (called `inputEffectImages()` or `inputImages()`)? Is there an advantage to grabbing out input effect #0 and input effect #1 here explicitly?

> Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp:96
> +bool FEColorMatrix::isAlphaImage() const

Since we're separating the effects from the images, maybe this should be called "producesAlphaImage", something that sounds less like the effect object is an image itself.

> Source/WebCore/platform/graphics/filters/FEMerge.cpp:46
> +    FilterImageVector inputs;
> +
> +    for (auto& inputEffect : inputEffects())
> +        inputs.append({ *inputEffect->filterImage() });

(Something like this, as a member function on effect objects, is what I was thinking.)
Comment 3 Said Abou-Hallawa 2021-11-25 02:34:00 PST
Created attachment 445128 [details]
Patch
Comment 4 Said Abou-Hallawa 2021-11-25 02:35:42 PST
Comment on attachment 445118 [details]
Patch

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

>> Source/WebCore/platform/graphics/filters/FEBlend.cpp:56
>> +    FilterImageVector inputs { { *inputEffect(0)->filterImage() }, { *inputEffect(1)->filterImage() } };
> 
> Are the inner braces needed? The Ref constructor that takes a T& is not explicit, so I think they shouldn't be needed. (Throughout this patch.)
> 
> Also: maybe this helps subsequent patches in your queue, but wouldn't it be easier to have a function that returns the FilterImageVector by iterating over m_inputEffects and calling `filterImage()` on them all (called `inputEffectImages()` or `inputImages()`)? Is there an advantage to grabbing out input effect #0 and input effect #1 here explicitly?

Done.

>> Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp:96
>> +bool FEColorMatrix::isAlphaImage() const
> 
> Since we're separating the effects from the images, maybe this should be called "producesAlphaImage", something that sounds less like the effect object is an image itself.

Done. But I named resultIsAlphaImage() to be consistent with resultColorSpace().
Comment 5 EWS 2021-11-25 03:44:51 PST
Committed r286164 (244547@main): <https://commits.webkit.org/244547@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445128 [details].
Comment 6 Radar WebKit Bug Importer 2021-11-25 03:45:40 PST
<rdar://problem/85748077>