Bug 101801 - [Texmap][CSS Shaders] Reuse the precompiled shader for custom filters in TextureMapperGL
Summary: [Texmap][CSS Shaders] Reuse the precompiled shader for custom filters in Text...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexandru Chiculita
URL:
Keywords:
Depends on: 98990 102414
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-09 14:44 PST by Alexandru Chiculita
Modified: 2012-11-17 18:14 PST (History)
5 users (show)

See Also:


Attachments
Patch V1 (28.51 KB, patch)
2012-11-17 07:27 PST, Alexandru Chiculita
noam: review-
noam: commit-queue-
Details | Formatted Diff | Diff
Patch V2 (34.55 KB, patch)
2012-11-17 16:31 PST, Alexandru Chiculita
noam: review+
noam: commit-queue-
Details | Formatted Diff | Diff
Patch V3 (36.16 KB, patch)
2012-11-17 17:44 PST, Alexandru Chiculita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandru Chiculita 2012-11-09 14:44:16 PST
The shader is always recompiled before paint. Add code to cache the shader at least until next paint.
Comment 1 Alexandru Chiculita 2012-11-17 07:27:13 PST
Created attachment 174817 [details]
Patch V1
Comment 2 Noam Rosenthal 2012-11-17 09:50:05 PST
Comment on attachment 174817 [details]
Patch V1

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

Great progress, see comments.

> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:152
> +            WebCustomFilterProgramProxy* customFilterProgramProxy = static_cast<WebCustomFilterProgramProxy*>(program->platformCompiledProgram()->client());

This seems a bit messy... I am sure we have enough information in LayerTreeCoordinator to know which shaders we have to send.

> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:159
> +            if (!customFilterProgramProxy->wasSentToUIProcess()) {

I would prefer if we sent all the new programs to the Ui process in LayerTreeCoordinator rather than here with an if condition.

> Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.h:75
> +    bool wasSentToUIProcess() const  { return m_wasSentToUIProcess; }

Sent you went through the trouble of creating this class, maybe it should also do its own encoding/decoding rather than leave it to CoordinatedGraphicsArgumentCoders.

> Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:292
> +    injectCachedCustomFilterPrograms(const_cast<FilterOperations&>(filters));

Would be cleaner to create a local copy and inject to it rather than const_cast
Comment 3 Alexandru Chiculita 2012-11-17 13:44:42 PST
(In reply to comment #2)
> (From update of attachment 174817 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174817&action=review
> 
> Great progress, see comments.

Thanks Noam, your comments make sense. I will integrate the feedback and upload again.
Comment 4 Alexandru Chiculita 2012-11-17 16:31:46 PST
Created attachment 174832 [details]
Patch V2

Integrated the feedback.
Comment 5 Noam Rosenthal 2012-11-17 16:44:18 PST
Comment on attachment 174832 [details]
Patch V2

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

Very nice!
Some pre-landing nits below...

> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:270
> +            int programId = 0;
> +            if (!decoder->decode(programId))

programID

> Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterOperation.h:50
> +    int programId() const { return m_programId; }

programID()
and m_programID
(WebKit style)

> Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:313
> +        }
> +        WebCustomFilterOperation* customOperation = static_cast<WebCustomFilterOperation*>(operation);

Add line break

> Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:319
> +        if (iter == m_customFilterPrograms.end()) {
> +            ASSERT_NOT_REACHED();
> +            continue;
> +        }

ASSERT(iter != m_customFilterPrograms.end())

> Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:338
> +    if (iter == m_customFilterPrograms.end()) {
> +        ASSERT_NOT_REACHED();
> +        return;
> +    }

Ditto
Comment 6 Noam Rosenthal 2012-11-17 17:01:08 PST
btw we should probably call checkCustomFilterProgramProxies for filter operations inside an animation, otherwise those might not be rendered correctly.
Comment 7 Alexandru Chiculita 2012-11-17 17:05:18 PST
(In reply to comment #6)
> btw we should probably call checkCustomFilterProgramProxies for filter operations inside an animation, otherwise those might not be rendered correctly.

Hm.. didn't know the filter animations are accelerated on Texture Mapper. Will do.
Comment 8 Alexandru Chiculita 2012-11-17 17:44:48 PST
Created attachment 174835 [details]
Patch V3

I've added the animations fix, so I've set the CQ+ flag again.

@Noam: is there an automatic way to test the composited animations?
Comment 9 Noam Rosenthal 2012-11-17 17:47:43 PST
(In reply to comment #8)
> @Noam: is there an automatic way to test the composited animations?

Unfortunately not really quite yet, we would need good support for taking several pixel snapshots for the same page and that's tricky.
Comment 10 WebKit Review Bot 2012-11-17 18:14:16 PST
Comment on attachment 174835 [details]
Patch V3

Clearing flags on attachment: 174835

Committed r135056: <http://trac.webkit.org/changeset/135056>
Comment 11 WebKit Review Bot 2012-11-17 18:14:20 PST
All reviewed patches have been landed.  Closing bug.