[Webkit-unassigned] [Bug 98396] [CSS Shaders] Make custom filters use a premultiplied buffer for performance optimization.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Oct 4 11:35:07 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=98396
--- Comment #2 from Max Vujovic <mvujovic at adobe.com> 2012-10-04 11:35:34 PST ---
(From update of attachment 167071)
Nice patch!
View in context: https://bugs.webkit.org/attachment.cgi?id=167071&action=review
> Source/WebCore/platform/graphics/filters/FECustomFilter.cpp:227
> + Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult();
When an author is not using the CSS mix function in his or her shader, the author is writing directly to gl_FragColor. For example:
CSS:
-webkit-filter: custom(url(shader.vs) url(shader.fs));
shader.fs:
void main()
{
gl_FragColor = vec4(0.5);
}
In this case, we can't guarantee the author has premultiplied the gl_FragColor output. Thus, we have to add a condition:
Uint8ClampedArray* dstPixelArray = (m_validatedProgram->programInfo().programType == PROGRAM_TYPE_NO_ELEMENT_TEXTURE ? createUnmultipliedImageResult() : createPremultipliedImageResult());
To be clear, PROGRAM_TYPE_NO_ELEMENT_TEXTURE means the author is not using the CSS mix function and is writing directly to gl_FragColor. PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE means the the author is using the CSS mix function and writing to css_MixColor.
> LayoutTests/css3/filters/custom/custom-filter-composite-source-over-expected.html:4
> + <title>Tests the source-over composite operator between source and destination color with alpha.</title>
Nice test! I think this should say:
"Tests the source-atop composite operator when source alpha is a fractional value."
I would also rename the test to something like:
custom-filter-composite-fractional-source-alpha.html
> LayoutTests/css3/filters/custom/custom-filter-composite-source-over.html:42
> + -webkit-filter: custom(none mix(url('../resources/mix-color.fs') normal source-over), mix_color 0.0 0.8 0.5 0.6);
If you land this before bug 97859, you'll want to use source-atop, since we don't have source-over yet.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list