Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qglxintegration.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#pragma once
6
7#include "qxcbwindow.h"
8#include "qxcbscreen.h"
9
10#include <qpa/qplatformopenglcontext.h>
11#include <qpa/qplatformoffscreensurface.h>
12#include <QtGui/QSurfaceFormat>
13
14#include <QtCore/QMutex>
15
16#include <GL/glx.h>
17
18QT_BEGIN_NAMESPACE
19
20class QGLXContext : public QPlatformOpenGLContext,
21 public QNativeInterface::QGLXContext
22{
23public:
24 QGLXContext(Display *display, QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
25 QGLXContext(Display *display, GLXContext context, void *visualInfo, QPlatformOpenGLContext *share);
26 ~QGLXContext();
27
28 bool makeCurrent(QPlatformSurface *surface) override;
29 void doneCurrent() override;
30 void swapBuffers(QPlatformSurface *surface) override;
31 QFunctionPointer getProcAddress(const char *procName) override;
32
33 QSurfaceFormat format() const override;
34 bool isSharing() const override;
35 bool isValid() const override;
36
37 GLXContext nativeContext() const override { return glxContext(); }
38
39 GLXContext glxContext() const { return m_context; }
40 GLXFBConfig glxConfig() const { return m_config; }
41
42 static bool supportsThreading();
43 static void queryDummyContext();
44
45private:
46 Display *m_display = nullptr;
47 GLXFBConfig m_config = nullptr;
48 GLXContext m_context = nullptr;
49 GLXContext m_shareContext = nullptr;
50 QSurfaceFormat m_format;
51 bool m_isPBufferCurrent = false;
52 bool m_ownsContext = false;
53 GLenum (APIENTRY * m_getGraphicsResetStatus)() = nullptr;
54 bool m_lost = false;
55 static bool m_queriedDummyContext;
56 static bool m_supportsThreading;
57};
58
59
61{
62public:
63 explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface);
64 ~QGLXPbuffer();
65
66 QSurfaceFormat format() const override { return m_format; }
67 bool isValid() const override { return m_pbuffer != 0; }
68
69 GLXPbuffer pbuffer() const { return m_pbuffer; }
70
71private:
72 QXcbScreen *m_screen;
73 QSurfaceFormat m_format;
74 Display *m_display;
75 GLXPbuffer m_pbuffer;
76};
77
78QT_END_NAMESPACE
QGLXPbuffer(QOffscreenSurface *offscreenSurface)
bool isValid() const override
Returns true if the platform offscreen surface has been allocated.
GLXPbuffer pbuffer() const
QSurfaceFormat format() const override
Returns the actual surface format of the offscreen surface.
#define GL_CONTEXT_PROFILE_MASK
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
#define GL_CONTEXT_CORE_PROFILE_BIT
#define GL_CONTEXT_FLAGS
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
#define GL_CONTEXT_FLAG_DEBUG_BIT
static Window createDummyWindow(Display *dpy, GLXFBConfig config, int screenNumber, Window rootWin)
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
static const char * qglx_threadedgl_blacklist_renderer[]
static Window createDummyWindow(Display *dpy, XVisualInfo *visualInfo, int screenNumber, Window rootWin)
static const char * qglx_threadedgl_blacklist_vendor[]
#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV
static void updateFormatFromContext(QSurfaceFormat &format)
static QByteArray getGlString(GLenum param)
static bool hasGlExtension(const QSurfaceFormat &format, const char *ext)
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB
static QXcbScreen * screenForPlatformSurface(QPlatformSurface *surface)
#define GLX_CONTEXT_PROFILE_MASK_ARB
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT
#define GLX_LOSE_CONTEXT_ON_RESET_ARB
#define GL_RESET_NOTIFICATION_STRATEGY_ARB
#define APIENTRY
Definition qopenglext.h:51
#define GL_LOSE_CONTEXT_ON_RESET_ARB
#define GL_NUM_EXTENSIONS
Definition qopenglext.h:906