Changeset 82878 in webkit


Ignore:
Timestamp:
Apr 4, 2011 3:07:05 PM (13 years ago)
Author:
Martin Robinson
Message:

2011-04-04 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] WebGL support
https://bugs.webkit.org/show_bug.cgi?id=31517

  • configure.ac: Update configure.ac to ensure that GL/GLX headers exist.

2011-04-04 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] WebGL support
https://bugs.webkit.org/show_bug.cgi?id=31517

Add WebGL support for the GTK+ bits of WebCore.

No new tests. This will be covered by the existing WebGL tests once
the bots are capable of running WebGL tests.

  • GNUmakefile.am: Added new files required for WebGL support.
  • html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::getContext): Extend #ifdef to cover GTK+ as well, which does not yet support accelerated compositing.
  • platform/graphics/ANGLEWebKitBridge.h: Update to reflect the fact that ANGLE isn't compiled as a framework for GTK+.
  • platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::platformTexture): Added a declaration of this method for Cairo. (WebCore::GraphicsContext3D::paintsIntoCanvasBuffer): Ditto.
  • platform/graphics/cairo/GraphicsContext3DCairo.cpp: Added. (WebCore::GraphicsContext3D::getImageData): Added. (WebCore::GraphicsContext3D::paintToCanvas): Added.
  • platform/graphics/cairo/OpenGLShims.cpp: Added. This file controls loading of GL extension functions dynamically. They have different names across the different vendors' GL implementations. (WebCore::lookupOpenGLFunctionAddress): Added (WebCore::openGLFunctionTable): Added (WebCore::initializeOpenGLShims): Added
  • platform/graphics/cairo/OpenGLShims.h: Added.
  • platform/graphics/gtk/DrawingBufferGtk.cpp: Added. (WebCore::DrawingBuffer::DrawingBuffer): Very generic implementation for Cairo. (WebCore::DrawingBuffer::~DrawingBuffer): Ditto. (WebCore::DrawingBuffer::didReset): Ditto. (WebCore::DrawingBuffer::platformColorBuffer): Ditto.
  • platform/graphics/gtk/GraphicsContext3DGtk.cpp: Added. (WebCore::GraphicsContext3D::create): Initial implementation. (WebCore::GraphicsContext3D::GraphicsContext3D): Ditto. (WebCore::GraphicsContext3D::~GraphicsContext3D): Ditto. (WebCore::GraphicsContext3D::makeContextCurrent): Ditto. (WebCore::GraphicsContext3D::platformGraphicsContext3D): Ditto. (WebCore::GraphicsContext3D::isGLES2Compliant): Ditto.
  • platform/graphics/gtk/GraphicsContext3DInternal.cpp: Added. (sharedDisplay): Added this shared display which is required by some display drivers. (WebCore::activeGraphicsContexts): This method keeps track of all active GraphicsContext3D contexts, in order to clean them up at exit. This prevents crashes on certain OpenGL drivers. (WebCore::GraphicsContext3DInternal::addActiveGraphicsContext): Ditto. (WebCore::GraphicsContext3DInternal::removeActiveGraphicsContext): Ditto. (WebCore::GraphicsContext3DInternal::cleanupActiveContextsAtExit): Ditto. (WebCore::GraphicsContext3DInternal::create): Figure out the best way to create an OpenGL context given the current environment. (WebCore::GraphicsContext3DInternal::createPbufferContext): Pbuffer context initializer. (WebCore::GraphicsContext3DInternal::createPixmapContext): Pixmap context initializer. (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): Initial implementation. (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): Ditto. (WebCore::GraphicsContext3DInternal::makeContextCurrent): Ditto.
  • platform/graphics/gtk/GraphicsContext3DInternal.h: Added.
  • platform/graphics/opengl/Extensions3DOpenGL.cpp: Added generic implementation. (WebCore::Extensions3DOpenGL::ensureEnabled): Ditto.
  • platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::reshape): Test for the context using the public API rather than the private bits that are specific to the Apple port.

2011-04-04 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] WebGL support
https://bugs.webkit.org/show_bug.cgi?id=31517

Add support for toggling WebGL at runtime when it's enabled.

  • webkit/webkitwebsettings.cpp: Add the enable-webgl property. When ENABLE_WEBGL is not enabled, it's a no-op. (webkit_web_settings_class_init): Update to support enable-webgl. (webkit_web_settings_set_property): Ditto. (webkit_web_settings_get_property): Ditto.
  • webkit/webkitwebview.cpp: (webkit_web_view_update_settings): Ditto.

2011-04-04 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] WebGL support
https://bugs.webkit.org/show_bug.cgi?id=31517

Add support to the DRT for turning on WebGL when a layout tests requests it.

  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::overridePreference): Allow turning on WebGL from tests.
Location:
trunk
Files:
7 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r82846 r82878  
     12011-04-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] WebGL support
     6        https://bugs.webkit.org/show_bug.cgi?id=31517
     7
     8        * configure.ac: Update configure.ac to ensure that GL/GLX headers exist.
     9
    1102011-04-04  Jon Lee  <jonlee@apple.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r82870 r82878  
     12011-04-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] WebGL support
     6        https://bugs.webkit.org/show_bug.cgi?id=31517
     7
     8        Add WebGL support for the GTK+ bits of WebCore.
     9
     10        No new tests. This will be covered by the existing WebGL tests once
     11        the bots are capable of running WebGL tests.
     12
     13        * GNUmakefile.am: Added new files required for WebGL support.
     14        * html/HTMLCanvasElement.cpp:
     15        (WebCore::HTMLCanvasElement::getContext): Extend #ifdef to cover GTK+ as well, which does not
     16        yet support accelerated compositing.
     17        * platform/graphics/ANGLEWebKitBridge.h: Update to reflect the fact that ANGLE isn't compiled as
     18        a framework for GTK+.
     19        * platform/graphics/GraphicsContext3D.h:
     20        (WebCore::GraphicsContext3D::platformTexture): Added a declaration of this method for Cairo.
     21        (WebCore::GraphicsContext3D::paintsIntoCanvasBuffer): Ditto.
     22        * platform/graphics/cairo/GraphicsContext3DCairo.cpp: Added.
     23        (WebCore::GraphicsContext3D::getImageData): Added.
     24        (WebCore::GraphicsContext3D::paintToCanvas): Added.
     25        * platform/graphics/cairo/OpenGLShims.cpp: Added. This file controls loading of GL extension
     26        functions dynamically. They have different names across the different vendors' GL implementations.
     27        (WebCore::lookupOpenGLFunctionAddress): Added
     28        (WebCore::openGLFunctionTable): Added
     29        (WebCore::initializeOpenGLShims): Added
     30        * platform/graphics/cairo/OpenGLShims.h: Added.
     31        * platform/graphics/gtk/DrawingBufferGtk.cpp: Added.
     32        (WebCore::DrawingBuffer::DrawingBuffer): Very generic implementation for Cairo.
     33        (WebCore::DrawingBuffer::~DrawingBuffer): Ditto.
     34        (WebCore::DrawingBuffer::didReset): Ditto.
     35        (WebCore::DrawingBuffer::platformColorBuffer): Ditto.
     36        * platform/graphics/gtk/GraphicsContext3DGtk.cpp: Added.
     37        (WebCore::GraphicsContext3D::create): Initial implementation.
     38        (WebCore::GraphicsContext3D::GraphicsContext3D): Ditto.
     39        (WebCore::GraphicsContext3D::~GraphicsContext3D): Ditto.
     40        (WebCore::GraphicsContext3D::makeContextCurrent): Ditto.
     41        (WebCore::GraphicsContext3D::platformGraphicsContext3D): Ditto.
     42        (WebCore::GraphicsContext3D::isGLES2Compliant): Ditto.
     43        * platform/graphics/gtk/GraphicsContext3DInternal.cpp: Added.
     44        (sharedDisplay): Added this shared display which is required by some
     45        display drivers.
     46        (WebCore::activeGraphicsContexts): This method keeps track of all active GraphicsContext3D
     47        contexts, in order to clean them up at exit. This prevents crashes on certain OpenGL drivers.
     48        (WebCore::GraphicsContext3DInternal::addActiveGraphicsContext): Ditto.
     49        (WebCore::GraphicsContext3DInternal::removeActiveGraphicsContext): Ditto.
     50        (WebCore::GraphicsContext3DInternal::cleanupActiveContextsAtExit): Ditto.
     51        (WebCore::GraphicsContext3DInternal::create): Figure out the best way to create an OpenGL
     52        context given the current environment.
     53        (WebCore::GraphicsContext3DInternal::createPbufferContext): Pbuffer context initializer.
     54        (WebCore::GraphicsContext3DInternal::createPixmapContext): Pixmap context initializer.
     55        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): Initial implementation.
     56        (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): Ditto.
     57        (WebCore::GraphicsContext3DInternal::makeContextCurrent): Ditto.
     58        * platform/graphics/gtk/GraphicsContext3DInternal.h: Added.
     59        * platform/graphics/opengl/Extensions3DOpenGL.cpp: Added generic implementation.
     60        (WebCore::Extensions3DOpenGL::ensureEnabled): Ditto.
     61        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
     62        (WebCore::GraphicsContext3D::reshape): Test for the context using the public API rather than
     63        the private bits that are specific to the Apple port.
     64
    1652011-04-04  Alexey Proskuryakov  <ap@apple.com>
    266
  • trunk/Source/WebCore/GNUmakefile.am

    r82837 r82878  
    66
    77webcore_cppflags += \
     8        -I$(srcdir)/Source/ThirdParty/ANGLE/src \
     9        -I$(srcdir)/Source/ThirdParty/ANGLE/include \
     10        -I$(srcdir)/Source/ThirdParty/ANGLE/include/GLSLANG \
    811        -I$(srcdir)/Source/WebCore \
    912        -I$(srcdir)/Source/WebCore/accessibility \
     
    4144        -I$(srcdir)/Source/WebCore/platform/graphics \
    4245        -I$(srcdir)/Source/WebCore/platform/graphics/filters \
     46        -I$(srcdir)/Source/WebCore/platform/graphics/gpu \
     47        -I$(srcdir)/Source/WebCore/platform/graphics/opengl \
    4348        -I$(srcdir)/Source/WebCore/platform/graphics/opentype \
    4449        -I$(srcdir)/Source/WebCore/platform/graphics/transforms \
     
    48954900FEATURE_DEFINES += ENABLE_WEBGL=1
    48964901webcore_cppflags += -DENABLE_WEBGL=1
     4902webcore_built_sources += \
     4903        DerivedSources/ANGLE/glslang.cpp \
     4904        DerivedSources/ANGLE/glslang_tab.cpp \
     4905        DerivedSources/ANGLE/glslang_tab.h
    48974906webcore_sources += \
     4907        Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h \
     4908        Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h \
     4909        Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp \
     4910        Source/ThirdParty/ANGLE/src/compiler/Common.h \
     4911        Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp \
     4912        Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h \
     4913        Source/ThirdParty/ANGLE/src/compiler/debug.cpp \
     4914        Source/ThirdParty/ANGLE/src/compiler/debug.h \
     4915        Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp \
     4916        Source/ThirdParty/ANGLE/src/compiler/InfoSink.h \
     4917        Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp \
     4918        Source/ThirdParty/ANGLE/src/compiler/InitializeDll.cpp \
     4919        Source/ThirdParty/ANGLE/src/compiler/InitializeDll.h \
     4920        Source/ThirdParty/ANGLE/src/compiler/InitializeGlobals.h \
     4921        Source/ThirdParty/ANGLE/src/compiler/Initialize.h \
     4922        Source/ThirdParty/ANGLE/src/compiler/InitializeParseContext.h \
     4923        Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp \
     4924        Source/ThirdParty/ANGLE/src/compiler/intermediate.h \
     4925        Source/ThirdParty/ANGLE/src/compiler/intermOut.cpp \
     4926        Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp \
     4927        Source/ThirdParty/ANGLE/src/compiler/localintermediate.h \
     4928        Source/ThirdParty/ANGLE/src/compiler/MMap.h \
     4929        Source/ThirdParty/ANGLE/src/compiler/osinclude.h \
     4930        Source/ThirdParty/ANGLE/src/compiler/ossource_posix.cpp \
     4931        Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp \
     4932        Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h \
     4933        Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp \
     4934        Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h \
     4935        Source/ThirdParty/ANGLE/src/compiler/parseConst.cpp \
     4936        Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp \
     4937        Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h \
     4938        Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp \
     4939        Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h \
     4940        Source/ThirdParty/ANGLE/src/compiler/preprocessor \
     4941        Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c \
     4942        Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h \
     4943        Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h \
     4944        Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c \
     4945        Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h \
     4946        Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c \
     4947        Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c \
     4948        Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h \
     4949        Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h \
     4950        Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h \
     4951        Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c \
     4952        Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h \
     4953        Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h \
     4954        Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c \
     4955        Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h \
     4956        Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c \
     4957        Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h \
     4958        Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp \
     4959        Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h \
     4960        Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp \
     4961        Source/ThirdParty/ANGLE/src/compiler/RemoveTree.h \
     4962        Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.cpp \
     4963        Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.h \
     4964        Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp \
     4965        Source/ThirdParty/ANGLE/src/compiler/ShHandle.h \
     4966        Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp \
     4967        Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h \
     4968        Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp \
     4969        Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h \
     4970        Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp \
     4971        Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.h \
     4972        Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.cpp \
     4973        Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.h \
     4974        Source/ThirdParty/ANGLE/src/compiler/Types.h \
     4975        Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.cpp \
     4976        Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.h \
     4977        Source/ThirdParty/ANGLE/src/compiler/util.cpp \
     4978        Source/ThirdParty/ANGLE/src/compiler/util.h \
     4979        Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp \
     4980        Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h \
     4981        Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp \
     4982        Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h \
    48984983        Source/WebCore/html/canvas/WebGLActiveInfo.h \
    48994984        Source/WebCore/html/canvas/WebGLBuffer.cpp \
     
    49235008        Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp \
    49245009        Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h \
     5010        Source/WebCore/html/canvas/WebGLExtension.cpp \
     5011        Source/WebCore/html/canvas/WebGLExtension.h \
    49255012        Source/WebCore/html/canvas/OESStandardDerivatives.cpp \
    49265013        Source/WebCore/html/canvas/OESStandardDerivatives.h \
     
    49305017        Source/WebCore/html/canvas/OESVertexArrayObject.h \
    49315018        Source/WebCore/html/canvas/WebKitLoseContext.cpp \
    4932         Source/WebCore/html/canvas/WebKitLoseContext.h
     5019        Source/WebCore/html/canvas/WebKitLoseContext.h \
     5020        Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp \
     5021        Source/WebCore/platform/graphics/ANGLEWebKitBridge.h \
     5022        Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
     5023        Source/WebCore/platform/graphics/cairo/OpenGLShims.cpp \
     5024        Source/WebCore/platform/graphics/cairo/OpenGLShims.h \
     5025        Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp \
     5026        Source/WebCore/platform/graphics/gpu/DrawingBuffer.h \
     5027        Source/WebCore/platform/graphics/GraphicsContext3D.cpp \
     5028        Source/WebCore/platform/graphics/GraphicsContext3D.h \
     5029        Source/WebCore/platform/graphics/gtk/DrawingBufferGtk.cpp \
     5030        Source/WebCore/platform/graphics/gtk/GraphicsContext3DGtk.cpp \
     5031        Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.cpp \
     5032        Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.h \
     5033        Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp \
     5034        Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h \
     5035        Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
    49335036endif  # END ENABLE_WEBGL
     5037
    49345038
    49355039DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h
     
    50435147DerivedSources/WebCore/InjectedScriptSource.h: $(WebCore)/inspector/InjectedScriptSource.js
    50445148        perl $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js $(GENSOURCES_WEBCORE)/InjectedScriptSource.h
     5149
     5150# ANGLE tokenizer & parser
     5151DerivedSources/ANGLE/glslang.cpp: Source/ThirdParty/ANGLE/src/compiler/glslang.l
     5152        $(AM_V_GEN)$(FLEX) --noline --nounistd --outfile="$@" "$<"
     5153
     5154DerivedSources/ANGLE/glslang_tab.cpp: Source/ThirdParty/ANGLE/src/compiler/glslang.y
     5155        $(AM_V_GEN)$(BISON) --no-lines --defines="DerivedSources/ANGLE/glslang_tab.h" --skeleton=yacc.c --output="$@" $<
     5156DerivedSources/ANGLE/glslang_tab.h: DerivedSources/ANGLE/glslang_tab.cpp
    50455157
    50465158IDL_PATH := \
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r81740 r82878  
    176176    Settings* settings = document()->settings();
    177177    if (settings && settings->webGLEnabled()
    178 #if !PLATFORM(CHROMIUM)
     178#if !PLATFORM(CHROMIUM) && !PLATFORM(GTK)
    179179        && settings->acceleratedCompositingEnabled()
    180180#endif
  • trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h

    r76324 r82878  
    2727#define ANGLEWebKitBridge_h
    2828
     29#include "PlatformString.h"
     30#include <wtf/text/CString.h>
     31
     32#if !PLATFORM(GTK)
    2933#include "ANGLE/ShaderLang.h"
    30 #include "PlatformString.h"
    31 
    32 #include <wtf/text/CString.h>
     34#else
     35#include "ShaderLang.h"
     36#endif
    3337
    3438namespace WebCore {
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r81740 r82878  
    4444#endif
    4545
     46#if PLATFORM(MAC) || PLATFORM(GTK)
     47#include "ANGLEWebKitBridge.h"
     48#endif
     49
    4650#if PLATFORM(MAC)
    47 #include "ANGLEWebKitBridge.h"
    4851#include <OpenGL/OpenGL.h>
    4952#include <wtf/RetainPtr.h>
     
    6164QT_END_NAMESPACE
    6265#elif PLATFORM(GTK)
     66typedef struct _cairo cairo_t;
    6367typedef unsigned int GLuint;
    6468#endif
     
    8286class DrawingBuffer;
    8387class Extensions3D;
    84 #if PLATFORM(MAC)
     88#if PLATFORM(MAC) || PLATFORM(GTK)
    8589class Extensions3DOpenGL;
    8690#endif
     
    96100
    97101// FIXME: ideally this would be used on all platforms.
    98 #if PLATFORM(CHROMIUM) || PLATFORM(QT)
     102#if PLATFORM(CHROMIUM) || PLATFORM(QT) || PLATFORM(GTK)
    99103class GraphicsContext3DInternal;
    100104#endif
     
    466470    PlatformLayer* platformLayer() const;
    467471#endif
     472#elif PLATFORM(GTK)
     473    PlatformGraphicsContext3D platformGraphicsContext3D();
     474    Platform3DObject platformTexture() const { return m_texture; }
    468475#else
    469476    PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; }
     
    477484    PassRefPtr<DrawingBuffer> createDrawingBuffer(const IntSize& = IntSize());
    478485   
    479 #if PLATFORM(MAC) || PLATFORM(CHROMIUM)
     486#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(GTK)
    480487    // With multisampling on, blit from multisampleFBO to regular FBO.
    481488    void prepareTexture();
     
    757764    void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
    758765                       int canvasWidth, int canvasHeight, CGContextRef context);
     766#elif PLATFORM(GTK)
     767    void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
     768                       int canvasWidth, int canvasHeight, cairo_t* context);
    759769#endif
    760770
     
    770780#elif PLATFORM(CHROMIUM)
    771781    bool paintsIntoCanvasBuffer() const;
     782#elif PLATFORM(GTK)
     783    bool paintsIntoCanvasBuffer() const { return true; }
    772784#else
    773785    bool paintsIntoCanvasBuffer() const { return false; }
     
    860872                    void* destinationData);
    861873
    862 #if PLATFORM(MAC)
     874#if PLATFORM(MAC) || PLATFORM(GTK)
    863875    // Take into account the user's requested context creation attributes,
    864876    // in particular stencil and antialias, and determine which could or
     
    875887
    876888#if PLATFORM(MAC)
     889    CGLContextObj m_contextObj;
     890    RetainPtr<WebGLLayer> m_webGLLayer;
     891#endif
     892
     893#if PLATFORM(MAC) || PLATFORM(GTK)
    877894    typedef struct {
    878895        String source;
     
    890907    Vector<Vector<float> > m_vertexArray;
    891908
    892     CGLContextObj m_contextObj;
    893     RetainPtr<WebGLLayer> m_webGLLayer;
    894909    GC3Duint m_texture, m_compositorTexture;
    895910    GC3Duint m_fbo;
     
    913928
    914929    // FIXME: ideally this would be used on all platforms.
    915 #if PLATFORM(CHROMIUM) || PLATFORM(QT)
     930#if PLATFORM(CHROMIUM) || PLATFORM(QT) || PLATFORM(GTK)
    916931    friend class GraphicsContext3DInternal;
    917932    OwnPtr<GraphicsContext3DInternal> m_internal;
  • trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm

    r81740 r82878  
    9191    : m_currentWidth(0)
    9292    , m_currentHeight(0)
     93    , m_contextObj(0)
    9394    , m_attrs(attrs)
    94     , m_contextObj(0)
    9595    , m_texture(0)
    9696    , m_compositorTexture(0)
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp

    r80124 r82878  
    3636#include "ANGLE/ShaderLang.h"
    3737#include <OpenGL/gl.h>
     38#elif PLATFORM(GTK)
     39#include "OpenGLShims.h"
    3840#endif
    3941
     
    135137{
    136138    m_context->makeContextCurrent();
    137 #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object
     139#if !PLATFORM(GTK) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
    138140    GLuint array = 0;
    139141    glGenVertexArraysAPPLE(1, &array);
     
    150152   
    151153    m_context->makeContextCurrent();
    152 #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object
     154#if !PLATFORM(GTK) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
    153155    glDeleteVertexArraysAPPLE(1, &array);
    154156#endif
     
    161163   
    162164    m_context->makeContextCurrent();
    163 #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object
     165#if !PLATFORM(GTK) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
    164166    return glIsVertexArrayAPPLE(array);
    165167#else
     
    174176
    175177    m_context->makeContextCurrent();
    176 #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object
     178#if !PLATFORM(GTK) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
    177179    glBindVertexArrayAPPLE(array);
    178180#endif
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp

    r82335 r82878  
    4343#include "NotImplemented.h"
    4444#include "Uint8Array.h"
     45#include <cstring>
     46#include <wtf/UnusedParam.h>
     47#include <wtf/text/CString.h>
    4548
    4649#if PLATFORM(MAC)
    4750#include <OpenGL/gl.h>
     51#elif PLATFORM(GTK)
     52#include "OpenGLShims.h"
    4853#endif
    49 
    50 #include <wtf/UnusedParam.h>
    51 #include <wtf/text/CString.h>
    5254
    5355namespace WebCore {
     
    164166void GraphicsContext3D::reshape(int width, int height)
    165167{
    166     if (!m_contextObj)
     168    if (!platformGraphicsContext3D())
    167169        return;
    168170
  • trunk/Source/WebKit/gtk/ChangeLog

    r82870 r82878  
     12011-04-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] WebGL support
     6        https://bugs.webkit.org/show_bug.cgi?id=31517
     7
     8        Add support for toggling WebGL at runtime when it's enabled.
     9
     10        * webkit/webkitwebsettings.cpp: Add the enable-webgl property. When ENABLE_WEBGL
     11        is not enabled, it's a no-op.
     12        (webkit_web_settings_class_init): Update to support enable-webgl.
     13        (webkit_web_settings_set_property): Ditto.
     14        (webkit_web_settings_get_property): Ditto.
     15        * webkit/webkitwebview.cpp:
     16        (webkit_web_view_update_settings): Ditto.
     17
    1182011-04-04  Alexey Proskuryakov  <ap@apple.com>
    219
  • trunk/Source/WebKit/gtk/GNUmakefile.am

    r82599 r82878  
    9999        $(LIBXML_LIBS) \
    100100        $(LIBXSLT_LIBS) \
     101        $(OPENGL_LIBS) \
    101102        $(PANGO_LIBS) \
    102103        $(PNG_LIBS) \
  • trunk/Source/WebKit/gtk/webkit/webkitwebsettings.cpp

    r80856 r82878  
    114114    gboolean enable_fullscreen;
    115115    gboolean enable_dns_prefetching;
     116    gboolean enable_webgl;
    116117};
    117118
     
    167168    PROP_ENABLE_HYPERLINK_AUDITING,
    168169    PROP_ENABLE_FULLSCREEN,
    169     PROP_ENABLE_DNS_PREFETCHING
     170    PROP_ENABLE_DNS_PREFETCHING,
     171    PROP_ENABLE_WEBGL
    170172};
    171173
     
    913915                                                         FALSE,
    914916                                                         flags));
     917    /**
     918    * WebKitWebSettings:enable-webgl:
     919    *
     920    * Enable or disable support for WebGL on pages. WebGL is an experimental
     921    * proposal for allowing web pages to use OpenGL ES-like calls directly. The
     922    * standard is currently a work-in-progress by the Khronos Group.
     923    *
     924    * Since: 1.3.14
     925    */
     926    g_object_class_install_property(gobject_class,
     927                                    PROP_ENABLE_WEBGL,
     928                                    g_param_spec_boolean("enable-webgl",
     929                                                         _("Enable WebGL"),
     930                                                         _("Whether WebGL content should be rendered"),
     931                                                         FALSE,
     932                                                         flags));
    915933
    916934    /**
     
    11181136        priv->enable_dns_prefetching = g_value_get_boolean(value);
    11191137        break;
     1138    case PROP_ENABLE_WEBGL:
     1139        priv->enable_webgl = g_value_get_boolean(value);
     1140        break;
    11201141    default:
    11211142        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     
    12701291    case PROP_ENABLE_DNS_PREFETCHING:
    12711292        g_value_set_boolean(value, priv->enable_dns_prefetching);
     1293        break;
     1294    case PROP_ENABLE_WEBGL:
     1295        g_value_set_boolean(value, priv->enable_webgl);
    12721296        break;
    12731297    default:
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r82870 r82878  
    32493249        javaScriptCanAccessClipboard, enableOfflineWebAppCache,
    32503250        enableUniversalAccessFromFileURI, enableFileAccessFromFileURI,
    3251         enableDOMPaste, tabKeyCyclesThroughElements,
     3251        enableDOMPaste, tabKeyCyclesThroughElements, enableWebGL,
    32523252        enableSiteSpecificQuirks, usePageCache, enableJavaApplet,
    32533253        enableHyperlinkAuditing, enableFullscreen, enableDNSPrefetching;
     
    32933293                 "enable-fullscreen", &enableFullscreen,
    32943294                 "enable-dns-prefetching", &enableDNSPrefetching,
     3295                 "enable-webgl", &enableWebGL,
    32953296                 NULL);
    32963297
     
    33303331    settings->setJavaEnabled(enableJavaApplet);
    33313332    settings->setHyperlinkAuditingEnabled(enableHyperlinkAuditing);
     3333    settings->setDNSPrefetchingEnabled(enableDNSPrefetching);
     3334
    33323335#if ENABLE(FULLSCREEN_API)
    33333336    settings->setFullScreenEnabled(enableFullscreen);
    33343337#endif
     3338
    33353339#if ENABLE(SPELLCHECK)
    33363340    WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
    33373341    static_cast<WebKit::TextCheckerClientEnchant*>(client->textChecker())->updateSpellCheckingLanguage(defaultSpellCheckingLanguages);
    33383342#endif
    3339     settings->setDNSPrefetchingEnabled(enableDNSPrefetching);
     3343
     3344#if ENABLE(WEBGL)
     3345    settings->setWebGLEnabled(enableWebGL);
     3346#endif
    33403347
    33413348    Page* page = core(webView);
     
    34553462    else if (name == g_intern_string("enable-hyperlink-auditing"))
    34563463        settings->setHyperlinkAuditingEnabled(g_value_get_boolean(&value));
     3464
    34573465#if ENABLE(SPELLCHECK)
    34583466    else if (name == g_intern_string("spell-checking-languages")) {
     
    34613469    }
    34623470#endif
     3471
     3472#if ENABLE(WEBGL)
     3473    else if (name == g_intern_string("enable-webgl"))
     3474        settings->setWebGLEnabled(g_value_get_boolean(&value));
     3475#endif
     3476
    34633477    else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name))
    34643478        g_warning("Unexpected setting '%s'", name);
  • trunk/Tools/ChangeLog

    r82848 r82878  
     12011-04-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] WebGL support
     6        https://bugs.webkit.org/show_bug.cgi?id=31517
     7
     8        Add support to the DRT for turning on WebGL when a layout tests requests it.
     9
     10        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     11        (LayoutTestController::overridePreference): Allow turning on WebGL from tests.
     12
    1132011-04-04  Chang Shu  <cshu@webkit.org>
    214
  • trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r82774 r82878  
    779779    else if (g_str_equal(originalName.get(), "WebKitHyperlinkAuditingEnabled"))
    780780        propertyName = "enable-hyperlink-auditing";
     781    else if (g_str_equal(originalName.get(), "WebKitWebGLEnabled"))
     782        propertyName = "enable-webgl";
    781783    else if (g_str_equal(originalName.get(), "WebKitTabToLinksPreferenceKey")) {
    782784        DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(!g_ascii_strcasecmp(valueAsString.get(), "true") || !g_ascii_strcasecmp(valueAsString.get(), "1"));
  • trunk/configure.ac

    r82599 r82878  
    371371              [], [enable_webgl="no"])
    372372AC_MSG_RESULT([$enable_webgl])
     373
     374if test "$enable_webgl" = "yes"; then
     375    AC_CHECK_HEADERS([GL/gl.h], [], AC_MSG_ERROR([OpenGL header not found]))
     376    AC_CHECK_HEADERS([GL/glx.h], [], AC_MSG_ERROR([GLX header not found]))
     377    OPENGL_LIBS=-lGL
     378fi
     379AC_SUBST([OPENGL_LIBS])
    373380
    374381# check whether to enable channel messaging support
Note: See TracChangeset for help on using the changeset viewer.