Title: [91694] trunk/Source/WebCore
Revision
91694
Author
[email protected]
Date
2011-07-25 12:20:46 -0700 (Mon, 25 Jul 2011)

Log Message

[Qt] Adopt GraphicsContext3DOpenGL.cpp and ANGLE (part 2)
https://bugs.webkit.org/show_bug.cgi?id=64878

Patch by Andrew Wason <[email protected]> on 2011-07-25
Reviewed by Noam Rosenthal.

Existing WebGL layout tests should test this.

Adopt GraphicsContext3DOpenGL.cpp and ANGLE compiler for Qt.

* WebCore.pro: Build ANGLE compiler and GraphicsContext3DOpenGL.cpp.
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/GraphicsContext3D.h: Expose exising ANGLEWebKitBridge compiler member for Qt.
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D): Initialize ANGLE resources.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91693 => 91694)


--- trunk/Source/WebCore/ChangeLog	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/ChangeLog	2011-07-25 19:20:46 UTC (rev 91694)
@@ -1,3 +1,21 @@
+2011-07-25  Andrew Wason  <[email protected]>
+
+        [Qt] Adopt GraphicsContext3DOpenGL.cpp and ANGLE (part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=64878
+
+        Reviewed by Noam Rosenthal.
+
+        Existing WebGL layout tests should test this.
+
+        Adopt GraphicsContext3DOpenGL.cpp and ANGLE compiler for Qt.
+
+        * WebCore.pro: Build ANGLE compiler and GraphicsContext3DOpenGL.cpp.
+        * platform/graphics/ANGLEWebKitBridge.h:
+        * platform/graphics/GraphicsContext3D.h: Expose exising ANGLEWebKitBridge compiler member for Qt.
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D): Initialize ANGLE resources.
+
 2011-07-25  Daniel Bates  <[email protected]>
 
         REGRESSION (r85964): Improper relayout of some nested positioned elements

Modified: trunk/Source/WebCore/WebCore.pro (91693 => 91694)


--- trunk/Source/WebCore/WebCore.pro	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/WebCore.pro	2011-07-25 19:20:46 UTC (rev 91694)
@@ -3592,6 +3592,7 @@
         html/canvas/WebGLUniformLocation.h \
         html/canvas/WebGLVertexArrayObjectOES.h \
         html/canvas/WebKitLoseContext.h \
+        platform/graphics/ANGLEWebKitBridge.h \
         platform/graphics/Extensions3D.h \
         platform/graphics/GraphicsContext3D.h \
         platform/graphics/gpu/DrawingBuffer.h \
@@ -3601,6 +3602,7 @@
         SOURCES += \
             bindings/js/JSWebGLRenderingContextCustom.cpp
     }
+
     SOURCES += \
         html/canvas/CanvasContextAttributes.cpp \
         html/canvas/WebGLObject.cpp \
@@ -3621,6 +3623,7 @@
         html/canvas/WebGLUniformLocation.cpp \
         html/canvas/WebGLVertexArrayObjectOES.cpp \
         html/canvas/WebKitLoseContext.cpp \
+        platform/graphics/ANGLEWebKitBridge.cpp \
         platform/graphics/GraphicsContext3D.cpp \
         platform/graphics/gpu/DrawingBuffer.cpp \
         platform/graphics/gpu/qt/DrawingBufferQt.cpp \
@@ -3629,6 +3632,129 @@
 
     INCLUDEPATH += $$PWD/platform/graphics/gpu
 
+    !contains(QT_CONFIG, opengles2) {
+        SOURCES += \
+            platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+
+        ANGLE_DIR = $$replace(PWD, "WebCore", "ThirdParty/ANGLE")
+
+        INCLUDEPATH += $$ANGLE_DIR/src $$ANGLE_DIR/include
+
+        ANGLE_HEADERS += \
+            $$ANGLE_DIR/src/compiler/BaseTypes.h \
+            $$ANGLE_DIR/src/compiler/Common.h \
+            $$ANGLE_DIR/src/compiler/ConstantUnion.h \
+            $$ANGLE_DIR/src/compiler/debug.h \
+            $$ANGLE_DIR/src/compiler/ExtensionBehavior.h \
+            $$ANGLE_DIR/src/compiler/ForLoopUnroll.h \
+            $$ANGLE_DIR/src/compiler/glslang.h \
+            $$ANGLE_DIR/src/compiler/glslang_tab.h \
+            $$ANGLE_DIR/src/compiler/InfoSink.h \
+            $$ANGLE_DIR/src/compiler/InitializeDll.h \
+            $$ANGLE_DIR/src/compiler/InitializeGlobals.h \
+            $$ANGLE_DIR/src/compiler/Initialize.h \
+            $$ANGLE_DIR/src/compiler/InitializeParseContext.h \
+            $$ANGLE_DIR/src/compiler/intermediate.h \
+            $$ANGLE_DIR/src/compiler/localintermediate.h \
+            $$ANGLE_DIR/src/compiler/MMap.h \
+            $$ANGLE_DIR/src/compiler/MapLongVariableNames.h \
+            $$ANGLE_DIR/src/compiler/osinclude.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/atom.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/compile.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/cpp.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/memory.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/parser.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/preprocess.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/scanner.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/slglobals.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/symbols.h \
+            $$ANGLE_DIR/src/compiler/preprocessor/tokens.h \
+            $$ANGLE_DIR/src/compiler/OutputESSL.h \
+            $$ANGLE_DIR/src/compiler/OutputGLSL.h \
+            $$ANGLE_DIR/src/compiler/OutputGLSLBase.h \
+            $$ANGLE_DIR/src/compiler/OutputHLSL.h \
+            $$ANGLE_DIR/src/compiler/ParseHelper.h \
+            $$ANGLE_DIR/src/compiler/PoolAlloc.h \
+            $$ANGLE_DIR/src/compiler/QualifierAlive.h \
+            $$ANGLE_DIR/src/compiler/RemoveTree.h \
+            $$ANGLE_DIR/src/compiler/SearchSymbol.h \
+            $$ANGLE_DIR/src/compiler/ShHandle.h \
+            $$ANGLE_DIR/src/compiler/SymbolTable.h \
+            $$ANGLE_DIR/src/compiler/TranslatorESSL.h \
+            $$ANGLE_DIR/src/compiler/TranslatorGLSL.h \
+            $$ANGLE_DIR/src/compiler/TranslatorHLSL.h \
+            $$ANGLE_DIR/src/compiler/Types.h \
+            $$ANGLE_DIR/src/compiler/UnfoldSelect.h \
+            $$ANGLE_DIR/src/compiler/util.h \
+            $$ANGLE_DIR/src/compiler/ValidateLimitations.h \
+            $$ANGLE_DIR/src/compiler/VariableInfo.h \
+            $$ANGLE_DIR/src/compiler/VersionGLSL.h
+
+        HEADERS += $$ANGLE_HEADERS
+
+        ANGLE_SOURCES += \
+            $$ANGLE_DIR/src/compiler/CodeGenGLSL.cpp \
+            $$ANGLE_DIR/src/compiler/CodeGenHLSL.cpp \
+            $$ANGLE_DIR/src/compiler/Compiler.cpp \
+            $$ANGLE_DIR/src/compiler/debug.cpp \
+            $$ANGLE_DIR/src/compiler/ForLoopUnroll.cpp \
+            $$ANGLE_DIR/src/compiler/glslang_lex.cpp \
+            $$ANGLE_DIR/src/compiler/glslang_tab.cpp \
+            $$ANGLE_DIR/src/compiler/InfoSink.cpp \
+            $$ANGLE_DIR/src/compiler/Initialize.cpp \
+            $$ANGLE_DIR/src/compiler/InitializeDll.cpp \
+            $$ANGLE_DIR/src/compiler/Intermediate.cpp \
+            $$ANGLE_DIR/src/compiler/intermOut.cpp \
+            $$ANGLE_DIR/src/compiler/IntermTraverse.cpp \
+            $$ANGLE_DIR/src/compiler/MapLongVariableNames.cpp \
+            $$ANGLE_DIR/src/compiler/ossource_posix.cpp \
+            $$ANGLE_DIR/src/compiler/OutputESSL.cpp \
+            $$ANGLE_DIR/src/compiler/OutputGLSL.cpp \
+            $$ANGLE_DIR/src/compiler/OutputGLSLBase.cpp \
+            $$ANGLE_DIR/src/compiler/OutputHLSL.cpp \
+            $$ANGLE_DIR/src/compiler/parseConst.cpp \
+            $$ANGLE_DIR/src/compiler/ParseHelper.cpp \
+            $$ANGLE_DIR/src/compiler/PoolAlloc.cpp \
+            $$ANGLE_DIR/src/compiler/QualifierAlive.cpp \
+            $$ANGLE_DIR/src/compiler/RemoveTree.cpp \
+            $$ANGLE_DIR/src/compiler/SearchSymbol.cpp \
+            $$ANGLE_DIR/src/compiler/ShaderLang.cpp \
+            $$ANGLE_DIR/src/compiler/SymbolTable.cpp \
+            $$ANGLE_DIR/src/compiler/TranslatorESSL.cpp \
+            $$ANGLE_DIR/src/compiler/TranslatorGLSL.cpp \
+            $$ANGLE_DIR/src/compiler/TranslatorHLSL.cpp \
+            $$ANGLE_DIR/src/compiler/UnfoldSelect.cpp \
+            $$ANGLE_DIR/src/compiler/util.cpp \
+            $$ANGLE_DIR/src/compiler/ValidateLimitations.cpp \
+            $$ANGLE_DIR/src/compiler/VariableInfo.cpp \
+            $$ANGLE_DIR/src/compiler/VersionGLSL.cpp
+
+        SOURCES += \
+            $$ANGLE_DIR/src/compiler/preprocessor/atom.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/cpp.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/cppstruct.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/memory.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/scanner.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/symbols.c \
+            $$ANGLE_DIR/src/compiler/preprocessor/tokens.c
+
+        *g++* {
+            ANGLE_CFLAGS += -Wno-unused-variable
+            ANGLE_CFLAGS += -Wno-missing-noreturn
+            ANGLE_CFLAGS += -Wno-unused-function
+            ANGLE_CFLAGS += -Wno-reorder
+
+            angle_cxx.commands = $$QMAKE_CXX -c $(CXXFLAGS) $$ANGLE_CFLAGS $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+            angle_cxx.output  = $$OBJECTS_DIR/${QMAKE_FILE_BASE}$$QMAKE_EXT_OBJ
+            anglc_cxx.dependency_type = TYPE_C
+            angle_cxx.depends = $$ANGLE_HEADERS
+            angle_cxx.input = ANGLE_SOURCES
+            QMAKE_EXTRA_COMPILERS += angle_cxx
+        } else {
+            SOURCES += $$ANGLE_SOURCES
+        }
+    }
+
     CONFIG += opengl-shims
 }
 

Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h (91693 => 91694)


--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h	2011-07-25 19:20:46 UTC (rev 91694)
@@ -29,7 +29,9 @@
 #include "PlatformString.h"
 #include <wtf/text/CString.h>
 
-#if !PLATFORM(GTK)
+#if PLATFORM(QT)
+#include "ANGLE/include/GLSLANG/ShaderLang.h"
+#elif !PLATFORM(GTK)
 #include "ANGLE/ShaderLang.h"
 #else
 #include "ShaderLang.h"

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (91693 => 91694)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2011-07-25 19:20:46 UTC (rev 91694)
@@ -43,7 +43,7 @@
 #undef VERSION
 #endif
 
-#if PLATFORM(MAC) || PLATFORM(GTK)
+#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT)
 #include "ANGLEWebKitBridge.h"
 #endif
 
@@ -501,7 +501,7 @@
 
     PassRefPtr<DrawingBuffer> createDrawingBuffer(const IntSize& = IntSize());
     
-#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(GTK)
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(GTK) || PLATFORM(QT)
     // With multisampling on, blit from multisampleFBO to regular FBO.
     void prepareTexture();
 #endif
@@ -889,7 +889,7 @@
                     AlphaOp alphaOp,
                     void* destinationData);
 
-#if PLATFORM(MAC) || PLATFORM(GTK)
+#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT)
     // Take into account the user's requested context creation attributes,
     // in particular stencil and antialias, and determine which could or
     // could not be honored based on the capabilities of the OpenGL
@@ -917,13 +917,12 @@
     } ShaderSourceEntry;
     HashMap<Platform3DObject, ShaderSourceEntry> m_shaderSourceMap;
 
+    ANGLEWebKitBridge m_compiler;
 #if PLATFORM(QT)
     friend class Extensions3DQt;
     OwnPtr<Extensions3DQt> m_extensions;
 #else
     friend class Extensions3DOpenGL;
-    ANGLEWebKitBridge m_compiler;
-
     OwnPtr<Extensions3DOpenGL> m_extensions;
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (91693 => 91694)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2011-07-25 19:20:46 UTC (rev 91694)
@@ -25,6 +25,10 @@
 
 #include "config.h"
 
+#if PLATFORM(QT)
+#include <QtGlobal>
+#endif
+
 #if ENABLE(WEBGL)
 
 #include "GraphicsContext3D.h"
@@ -50,6 +54,8 @@
 #include <OpenGL/gl.h>
 #elif PLATFORM(GTK)
 #include "OpenGLShims.h"
+#elif PLATFORM(QT)
+#include <cairo/OpenGLShims.h>
 #endif
 
 namespace WebCore {
@@ -116,6 +122,7 @@
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
 }
 
+#if !PLATFORM(QT)
 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
 {
     HTMLCanvasElement* canvas = context->canvas();
@@ -142,6 +149,7 @@
     paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight,
                   canvas->width(), canvas->height(), imageBuffer->context()->platformContext());
 }
+#endif
 
 PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData()
 {
@@ -1515,12 +1523,14 @@
     return m_layerComposited;
 }
 
+#if !PLATFORM(QT)
 Extensions3D* GraphicsContext3D::getExtensions()
 {
     if (!m_extensions)
         m_extensions = adoptPtr(new Extensions3DOpenGL(this));
     return m_extensions.get();
 }
+#endif
 
 }
 

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


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2011-07-25 19:08:58 UTC (rev 91693)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2011-07-25 19:20:46 UTC (rev 91694)
@@ -270,7 +270,7 @@
     , m_layerComposited(false)
     , m_internalColorFormat(0)
     , m_boundFBO(0)
-    , m_activeTexture(0)
+    , m_activeTexture(GL_TEXTURE0)
     , m_boundTexture0(0)
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
@@ -320,6 +320,24 @@
     m_boundFBO = m_fbo;
     glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     glClearColor(0.0, 0.0, 0.0, 0.0);
+
+#if !defined(QT_OPENGL_ES_2)
+    // ANGLE initialization.
+    ShBuiltInResources ANGLEResources;
+    ShInitBuiltInResources(&ANGLEResources);
+
+    getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &ANGLEResources.MaxVertexAttribs);
+    getIntegerv(GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS, &ANGLEResources.MaxVertexUniformVectors);
+    getIntegerv(GraphicsContext3D::MAX_VARYING_VECTORS, &ANGLEResources.MaxVaryingVectors);
+    getIntegerv(GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxVertexTextureImageUnits);
+    getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxCombinedTextureImageUnits); 
+    getIntegerv(GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxTextureImageUnits);
+    getIntegerv(GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS, &ANGLEResources.MaxFragmentUniformVectors);
+
+    // Always set to 1 for OpenGL ES.
+    ANGLEResources.MaxDrawBuffers = 1;
+    m_compiler.setResources(ANGLEResources);
+#endif
 }
 
 GraphicsContext3D::~GraphicsContext3D()
@@ -363,6 +381,7 @@
     m_internal->paint(painter, 0, 0);
 }
 
+#if defined(QT_OPENGL_ES_2)
 PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData()
 {
     // FIXME: This needs to be implemented for proper non-premultiplied-alpha
@@ -1476,6 +1495,7 @@
 {
     return m_layerComposited;
 }
+#endif
 
 Extensions3D* GraphicsContext3D::getExtensions()
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to