RESOLVED FIXED 100533
[CSS Shaders] CustomFilterOperation should be converted to ValidatedCustomFilterOperation before using it
https://bugs.webkit.org/show_bug.cgi?id=100533
Summary [CSS Shaders] CustomFilterOperation should be converted to ValidatedCustomFil...
Alexandru Chiculita
Reported 2012-10-26 09:26:03 PDT
CustomFilterOperation is too hard to use in platform code and we need a simplified version of it. This bug will create a new class called ValidatedCustomFilterOperation and use that instead of the CustomFilterOperation in the platform code. The difference between CustomFilterOperation and ValidatedCustomFilterOperation is that the later already has the shaders loaded and verified to comply with the specification. At that point the shaders should be ready to be used in a WebGL compliant context.
Attachments
Patch V1 (13.31 KB, patch)
2012-10-31 17:07 PDT, Alexandru Chiculita
dino: review+
Patch V2 (16.90 KB, patch)
2012-11-01 16:21 PDT, Alexandru Chiculita
dino: review+
gtk-ews: commit-queue-
Alexandru Chiculita
Comment 1 2012-10-31 17:07:54 PDT
Created attachment 171743 [details] Patch V1
Dean Jackson
Comment 2 2012-11-01 14:16:19 PDT
Comment on attachment 171743 [details] Patch V1 View in context: https://bugs.webkit.org/attachment.cgi?id=171743&action=review > Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.h:66 > + CustomFilterMeshType meshType() const { return m_meshType; } > private: Nit: space between these lines > Source/WebCore/rendering/FilterEffectRenderer.cpp:342 > + // CUSTOM operations are alwasy converted to VALIDATED_CUSTOM before getting here. typo "always"
Alexandru Chiculita
Comment 3 2012-11-01 16:21:04 PDT
Created attachment 171950 [details] Patch V2 Sorry, I noticed that there was an issue with the old patch. I've split updateOrRemoveFilterEffect and removed the assert_not_reached in computeFilterOperations (I've added a comment to explain why).
Dean Jackson
Comment 4 2012-11-01 16:23:56 PDT
Comment on attachment 171950 [details] Patch V2 View in context: https://bugs.webkit.org/attachment.cgi?id=171950&action=review > Source/WebCore/ChangeLog:44 > + layer is updated. Otherwise the composited layer will never see a loaded filter in the first call. > + > + (WebCore): > + (WebCore::RenderLayer::isCSSCustomFilterEnabled): > + (WebCore::RenderLayer::computeFilterOperations): > + (WebCore::RenderLayer::updateOrRemoveFilterClients): Split updateOrRemoveFilterEffect into 2 functions. > + This one is supposed to add the clients needed to load network resources. > + > + (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Figures out if a software fallback is needed > + and creates a FilterEffectRenderer. > + > + * rendering/RenderLayer.h: You have a few blank lines in there. > Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.h:68 > + CustomFilterMeshType meshType() const { return m_meshType; } > private: > + > virtual bool operator==(const FilterOperation& o) const I actually was asking for the empty line between meshType() and private :)
kov's GTK+ EWS bot
Comment 5 2012-11-01 16:28:45 PDT
Early Warning System Bot
Comment 6 2012-11-01 16:29:53 PDT
Comment on attachment 171950 [details] Patch V2 Attachment 171950 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/14697446
Dongseong Hwang
Comment 7 2012-11-01 16:48:02 PDT
Comment on attachment 171950 [details] Patch V2 View in context: https://bugs.webkit.org/attachment.cgi?id=171950&action=review > Source/WebCore/rendering/RenderLayer.cpp:5126 > + RefPtr<CustomFilterValidatedProgram> validatedProgram = globalContext->getValidatedProgram(program->programInfo()); As you filed Bug 100906, all Accelerated Compositings(a.k.a AC) do not want to compile here, because AC can not use the same GraphicsContext3D belonging to CustomFilterGlobalContext. AC would compile shaders again. I think "PassRefPtr<FECustomFilter> createCustomFilterEffect() in FilterEffectRenderer" should compile in software path. And each AC will compile in their own code. Will you fix this in Bug 100906 later?
Build Bot
Comment 8 2012-11-01 16:55:13 PDT
Alexandru Chiculita
Comment 9 2012-11-01 17:05:39 PDT
The other patch got landed first, so I've updated the FilterEffectRenderer to use the new constant style. 100890 will actually add the new mesh box type. Landed in http://trac.webkit.org/changeset/133242.
Dongseong Hwang
Comment 10 2012-11-01 17:11:54 PDT
Comment on attachment 171950 [details] Patch V2 View in context: https://bugs.webkit.org/attachment.cgi?id=171950&action=review >> Source/WebCore/rendering/RenderLayer.cpp:5126 >> + RefPtr<CustomFilterValidatedProgram> validatedProgram = globalContext->getValidatedProgram(program->programInfo()); > > As you filed Bug 100906, all Accelerated Compositings(a.k.a AC) do not want to compile here, because AC can not use the same GraphicsContext3D belonging to CustomFilterGlobalContext. AC would compile shaders again. > I think "PassRefPtr<FECustomFilter> createCustomFilterEffect() in FilterEffectRenderer" should compile in software path. > And each AC will compile in their own code. > > Will you fix this in Bug 100906 later? I said the wrong fact. We do not compile here, but we still have the similar problem. CustomFilterGlobalContext has two roles: supplying GraphicsContext3D and caching CustomFilterValidatedProgram (especially caching gl compiled program to not recompile). I think we do not use CustomFilterGlobalContext here because AC can not use CustomFilterGlobalContext owned by RenderView. ValidatedCustomFilterOperation should not know CustomFilterValidatedProgram. ValidatedCustomFilterOperation should know just validated program strings as you filed Bug 100906. We need to perform "RefPtr<CustomFilterValidatedProgram> validatedProgram = globalContext->getValidatedProgram(program->programInfo());" in "PassRefPtr<FECustomFilter> createCustomFilterEffect() in FilterEffectRenderer" Each AC can use CustomFilterGlobalContext and perform "globalContext->getValidatedProgram()" in its own code too. Finally, Thanks for this patch!
Alexandru Chiculita
Comment 11 2012-11-01 17:19:55 PDT
(In reply to comment #10) > (From update of attachment 171950 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=171950&action=review > > >> Source/WebCore/rendering/RenderLayer.cpp:5126 > >> + RefPtr<CustomFilterValidatedProgram> validatedProgram = globalContext->getValidatedProgram(program->programInfo()); > > > > As you filed Bug 100906, all Accelerated Compositings(a.k.a AC) do not want to compile here, because AC can not use the same GraphicsContext3D belonging to CustomFilterGlobalContext. AC would compile shaders again. > > I think "PassRefPtr<FECustomFilter> createCustomFilterEffect() in FilterEffectRenderer" should compile in software path. > > And each AC will compile in their own code. > > > > Will you fix this in Bug 100906 later? > > I said the wrong fact. We do not compile here, but we still have the similar problem. > > CustomFilterGlobalContext has two roles: supplying GraphicsContext3D and caching CustomFilterValidatedProgram (especially caching gl compiled program to not recompile). > > I think we do not use CustomFilterGlobalContext here because AC can not use CustomFilterGlobalContext owned by RenderView. > ValidatedCustomFilterOperation should not know CustomFilterValidatedProgram. ValidatedCustomFilterOperation should know just validated program strings as you filed Bug 100906. > We need to perform "RefPtr<CustomFilterValidatedProgram> validatedProgram = globalContext->getValidatedProgram(program->programInfo());" in "PassRefPtr<FECustomFilter> createCustomFilterEffect() in FilterEffectRenderer" > Each AC can use CustomFilterGlobalContext and perform "globalContext->getValidatedProgram()" in its own code too. > > Finally, Thanks for this patch! In https://bugs.webkit.org/show_bug.cgi?id=100906 I will add a base class to be used by the ValidatedCustomFilterProgram. In the webkit process it will keep a reference to the Validated program. That way we have a reference to the caching system. The UI process will keep a reference to the other class that will just store empty strings. The advantage is that the validated program can actually keep a reference to the class that stores the strings, using the platform program. That way we could keep and id instead of serializing the shader every time. I will do that one too and then you will need to update your rendering patches.
Dongseong Hwang
Comment 12 2012-11-01 17:34:09 PDT
(In reply to comment #11) > That way we could keep and id instead of serializing the shader every time. Good idea! > I will do that one too and then you will need to update your rendering patches. Yes, I will.
Note You need to log in before you can comment on or make changes to this bug.