WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
93623
[CSS Shaders] Add blend mode and composite op to compiled program cache key
https://bugs.webkit.org/show_bug.cgi?id=93623
Summary
[CSS Shaders] Add blend mode and composite op to compiled program cache key
Max Vujovic
Reported
2012-08-09 09:50:35 PDT
Right now, only the vertex shader string and the fragment shader string are hashed to create a key for the compiled program. However, when authors use the mix function to specify a blend mode and/or composite op for a fragment shader, WebKit will rewrite the fragment shader based on the blend mode and composite op. This means the unique key for a compiled program is (original vertex shader string, original fragment shader string, blend mode, composite operator). This patch will include blend mode and composite operator in the hash for the key.
Attachments
Patch
(14.02 KB, patch)
2012-08-09 10:13 PDT
,
Max Vujovic
no flags
Details
Formatted Diff
Diff
Patch
(16.03 KB, patch)
2012-08-09 17:00 PDT
,
Max Vujovic
no flags
Details
Formatted Diff
Diff
Patch
(8.07 KB, patch)
2012-08-10 11:46 PDT
,
Max Vujovic
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Max Vujovic
Comment 1
2012-08-09 10:13:47 PDT
Created
attachment 157477
[details]
Patch Alex, could you take a look at this patch? Especially the hash computation in CustomFilterProgramInfo::hash(). I was debating between a bunch of ways we could do the hash- I want your opinion on it.
Alexandru Chiculita
Comment 2
2012-08-09 13:17:49 PDT
Comment on
attachment 157477
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=157477&action=review
Looks good. Just a few comments.
> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:43 > + , compositeOperator(CompositeSourceOver)
nit: Identation here.
> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:49 > + return enabled == o.enabled
I think enabled == o.enabled && enabled == false should ignore the other two properties. Right?
> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:57 > +} CustomFilterProgramMixSettings;
Why do you need this instance?
> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.cpp:72 > +CustomFilterProgramInfo::CustomFilterProgramInfo(const String& vertexShader, const String& fragmentShader, CustomFilterProgramMixSettings mixSettings)
I would pass a const ref here.
> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.cpp:86 > + unsigned hash = hashPossiblyNullString(m_vertexShaderString);
This would look better if you encapsulated it into a separate class: HashBuilder hash; hash.append(m_vertexShaderString); hash.append(m_fragmentShaderString); ... hash.toUnsigned();
> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.h:46 > + CustomFilterProgramInfo(const String&, const String&, CustomFilterProgramMixSettings);
const& in here.
Max Vujovic
Comment 3
2012-08-09 17:00:55 PDT
Created
attachment 157583
[details]
Patch Updated patch based on Alex's comments.
Max Vujovic
Comment 4
2012-08-09 17:05:23 PDT
Comment on
attachment 157477
[details]
Patch Thanks for the review, Alex. Responses inline: View in context:
https://bugs.webkit.org/attachment.cgi?id=157477&action=review
>> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:43 >> + , compositeOperator(CompositeSourceOver) > > nit: Identation here.
Thanks. Done.
>> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:49 >> + return enabled == o.enabled > > I think enabled == o.enabled && enabled == false should ignore the other two properties. Right?
Yeah, that would be more robust. Done.
>> Source/WebCore/platform/graphics/CustomFilterProgramMixSettings.h:57 >> +} CustomFilterProgramMixSettings; > > Why do you need this instance?
It's a typedef, but I removed it now. (It's old C habit of mine to typedef structs.)
>> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.cpp:72 >> +CustomFilterProgramInfo::CustomFilterProgramInfo(const String& vertexShader, const String& fragmentShader, CustomFilterProgramMixSettings mixSettings) > > I would pass a const ref here.
Done.
>> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.cpp:86 >> + unsigned hash = hashPossiblyNullString(m_vertexShaderString); > > This would look better if you encapsulated it into a separate class: > > HashBuilder hash; > hash.append(m_vertexShaderString); > hash.append(m_fragmentShaderString); > ... > > hash.toUnsigned();
I found something similar to a HashBuilder in StringHasher::hashMemory. I use that instead now, so it should look a lot better.
>> Source/WebCore/platform/graphics/filters/CustomFilterProgramInfo.h:46 >> + CustomFilterProgramInfo(const String&, const String&, CustomFilterProgramMixSettings); > > const& in here.
Done.
Max Vujovic
Comment 5
2012-08-10 09:36:41 PDT
Comment on
attachment 157583
[details]
Patch Bots are green. Setting r?, cq?.
Dirk Schulze
Comment 6
2012-08-10 10:43:39 PDT
Comment on
attachment 157583
[details]
Patch Do you need to create a new header for this struct? Can't you put it into CustomFilterProgramInfo.h? Other than that the patch looks fine.
Max Vujovic
Comment 7
2012-08-10 11:46:16 PDT
Created
attachment 157779
[details]
Patch (In reply to
comment #6
)
> (From update of
attachment 157583
[details]
) > Do you need to create a new header for this struct? Can't you put it into CustomFilterProgramInfo.h? Other than that the patch looks fine.
It doesn't need a new header file. I've updated the patch and moved it to CustomFilterProgramInfo.h. I've also made one other change since the last patch. I've added m_mixSettings.enabled to the hash because I realized the following (a) and (b) were hashing to the same value without it: (a) m_mixSettings.enabled=1 m_mixSettings.blendMode=0 m_mixSettings.compositeOperator=0 (b) m_mixSettings.enabled=0 m_mixSettings.blendMode=anything m_mixSettings.compositeOperator=anything
Dirk Schulze
Comment 8
2012-08-10 14:09:03 PDT
Comment on
attachment 157779
[details]
Patch LGTM. r=me.
WebKit Review Bot
Comment 9
2012-08-10 15:16:08 PDT
Comment on
attachment 157779
[details]
Patch Clearing flags on attachment: 157779 Committed
r125331
: <
http://trac.webkit.org/changeset/125331
>
WebKit Review Bot
Comment 10
2012-08-10 15:16:11 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug