1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the Qt API. It exists purely as an |
9 | // implementation detail. This header file may change from version to |
10 | // version without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | // |
14 | |
15 | #ifndef QWAYLANDGLCONTEXT_H |
16 | #define QWAYLANDGLCONTEXT_H |
17 | |
18 | #include "qwaylandeglinclude_p.h" //must be first |
19 | |
20 | #include <QtWaylandClient/private/qwaylanddisplay_p.h> |
21 | #include <QtGui/private/qeglplatformcontext_p.h> |
22 | #include <qpa/qplatformopenglcontext.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QOpenGLShaderProgram; |
27 | class QOpenGLTextureCache; |
28 | |
29 | namespace QtWaylandClient { |
30 | |
31 | class QWaylandEglWindow; |
32 | class DecorationsBlitter; |
33 | |
34 | class Q_WAYLANDCLIENT_EXPORT QWaylandGLContext : public QEGLPlatformContext |
35 | { |
36 | public: |
37 | QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share); |
38 | ~QWaylandGLContext(); |
39 | void swapBuffers(QPlatformSurface *surface) override; |
40 | |
41 | bool makeCurrent(QPlatformSurface *surface) override; |
42 | void doneCurrent() override; |
43 | |
44 | void beginFrame() override; |
45 | void endFrame() override; |
46 | |
47 | GLuint defaultFramebufferObject(QPlatformSurface *surface) const override; |
48 | |
49 | QFunctionPointer getProcAddress(const char *procName) override; |
50 | |
51 | protected: |
52 | EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; |
53 | EGLSurface createTemporaryOffscreenSurface() override; |
54 | void destroyTemporaryOffscreenSurface(EGLSurface surface) override; |
55 | |
56 | private: |
57 | QWaylandDisplay *m_display = nullptr; |
58 | EGLContext m_decorationsContext; |
59 | DecorationsBlitter *m_blitter = nullptr; |
60 | bool m_supportNonBlockingSwap = true; |
61 | EGLenum m_api; |
62 | wl_surface *m_wlSurface = nullptr; |
63 | wl_egl_window *m_eglWindow = nullptr; |
64 | QWaylandEglWindow *m_currentWindow = nullptr; |
65 | QMetaObject::Connection m_reconnectionWatcher; |
66 | }; |
67 | |
68 | } |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QWAYLANDGLCONTEXT_H |
73 | |