Bug 66903 - Restructure GraphicsContext3D to make it more extensible
Summary: Restructure GraphicsContext3D to make it more extensible
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 67172 53201 67208 75462
Blocks: 59064
  Show dependency treegraph
 
Reported: 2011-08-24 16:07 PDT by Chris Marrin
Modified: 2019-01-21 14:11 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2011-08-24 16:07:12 PDT
Currently GC3D needs to work on GLX, CGL and (as of https://bugs.webkit.org/show_bug.cgi?id=59064) EGL platforms. It also needs to work with OpenGL, GLES and possibly ANGLE (if there are differences). Finally, it needs to work with the split process model of Chromium. So the code should be restructured to make all these variables easier to implement.

We should first consider resurrecting https://bugs.webkit.org/show_bug.cgi?id=53201. This might move all the GLX/CGL/EGL code into DrawingBuffer and avoid the need for any differences in GC3D for that part of the code. Other changes we should make:

1) Rename GraphicsContext3DInternal to GraphicsContext3DPrivate (matches the uses in the rest of the code)

2) Rename m_internal to m_private

3) Make the Mac implementation use GraphicsContext3DPrivate and get rid of the ifdef around it

4) Move all API that is not part of the public API into GraphicsContext3DPrivate.

(Note: is GraphicsContext3DInternal still needed if we make GraphicsContext3D use DrawingBuffer?)

Once that is done, the code should be generaly split into the following files. What goes into which file depends on what is needed to avoid ifdefs as much as possible:

    GraphicsContext3D - Anything that is common to all platforms
    GraphicsContext3DOpenGLCommon - code common to any OpenGL implementation
    GraphicsContext3DOpenGL - OpenGL (not OpenGL ES) specific code)
    GraphicsContext3DGLES - OpenGL ES specific code

The OpenGLShims file is also getting very messy. A way should be found to eliminate as many of its ifdefs as possible. But that file is not used in the Mac implementation so I don't know enough to suggest any changes there.
Comment 1 Chris Marrin 2011-08-25 08:57:50 PDT
This code in GraphicsContext3D.h should also be cleaned up:

#if PLATFORM(QT)
    bool paintsIntoCanvasBuffer() const { return true; }
#elif PLATFORM(CHROMIUM)
    bool paintsIntoCanvasBuffer() const;
#elif PLATFORM(GTK)
    bool paintsIntoCanvasBuffer() const { return true; }
#else
    bool paintsIntoCanvasBuffer() const { return false; }
#endif

It should be forwarded to the Private class and dealt with in platform specific implementations rather than with an ifdef
Comment 2 ChangSeok Oh 2011-08-25 21:19:24 PDT
Are you going to cover all these changes by yourself for all ports? or expect someone's contribution? 
May I get involved? :)
Comment 3 Weiwei 2011-10-18 23:40:49 PDT
Is there any update on this bug? And will the bug be merged into webkit trunk later?
Comment 4 Darin Adler 2019-01-21 14:11:51 PST
We might do a cleanup like this some day, but if we do, we don’t really need this 7-year-old bug to track it or remind us to do it.