Changeset 109609 in webkit


Ignore:
Timestamp:
Mar 2, 2012 1:37:11 PM (12 years ago)
Author:
Martin Robinson
Message:

[GTK] [AC] Connect WebGL to the TextureMapperGL code
https://bugs.webkit.org/show_bug.cgi?id=78968

Reviewed by Gustavo Noronha Silva.

No new tests. This is covered by existing accelerated compositing and
WebGL tests.

Rely on the shared version of GL acquisition from GLContext. This reduces
a lot of code and now allows us to connect WebGL into the accelerated compositing
rendering path.

  • GNUmakefile.list.am: GLContext should be included for all X11 builds now.

There are no longer GTK+ specific versions of GraphicsContext3D.

  • platform/graphics/GraphicsContext3D.h: Add a default argument for

resolveMultisamplingIfNecessary. This will resolve the entire texture.

  • platform/graphics/cairo/GraphicsContext3DCairo.cpp: GraphicsContext3D is

now responsible for creating GraphicsContext3DPrivate in the constructor.
(WebCore::GraphicsContext3D::platformLayer): Now return m_private.

  • platform/graphics/cairo/GraphicsContext3DPrivate.cpp: Added.
  • platform/graphics/cairo/GraphicsContext3DPrivate.h: Renamed from Source/WebCore/platform/graphics/glx/GraphicsContext3DPrivate.h.
  • platform/graphics/glx/GraphicsContext3DPrivate.cpp: Removed.
  • platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:

(WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): Properly
handle the default argument.

  • platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:

(WebCore::GraphicsContext3D::prepareTexture): Use the new default argument now.
(WebCore::GraphicsContext3D::readRenderingResults): Ditto.

Location:
trunk/Source/WebCore
Files:
1 added
1 deleted
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109605 r109609  
     12012-03-02  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] [AC] Connect WebGL to the TextureMapperGL code
     4        https://bugs.webkit.org/show_bug.cgi?id=78968
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        No new tests. This is covered by existing accelerated compositing and
     9        WebGL tests.
     10
     11        Rely on the shared version of GL acquisition from GLContext. This reduces
     12        a lot of code and now allows us to connect WebGL into the accelerated compositing
     13        rendering path.
     14
     15        * GNUmakefile.list.am: GLContext should be included for all X11 builds now.
     16        There are no longer GTK+ specific versions of GraphicsContext3D.
     17        * platform/graphics/GraphicsContext3D.h: Add a default argument for
     18        resolveMultisamplingIfNecessary. This will resolve the entire texture.
     19        * platform/graphics/cairo/GraphicsContext3DCairo.cpp: GraphicsContext3D is
     20        now responsible for creating GraphicsContext3DPrivate in the constructor.
     21        (WebCore::GraphicsContext3D::platformLayer): Now return m_private.
     22        * platform/graphics/cairo/GraphicsContext3DPrivate.cpp: Added.
     23        * platform/graphics/cairo/GraphicsContext3DPrivate.h: Renamed from Source/WebCore/platform/graphics/glx/GraphicsContext3DPrivate.h.
     24        * platform/graphics/glx/GraphicsContext3DPrivate.cpp: Removed.
     25        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
     26        (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): Properly
     27        handle the default argument.
     28        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
     29        (WebCore::GraphicsContext3D::prepareTexture): Use the new default argument now.
     30        (WebCore::GraphicsContext3D::readRenderingResults): Ditto.
     31
    1322012-02-18  Martin Robinson  <mrobinson@igalia.com>
    233
  • trunk/Source/WebCore/GNUmakefile.list.am

    r109605 r109609  
    46304630if TARGET_X11
    46314631webcoregtk_sources += \
     4632        Source/WebCore/platform/graphics/glx/GLContextGLX.cpp \
     4633        Source/WebCore/platform/graphics/gtk/GLContextGtk.cpp \
     4634        Source/WebCore/platform/graphics/cairo/GLContext.h \
    46324635        Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp \
    46334636        Source/WebCore/plugins/gtk/gtk2xtbin.c \
     
    57465749        Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp \
    57475750        Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
    5748         Source/WebCore/platform/graphics/glx/GraphicsContext3DPrivate.cpp \
    5749         Source/WebCore/platform/graphics/glx/GraphicsContext3DPrivate.h \
     5751        Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp \
     5752        Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h \
    57505753        Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp \
    57515754        Source/WebCore/platform/graphics/gpu/DrawingBuffer.h \
     
    58255828if USE_TEXTURE_MAPPER_GL
    58265829webcore_sources += \
    5827         Source/WebCore/platform/graphics/cairo/GLContext.h \
    5828         Source/WebCore/platform/graphics/glx/GLContextGLX.cpp \
    58295830        Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp \
    58305831        Source/WebCore/platform/graphics/texmap/TextureMapperGL.h \
     
    58465847        Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h \
    58475848        Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
    5848 webcoregtk_sources += \
    5849         Source/WebCore/platform/graphics/gtk/GLContextGtk.cpp
    58505849endif  # END USE_TEXTURE_MAPPER_GL
    58515850endif  # USE_ACCELERATED_COMPOSITING
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r108597 r109609  
    2727#define GraphicsContext3D_h
    2828
     29#include "IntRect.h"
    2930#include "GraphicsLayer.h"
    3031#include "GraphicsTypes3D.h"
    3132#include "PlatformString.h"
    32 
    3333#include <wtf/HashMap.h>
    3434#include <wtf/ListHashSet.h>
     
    914914
    915915    bool reshapeFBOs(const IntSize&);
    916     void resolveMultisamplingIfNecessary(const IntRect&);
     916    void resolveMultisamplingIfNecessary(const IntRect& = IntRect());
    917917
    918918    int m_currentWidth, m_currentHeight;
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp

    r108289 r109609  
    2828#include "config.h"
    2929#include "GraphicsContext3D.h"
    30 #include "PlatformContextCairo.h"
    3130
    3231#if ENABLE(WEBGL)
     
    3635#include "Image.h"
    3736#include "OpenGLShims.h"
     37#include "PlatformContextCairo.h"
    3838#include "RefPtrCairo.h"
    3939#include "ShaderLang.h"
    4040#include <cairo.h>
     41#include <wtf/NotFound.h>
     42#include <wtf/OwnPtr.h>
    4143#include <wtf/PassOwnPtr.h>
    4244
     
    4951        return 0;
    5052
    51     OwnPtr<GraphicsContext3DPrivate> priv = GraphicsContext3DPrivate::create();
    52     if (!priv)
     53    static bool initialized = false;
     54    static bool success = true;
     55    if (!initialized) {
     56        success = initializeOpenGLShims();
     57        initialized = true;
     58    }
     59    if (!success)
    5360        return 0;
    5461
    5562    RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attributes, hostWindow, false));
    56     context->m_private = priv.release();
    5763    return context.release();
    5864}
    5965
    60 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, bool)
     66GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, bool)
    6167    : m_currentWidth(0)
    6268    , m_currentHeight(0)
     
    6975    , m_multisampleDepthStencilBuffer(0)
    7076    , m_multisampleColorBuffer(0)
    71 {
    72     GraphicsContext3DPrivate::addActiveGraphicsContext(this);
     77    , m_private(GraphicsContext3DPrivate::create(this, hostWindow))
     78{
     79    makeContextCurrent();
    7380
    7481    validateAttributes();
     
    124131GraphicsContext3D::~GraphicsContext3D()
    125132{
    126     GraphicsContext3DPrivate::removeActiveGraphicsContext(this);
    127     if (!m_private->m_context)
    128         return;
    129 
    130133    makeContextCurrent();
    131134    ::glDeleteTextures(1, &m_texture);
     
    229232    return m_private->makeContextCurrent();
    230233}
    231 
    232234PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
    233235{
    234     return m_private->m_context;
     236    return m_private->platformContext();
    235237}
    236238
     
    243245PlatformLayer* GraphicsContext3D::platformLayer() const
    244246{
    245     return 0;
     247    return m_private.get();
    246248}
    247249#endif
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h

    • Property svn:eol-style changed from native to LF
    r109605 r109609  
    2121#define GraphicsContext3DPrivate_h
    2222
     23#include "GLContext.h"
     24#include "GraphicsContext3D.h"
    2325#include <wtf/PassOwnPtr.h>
    2426
    25 typedef struct __GLXcontextRec *GLXContext;
    26 typedef unsigned long GLXPbuffer;
    27 typedef unsigned long GLXPixmap;
    28 typedef unsigned char GLubyte;
    29 typedef unsigned long Pixmap;
     27#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     28#include "TextureMapper.h"
     29#endif
    3030
    3131namespace WebCore {
    3232
    33 class GraphicsContext3D;
    34 
    35 class GraphicsContext3DPrivate {
     33class GraphicsContext3DPrivate
     34#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     35    : public TextureMapperPlatformLayer
     36#endif
     37{
    3638public:
    37     static PassOwnPtr<GraphicsContext3DPrivate> create();
     39    static PassOwnPtr<GraphicsContext3DPrivate> create(GraphicsContext3D*, HostWindow*);
    3840    ~GraphicsContext3DPrivate();
    3941    bool makeContextCurrent();
     42    PlatformGraphicsContext3D platformContext();
     43
     44#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     45    virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity, BitmapTexture* mask);
     46#endif
    4047
    4148private:
    42     friend class GraphicsContext3D;
    43     static GraphicsContext3DPrivate* createPbufferContext();
    44     static GraphicsContext3DPrivate* createPixmapContext();
    45     GraphicsContext3DPrivate(GLXContext, GLXPbuffer);
    46     GraphicsContext3DPrivate(GLXContext, Pixmap, GLXPixmap);
     49    GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*);
    4750
    48     static void addActiveGraphicsContext(GraphicsContext3D*);
    49     static void removeActiveGraphicsContext(GraphicsContext3D*);
    50     static void cleanupActiveContextsAtExit();
    51 
    52     GLXContext m_context;
    53     GLXPbuffer m_pbuffer;
    54     Pixmap m_pixmap;
    55     GLXPixmap m_glxPixmap;
     51    GraphicsContext3D* m_context;
     52    HostWindow* m_window;
     53    GLContext* m_glContext;
    5654};
    5755
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp

    r107945 r109609  
    136136    ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO);
    137137    ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo);
    138     ::glBlitFramebufferEXT(rect.x(), rect.y(), rect.maxX(), rect.maxY(), rect.x(), rect.y(), rect.maxX(), rect.maxY(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
     138
     139    IntRect resolveRect = rect;
     140    if (rect.isEmpty())
     141        resolveRect = IntRect(0, 0, m_currentWidth, m_currentHeight);
     142
     143    ::glBlitFramebufferEXT(resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
    139144}
    140145
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r107945 r109609  
    169169    makeContextCurrent();
    170170    if (m_attrs.antialias)
    171         resolveMultisamplingIfNecessary(IntRect(0, 0, m_currentWidth, m_currentHeight));
     171        resolveMultisamplingIfNecessary();
    172172
    173173    ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
     
    192192    bool mustRestoreFBO = false;
    193193    if (m_attrs.antialias) {
    194         resolveMultisamplingIfNecessary(IntRect(0, 0, m_currentWidth, m_currentHeight));
     194        resolveMultisamplingIfNecessary();
    195195        ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
    196196        mustRestoreFBO = true;
Note: See TracChangeset for help on using the changeset viewer.