Title: [94359] trunk/Source/WebKit/chromium
Revision
94359
Author
[email protected]
Date
2011-09-01 16:25:04 -0700 (Thu, 01 Sep 2011)

Log Message

[Chromium, Skia] Add virtual to WebGraphicsContext3D to create a new GrGLInterface per context. Insert per-skia-GL-function callback to set correct GL context.
https://bugs.webkit.org/show_bug.cgi?id=67395

Patch by Brian Salomon <[email protected]> on 2011-09-01
Reviewed by Kenneth Russell.

* WebKit.gyp:
* public/WebGraphicsContext3D.h:
(WebKit::WebGraphicsContext3D::onCreateGrGLInterface):
* src/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3DPrivate::grContext):
* src/WebGraphicsContext3D.cpp: Added.
(WebKit::WebGraphicsContext3D::createGrGLInterface):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (94358 => 94359)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-01 23:22:03 UTC (rev 94358)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-01 23:25:04 UTC (rev 94359)
@@ -1,3 +1,18 @@
+2011-09-01  Brian Salomon  <[email protected]>
+
+        [Chromium, Skia] Add virtual to WebGraphicsContext3D to create a new GrGLInterface per context. Insert per-skia-GL-function callback to set correct GL context.
+        https://bugs.webkit.org/show_bug.cgi?id=67395
+
+        Reviewed by Kenneth Russell.
+
+        * WebKit.gyp:
+        * public/WebGraphicsContext3D.h:
+        (WebKit::WebGraphicsContext3D::onCreateGrGLInterface):
+        * src/GraphicsContext3DChromium.cpp:
+        (WebCore::GraphicsContext3DPrivate::grContext):
+        * src/WebGraphicsContext3D.cpp: Added.
+        (WebKit::WebGraphicsContext3D::createGrGLInterface):
+
 2011-08-29  Nat Duca  <[email protected]>
 
         [chromium] Introduce CCSingleThreadProxy in order to move LayerRenderer to CCLayerTreeHostImpl

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (94358 => 94359)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-01 23:22:03 UTC (rev 94358)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-01 23:25:04 UTC (rev 94359)
@@ -486,6 +486,7 @@
                 'src/WebGeolocationPermissionRequestManager.cpp',
                 'src/WebGeolocationPosition.cpp',
                 'src/WebGlyphCache.cpp',
+                'src/WebGraphicsContext3D.cpp',
                 'src/WebHistoryItem.cpp',
                 'src/WebHTTPBody.cpp',
                 'src/WebHTTPLoadInfo.cpp',

Modified: trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h (94358 => 94359)


--- trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h	2011-09-01 23:22:03 UTC (rev 94358)
+++ trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h	2011-09-01 23:25:04 UTC (rev 94359)
@@ -361,8 +361,17 @@
     virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ }
 
 #if WEBKIT_USING_SKIA
+    // FIXME: This function is superceded by onCreateGrGLInterface. It should be removed after subclass implementations are removed from Chromium.
     virtual GrGLInterface* grGLInterface() { return 0; }
+
+    GrGLInterface* createGrGLInterface();
 #endif
+
+protected:
+#if WEBKIT_USING_SKIA
+    virtual GrGLInterface* onCreateGrGLInterface() { return 0; }
+#endif
+
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp (94358 => 94359)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-09-01 23:22:03 UTC (rev 94358)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-09-01 23:25:04 UTC (rev 94359)
@@ -63,6 +63,7 @@
 
 #if USE(SKIA)
 #include "GrContext.h"
+#include "GrGLInterface.h"
 #endif
 
 // There are two levels of delegation in this file:
@@ -161,8 +162,17 @@
     static const size_t maxTextureCacheBytes = 50 * 1024 * 1024;
 
     if (!m_grContext) {
-        GrPlatform3DContext glinterface = reinterpret_cast<GrPlatform3DContext>(m_impl->grGLInterface());
-        m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, glinterface);
+        SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
+        // FIXME: Remove this block after the WebGraphicsContext3D subclasses in Chromium no longer override grGLInterface().
+        if (!interface.get()) {
+            GrGLInterface* fallbackInterface = m_impl->grGLInterface();
+            if (fallbackInterface) {
+                fallbackInterface->ref(); // balance out the SkAutoTUnref
+                interface.reset(fallbackInterface);
+            }
+        }
+        // This is the end of the block to remove.
+        m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get()));
         if (m_grContext)
             m_grContext->setTextureCacheLimits(maxTextureCacheCount, maxTextureCacheBytes);
     }

Added: trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp (0 => 94359)


--- trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp	2011-09-01 23:25:04 UTC (rev 94359)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebGraphicsContext3D.h"
+
+#include "GrGLInterface.h"
+
+namespace WebKit {
+
+#if WEBKIT_USING_SKIA
+
+#if GR_GL_PER_GL_FUNC_CALLBACK
+namespace {
+    void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface)
+    {
+        reinterpret_cast<WebGraphicsContext3D*>(interface->fCallbackData)->makeContextCurrent();
+    }
+}
+#endif
+
+GrGLInterface* WebGraphicsContext3D::createGrGLInterface()
+{
+    GrGLInterface* interface = onCreateGrGLInterface();
+#if GR_GL_PER_GL_FUNC_CALLBACK
+    if (interface) {
+        interface->fCallback = bindWebGraphicsContext3DGLContextCallback;
+        interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
+    }
+#endif
+    return interface;
+}
+
+#endif
+
+} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to