Debian Codegraph @

xcb/libqt5xcbqpa-dev/5.4.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 *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share,
25 const QVariant &nativeHandle);
26 ~QGLXContext();
27
28 bool makeCurrent(QPlatformSurface *surface);
29 void doneCurrent();
30 void swapBuffers(QPlatformSurface *surface);
31 void (*getProcAddress(const QByteArray &procName)) ();
32
33 QSurfaceFormat format() const;
34 bool isSharing() const;
35 bool isValid() const;
36
37 GLXContext glxContext() const { return m_context; }
38 GLXFBConfig glxConfig() const { return m_config; }
39
40 QVariant nativeHandle() const;
41
42 static bool supportsThreading();
43 static void queryDummyContext();
44
45 private:
46 void init(QXcbScreen *screen, QPlatformOpenGLContext *share);
47 void init(QXcbScreen *screen, QPlatformOpenGLContext *share, const QVariant &nativeHandle);
48
49 Display *m_display;
50 GLXFBConfig m_config;
51 GLXContext m_context;
52 GLXContext m_shareContext;
53 QSurfaceFormat m_format;
54 bool m_isPBufferCurrent;
55 int m_swapInterval;
56 bool m_ownsContext;
57 static bool m_queriedDummyContext;
58 static bool m_supportsThreading;
59 };
60
61
62 class QGLXPbuffer : public QPlatformOffscreenSurface
63 {
64 public:
65 explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface);
66 ~QGLXPbuffer();
67
68 QSurfaceFormat format() const { return m_format; }
69 bool isValid() const { return m_pbuffer != 0; }
70
71 GLXPbuffer pbuffer() const { return m_pbuffer; }
72
73 private:
74 QSurfaceFormat m_format;
75 QXcbScreen *m_screen;
76 GLXPbuffer m_pbuffer;
77 };
78
79 QT_END_NAMESPACE
80
81 #endif