Debian Codegraph @

xcb/libqt5xcbqpa-dev/5.3.1/qglxintegration.h

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5 #ifndef QGLXINTEGRATION_H
6 #define QGLXINTEGRATION_H
7
8 #include "qxcbwindow.h"
9 #include "qxcbscreen.h"
10
11 #include <qpa/qplatformopenglcontext.h>
12 #include <qpa/qplatformoffscreensurface.h>
13 #include <QtGui/QSurfaceFormat>
14
15 #include <QtCore/QMutex>
16
17 #include <GL/glx.h>
18
19 QT_BEGIN_NAMESPACE
20
21 class QGLXContext : public QPlatformOpenGLContext
22 {
23 public:
24 QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
25 ~QGLXContext();
26
27 bool makeCurrent(QPlatformSurface *surface);
28 void doneCurrent();
29 void swapBuffers(QPlatformSurface *surface);
30 void (*getProcAddress(const QByteArray &procName)) ();
31
32 QSurfaceFormat format() const;
33 bool isSharing() const;
34 bool isValid() const;
35
36 GLXContext glxContext() const { return m_context; }
37
38 static bool supportsThreading();
39 static void queryDummyContext();
40
41 private:
42 QXcbScreen *m_screen;
43 GLXContext m_context;
44 GLXContext m_shareContext;
45 QSurfaceFormat m_format;
46 bool m_isPBufferCurrent;
47 int m_swapInterval;
48 static bool m_queriedDummyContext;
49 static bool m_supportsThreading;
50 };
51
52
53 class QGLXPbuffer : public QPlatformOffscreenSurface
54 {
55 public:
56 explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface);
57 ~QGLXPbuffer();
58
59 QSurfaceFormat format() const { return m_format; }
60 bool isValid() const { return m_pbuffer != 0; }
61
62 GLXPbuffer pbuffer() const { return m_pbuffer; }
63
64 private:
65 QSurfaceFormat m_format;
66 QXcbScreen *m_screen;
67 GLXPbuffer m_pbuffer;
68 };
69
70 QT_END_NAMESPACE
71
72 #endif