Title: [139731] trunk/Source/WebCore
Revision
139731
Author
[email protected]
Date
2013-01-15 02:01:57 -0800 (Tue, 15 Jan 2013)

Log Message

[Qt][CSS Shaders] Make custom filter render in Wk1 mode
https://bugs.webkit.org/show_bug.cgi?id=101532

Reviewed by Noam Rosenthal.

Handle ValidatedCustomFilterOperations which are used by WebKit1. To keep the cache of compiled programs working,
the cache has been updated to use CustomFilterProgramInfo as a hash key. CustomFilterProgramInfo is an existing
class specifically designed for this purpose.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::getPassesRequiredForFilter):
(WebCore::TextureMapperGL::removeCachedCustomFilterProgram):
(WebCore::TextureMapperGL::drawUsingCustomFilter):
(WebCore::BitmapTextureGL::applyFilters):
* platform/graphics/texmap/TextureMapperGL.h:
(TextureMapperGL):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139730 => 139731)


--- trunk/Source/WebCore/ChangeLog	2013-01-15 09:51:00 UTC (rev 139730)
+++ trunk/Source/WebCore/ChangeLog	2013-01-15 10:01:57 UTC (rev 139731)
@@ -1,3 +1,22 @@
+2013-01-15  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt][CSS Shaders] Make custom filter render in Wk1 mode
+        https://bugs.webkit.org/show_bug.cgi?id=101532
+
+        Reviewed by Noam Rosenthal.
+
+        Handle ValidatedCustomFilterOperations which are used by WebKit1. To keep the cache of compiled programs working, 
+        the cache has been updated to use CustomFilterProgramInfo as a hash key. CustomFilterProgramInfo is an existing
+        class specifically designed for this purpose.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::getPassesRequiredForFilter):
+        (WebCore::TextureMapperGL::removeCachedCustomFilterProgram):
+        (WebCore::TextureMapperGL::drawUsingCustomFilter):
+        (WebCore::BitmapTextureGL::applyFilters):
+        * platform/graphics/texmap/TextureMapperGL.h:
+        (TextureMapperGL):
+
 2013-01-15  Andrey Adaikin  <[email protected]>
 
         Web Inspector: [Canvas] introduce CallArgument type into the protocol

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (139730 => 139731)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2013-01-15 09:51:00 UTC (rev 139730)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2013-01-15 10:01:57 UTC (rev 139731)
@@ -736,6 +736,7 @@
     case FilterOperation::OPACITY:
 #if ENABLE(CSS_SHADERS)
     case FilterOperation::CUSTOM:
+    case FilterOperation::VALIDATED_CUSTOM:
 #endif
         return 1;
     case FilterOperation::BLUR:
@@ -843,7 +844,7 @@
 #if ENABLE(CSS_SHADERS)
 void TextureMapperGL::removeCachedCustomFilterProgram(CustomFilterProgram* program)
 {
-    m_customFilterPrograms.remove(program);
+    m_customFilterPrograms.remove(program->programInfo());
 }
 
 bool TextureMapperGL::drawUsingCustomFilter(BitmapTexture& target, const BitmapTexture& source, const FilterOperation& filter)
@@ -858,10 +859,10 @@
         renderer = CustomFilterRenderer::create(m_context3D, program->programType(), customFilter->parameters(), 
             customFilter->meshRows(), customFilter->meshColumns(), customFilter->meshType());
         RefPtr<CustomFilterCompiledProgram> compiledProgram;
-        CustomFilterProgramMap::iterator iter = m_customFilterPrograms.find(program.get());
+        CustomFilterProgramMap::iterator iter = m_customFilterPrograms.find(program->programInfo());
         if (iter == m_customFilterPrograms.end()) {
             compiledProgram = CustomFilterCompiledProgram::create(m_context3D, program->vertexShaderString(), program->fragmentShaderString(), program->programType());
-            m_customFilterPrograms.set(program.get(), compiledProgram);
+            m_customFilterPrograms.set(program->programInfo(), compiledProgram);
         } else
             compiledProgram = iter->value;
         renderer->setCompiledProgram(compiledProgram.release());
@@ -869,9 +870,19 @@
     }
     case FilterOperation::VALIDATED_CUSTOM: {
         // WebKit1 uses the ValidatedCustomFilterOperation.
-        // FIXME: This path is not working yet as GraphicsContext3D fails to initialize.
-        // https://bugs.webkit.org/show_bug.cgi?id=101532
-        return false;
+        const ValidatedCustomFilterOperation* customFilter = static_cast<const ValidatedCustomFilterOperation*>(&filter);
+        RefPtr<CustomFilterValidatedProgram> program = customFilter->validatedProgram();
+        renderer = CustomFilterRenderer::create(m_context3D, program->programInfo().programType(), customFilter->parameters(),
+            customFilter->meshRows(), customFilter->meshColumns(), customFilter->meshType());
+        RefPtr<CustomFilterCompiledProgram> compiledProgram;
+        CustomFilterProgramMap::iterator iter = m_customFilterPrograms.find(program->programInfo());
+        if (iter == m_customFilterPrograms.end()) {
+            compiledProgram = CustomFilterCompiledProgram::create(m_context3D, program->validatedVertexShader(), program->validatedFragmentShader(), program->programInfo().programType());
+            m_customFilterPrograms.set(program->programInfo(), compiledProgram);
+        } else
+            compiledProgram = iter->value;
+        renderer->setCompiledProgram(compiledProgram.release());
+        break;
     }
     default:
         ASSERT_NOT_REACHED();
@@ -926,7 +937,7 @@
             textureMapperGL->bindSurface(target.get());
             const BitmapTexture& sourceTexture = useContentTexture ? contentTexture : *source;
 #if ENABLE(CSS_SHADERS)
-            if (filter->getOperationType() == FilterOperation::CUSTOM) {
+            if (filter->getOperationType() == FilterOperation::CUSTOM || filter->getOperationType() == FilterOperation::VALIDATED_CUSTOM) {
                 if (textureMapperGL->drawUsingCustomFilter(*target, sourceTexture, *filter)) {
                     // Only swap if the draw was successful.
                     std::swap(source, target);

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (139730 => 139731)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h	2013-01-15 09:51:00 UTC (rev 139730)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h	2013-01-15 10:01:57 UTC (rev 139731)
@@ -22,6 +22,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
+#include "CustomFilterProgramInfo.h"
 #include "FloatQuad.h"
 #include "GraphicsContext3D.h"
 #include "IntSize.h"
@@ -117,7 +118,7 @@
     bool m_enableEdgeDistanceAntialiasing;
 
 #if ENABLE(CSS_SHADERS)
-    typedef HashMap<CustomFilterProgram*, RefPtr<CustomFilterCompiledProgram> > CustomFilterProgramMap;
+    typedef HashMap<CustomFilterProgramInfo, RefPtr<CustomFilterCompiledProgram> > CustomFilterProgramMap;
     CustomFilterProgramMap m_customFilterPrograms;
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to