summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/egl/GLContextEGL.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/egl/GLContextEGL.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/platform/graphics/egl/GLContextEGL.h')
-rw-r--r--Source/WebCore/platform/graphics/egl/GLContextEGL.h87
1 files changed, 61 insertions, 26 deletions
diff --git a/Source/WebCore/platform/graphics/egl/GLContextEGL.h b/Source/WebCore/platform/graphics/egl/GLContextEGL.h
index c887e0beb..e5a33597d 100644
--- a/Source/WebCore/platform/graphics/egl/GLContextEGL.h
+++ b/Source/WebCore/platform/graphics/egl/GLContextEGL.h
@@ -17,57 +17,92 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef GLContextEGL_h
-#define GLContextEGL_h
+#pragma once
#if USE(EGL)
#include "GLContext.h"
-#include <EGL/egl.h>
+#if PLATFORM(X11)
+#include "XUniqueResource.h"
+#endif
+
+#if PLATFORM(WAYLAND)
+#include "WlUniquePtr.h"
+struct wl_egl_window;
+#endif
+
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
namespace WebCore {
-class GLContextEGL : public GLContext {
+class GLContextEGL final : public GLContext {
WTF_MAKE_NONCOPYABLE(GLContextEGL);
public:
- enum EGLSurfaceType { PbufferSurface, WindowSurface, PixmapSurface };
- static PassOwnPtr<GLContextEGL> createContext(EGLNativeWindowType, GLContext* sharingContext = 0);
- static PassOwnPtr<GLContextEGL> createWindowContext(EGLNativeWindowType, GLContext* sharingContext);
+ static std::unique_ptr<GLContextEGL> createContext(GLNativeWindowType, PlatformDisplay&);
+ static std::unique_ptr<GLContextEGL> createSharingContext(PlatformDisplay&);
virtual ~GLContextEGL();
- virtual bool makeContextCurrent();
- virtual void swapBuffers();
- virtual void waitNative();
- virtual bool canRenderToDefaultFramebuffer();
- virtual IntSize defaultFrameBufferSize();
+
+private:
+ bool makeContextCurrent() override;
+ void swapBuffers() override;
+ void waitNative() override;
+ bool canRenderToDefaultFramebuffer() override;
+ IntSize defaultFrameBufferSize() override;
+ void swapInterval(int) override;
#if USE(CAIRO)
- virtual cairo_device_t* cairoDevice();
+ cairo_device_t* cairoDevice() override;
#endif
+ bool isEGLContext() const override { return true; }
-#if ENABLE(WEBGL)
- virtual PlatformGraphicsContext3D platformContext();
+#if ENABLE(GRAPHICS_CONTEXT_3D)
+ PlatformGraphicsContext3D platformContext() override;
#endif
-private:
- static PassOwnPtr<GLContextEGL> createPbufferContext(EGLContext sharingContext);
- static PassOwnPtr<GLContextEGL> createPixmapContext(EGLContext sharingContext);
+ enum EGLSurfaceType { PbufferSurface, WindowSurface, PixmapSurface, Surfaceless };
- static void addActiveContext(GLContextEGL*);
- static void cleanupSharedEGLDisplay(void);
+ GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, EGLSurfaceType);
+#if PLATFORM(X11)
+ GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, XUniquePixmap&&);
+#endif
+#if PLATFORM(WAYLAND)
+ GLContextEGL(PlatformDisplay&, EGLContext, EGLSurface, WlUniquePtr<struct wl_surface>&&, struct wl_egl_window*);
+ void destroyWaylandWindow();
+#endif
+
+ static std::unique_ptr<GLContextEGL> createWindowContext(GLNativeWindowType, PlatformDisplay&, EGLContext sharingContext = nullptr);
+ static std::unique_ptr<GLContextEGL> createPbufferContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
+ static std::unique_ptr<GLContextEGL> createSurfacelessContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
+#if PLATFORM(X11)
+ static std::unique_ptr<GLContextEGL> createPixmapContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
+ static EGLSurface createWindowSurfaceX11(EGLDisplay, EGLConfig, GLNativeWindowType);
+#endif
+#if PLATFORM(WAYLAND)
+ static std::unique_ptr<GLContextEGL> createWaylandContext(PlatformDisplay&, EGLContext sharingContext = nullptr);
+ static EGLSurface createWindowSurfaceWayland(EGLDisplay, EGLConfig, GLNativeWindowType);
+#endif
- GLContextEGL(EGLContext, EGLSurface, EGLSurfaceType);
+ static bool getEGLConfig(EGLDisplay, EGLConfig*, EGLSurfaceType);
- EGLContext m_context;
- EGLSurface m_surface;
+ EGLContext m_context { nullptr };
+ EGLSurface m_surface { nullptr };
EGLSurfaceType m_type;
+#if PLATFORM(X11)
+ XUniquePixmap m_pixmap;
+#endif
+#if PLATFORM(WAYLAND)
+ WlUniquePtr<struct wl_surface> m_wlSurface;
+ struct wl_egl_window* m_wlWindow { nullptr };
+#endif
#if USE(CAIRO)
- cairo_device_t* m_cairoDevice;
+ cairo_device_t* m_cairoDevice { nullptr };
#endif
};
} // namespace WebCore
#endif // USE(EGL)
-
-#endif // GLContextEGL_h