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
24QT_BEGIN_NAMESPACE
25
26class QOpenGLShaderProgram;
27class QOpenGLTextureCache;
28
29namespace QtWaylandClient {
30
31class QWaylandEglWindow;
32class DecorationsBlitter;
33
34class Q_WAYLANDCLIENT_EXPORT QWaylandGLContext : public QEGLPlatformContext
35{
36public:
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
51protected:
52 EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
53 EGLSurface createTemporaryOffscreenSurface() override;
54 void destroyTemporaryOffscreenSurface(EGLSurface surface) override;
55
56private:
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
70QT_END_NAMESPACE
71
72#endif // QWAYLANDGLCONTEXT_H
73

source code of qtwayland/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h