Title: [122586] trunk/Source/WebCore
Revision
122586
Author
[email protected]
Date
2012-07-13 08:51:58 -0700 (Fri, 13 Jul 2012)

Log Message

Fix QtWebKit build with OpenGLES after GC3D/E3D refactor
https://bugs.webkit.org/show_bug.cgi?id=91156

Patch by Lauro Neto <[email protected]> on 2012-07-13
Reviewed by Noam Rosenthal.

Adds several build fixes.

* platform/graphics/GraphicsContext3D.h:
    Use E3DOpenGLES instead of previously removed E3DQt.

* platform/graphics/OpenGLESShims.h:
    Enable defines for Qt.

* platform/graphics/opengl/Extensions3DOpenGLES.cpp:
(WebCore::Extensions3DOpenGLES::blitFramebuffer):
(WebCore):
(WebCore::Extensions3DOpenGLES::renderbufferStorageMultisample):
(WebCore::Extensions3DOpenGLES::copyTextureCHROMIUM):
    Added pure virtual stubs.

(WebCore::Extensions3DOpenGLES::supportsExtension):
    Remove PROC suffix. See bug #91130.

* platform/graphics/opengl/Extensions3DOpenGLES.h:
(Extensions3DOpenGLES):
    Added pure virtual stubs.

* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
    Readded missing function after removed in r122250.

(WebCore):
    Use PLATFORM(BLACKBERRY) guard around port-specific include.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
    Added USE(OPENGL_ES_2) guard instead of always loading the OpenGL extensions.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122585 => 122586)


--- trunk/Source/WebCore/ChangeLog	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/ChangeLog	2012-07-13 15:51:58 UTC (rev 122586)
@@ -1,3 +1,43 @@
+2012-07-13  Lauro Neto  <[email protected]>
+
+        Fix QtWebKit build with OpenGLES after GC3D/E3D refactor
+        https://bugs.webkit.org/show_bug.cgi?id=91156
+
+        Reviewed by Noam Rosenthal.
+
+        Adds several build fixes.
+
+        * platform/graphics/GraphicsContext3D.h:
+            Use E3DOpenGLES instead of previously removed E3DQt.
+
+        * platform/graphics/OpenGLESShims.h:
+            Enable defines for Qt.
+
+        * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
+        (WebCore::Extensions3DOpenGLES::blitFramebuffer):
+        (WebCore):
+        (WebCore::Extensions3DOpenGLES::renderbufferStorageMultisample):
+        (WebCore::Extensions3DOpenGLES::copyTextureCHROMIUM):
+            Added pure virtual stubs.
+
+        (WebCore::Extensions3DOpenGLES::supportsExtension):
+            Remove PROC suffix. See bug #91130.
+
+        * platform/graphics/opengl/Extensions3DOpenGLES.h:
+        (Extensions3DOpenGLES):
+            Added pure virtual stubs.
+
+        * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+            Readded missing function after removed in r122250.
+
+        (WebCore):
+            Use PLATFORM(BLACKBERRY) guard around port-specific include.
+
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+            Added USE(OPENGL_ES_2) guard instead of always loading the OpenGL extensions.
+
+
 2012-07-13  Keishi Hattori  <[email protected]>
 
         Form of FormAssociatedElement is not updated when id target changes.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-07-13 15:51:58 UTC (rev 122586)
@@ -956,10 +956,7 @@
     ANGLEWebKitBridge m_compiler;
 #endif
 
-#if PLATFORM(QT) && defined(QT_OPENGL_ES_2)
-    friend class Extensions3DQt;
-    OwnPtr<Extensions3DQt> m_extensions;
-#elif PLATFORM(BLACKBERRY)
+#if PLATFORM(BLACKBERRY) || (PLATFORM(QT) && defined(QT_OPENGL_ES_2))
     friend class Extensions3DOpenGLES;
     OwnPtr<Extensions3DOpenGLES> m_extensions;
 #elif !PLATFORM(CHROMIUM)

Modified: trunk/Source/WebCore/platform/graphics/OpenGLESShims.h (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/OpenGLESShims.h	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/OpenGLESShims.h	2012-07-13 15:51:58 UTC (rev 122586)
@@ -26,7 +26,7 @@
 #ifndef OpenGLESShims_h
 #define OpenGLESShims_h
 
-#if PLATFORM(BLACKBERRY)
+#if PLATFORM(BLACKBERRY) || PLATFORM(QT)
 #define glBindFramebufferEXT glBindFramebuffer
 #define glFramebufferTexture2DEXT glFramebufferTexture2D
 #define glBindRenderbufferEXT glBindRenderbuffer

Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp	2012-07-13 15:51:58 UTC (rev 122586)
@@ -29,6 +29,7 @@
 #include "Extensions3DOpenGLES.h"
 
 #include "GraphicsContext3D.h"
+#include "NotImplemented.h"
 #include <EGL/egl.h>
 #include <wtf/Vector.h>
 
@@ -68,6 +69,21 @@
         m_context->synthesizeGLError(GL_INVALID_OPERATION);
 }
 
+void Extensions3DOpenGLES::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
+{
+    notImplemented();
+}
+
+void Extensions3DOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+{
+    notImplemented();
+}
+
+void Extensions3DOpenGLES::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum)
+{
+    notImplemented();
+}
+
 Platform3DObject Extensions3DOpenGLES::createVertexArrayOES()
 {
     m_context->makeContextCurrent();
@@ -129,8 +145,8 @@
             m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES"));
             m_supportsOESvertexArrayObject = true;
         } else if (name == "GL_IMG_multisampled_render_to_texture" && !m_supportsIMGMultisampledRenderToTexture) {
-            m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
-            m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
+            m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
+            m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
             m_supportsIMGMultisampledRenderToTexture = true;
         }
         return true;

Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h	2012-07-13 15:51:58 UTC (rev 122586)
@@ -41,6 +41,11 @@
     virtual void framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned int texture, int level, unsigned long samples);
     virtual void renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
 
+    // Extension3D methods
+    virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter);
+    virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
+    virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
+
     virtual Platform3DObject createVertexArrayOES();
     virtual void deleteVertexArrayOES(Platform3DObject);
     virtual GC3Dboolean isVertexArrayOES(Platform3DObject);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2012-07-13 15:51:58 UTC (rev 122586)
@@ -34,7 +34,9 @@
 #include "Extensions3DOpenGLES.h"
 #include "IntRect.h"
 #include "IntSize.h"
+#if PLATFORM(BLACKBERRY)
 #include "LayerWebKitThread.h"
+#endif
 #include "NotImplemented.h"
 #include "OpenGLESShims.h"
 
@@ -113,6 +115,75 @@
     }
 }
 
+bool GraphicsContext3D::reshapeFBOs(const IntSize& size)
+{
+    const int width = size.width();
+    const int height = size.height();
+    GLuint colorFormat = 0, pixelDataType = 0;
+    if (m_attrs.alpha) {
+        m_internalColorFormat = GL_RGBA;
+        colorFormat = GL_RGBA;
+        pixelDataType = GL_UNSIGNED_BYTE;
+    } else {
+        m_internalColorFormat = GL_RGB;
+        colorFormat = GL_RGB;
+        pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
+    }
+
+    // We don't allow the logic where stencil is required and depth is not.
+    // See GraphicsContext3D::validateAttributes.
+    bool supportPackedDepthStencilBuffer = (m_attrs.stencil || m_attrs.depth) && getExtensions()->supports("GL_OES_packed_depth_stencil");
+
+    // Resize regular FBO.
+    bool mustRestoreFBO = false;
+    if (m_boundFBO != m_fbo) {
+        mustRestoreFBO = true;
+        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+    }
+
+    ::glBindTexture(GL_TEXTURE_2D, m_texture);
+    ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0);
+    ::glFramebufferTexture2DEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
+
+    ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
+    ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+    ::glBindTexture(GL_TEXTURE_2D, 0);
+
+    // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes.
+    ASSERT(!m_attrs.antialias);
+
+    if (m_attrs.stencil || m_attrs.depth) {
+        // Use a 24 bit depth buffer where we know we have it.
+        if (supportPackedDepthStencilBuffer) {
+            ::glBindTexture(GL_TEXTURE_2D, m_depthStencilBuffer);
+            ::glTexImage2D(GL_TEXTURE_2D, 0, GraphicsContext3D::DEPTH_STENCIL, width, height, 0, GraphicsContext3D::DEPTH_STENCIL, GraphicsContext3D::UNSIGNED_INT_24_8, 0);
+            if (m_attrs.stencil)
+                ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0);
+            if (m_attrs.depth)
+                ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0);
+            ::glBindTexture(GL_TEXTURE_2D, 0);
+        } else {
+            if (m_attrs.stencil) {
+                ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+                ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_STENCIL_INDEX8, width, height);
+                ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+            }
+            if (m_attrs.depth) {
+                ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+                ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
+                ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+            }
+            ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, 0);
+        }
+    }
+    if (glCheckFramebufferStatusEXT(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
+        // FIXME: cleanup
+        notImplemented();
+    }
+
+    return mustRestoreFBO;
+}
+
 void GraphicsContext3D::resolveMultisamplingIfNecessary(const IntRect& rect)
 {
     // FIXME: We don't support antialiasing yet.

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (122585 => 122586)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-07-13 15:47:50 UTC (rev 122585)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-07-13 15:51:58 UTC (rev 122586)
@@ -19,7 +19,11 @@
 #include "config.h"
 #include "GraphicsContext3D.h"
 
+#if USE(OPENGL_ES_2)
+#include "Extensions3DOpenGLES.h"
+#else
 #include "Extensions3DOpenGL.h"
+#endif
 #include "GraphicsContext.h"
 #include "GraphicsSurface.h"
 #include "HostWindow.h"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to