/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ****************************************************************************/ #ifndef QGLXINTEGRATION_H #define QGLXINTEGRATION_H #include "qxcbwindow.h" #include "qxcbscreen.h" #include #include #include #include #include QT_BEGIN_NAMESPACE class QGLXContext : public QPlatformOpenGLContext { public: QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share, const QVariant &nativeHandle); ~QGLXContext(); bool makeCurrent(QPlatformSurface *surface) override; void doneCurrent() override; void swapBuffers(QPlatformSurface *surface) override; QFunctionPointer getProcAddress(const char *procName) override; QSurfaceFormat format() const override; bool isSharing() const override; bool isValid() const override; GLXContext glxContext() const { return m_context; } GLXFBConfig glxConfig() const { return m_config; } QVariant nativeHandle() const; static bool supportsThreading(); static void queryDummyContext(); private: void init(QXcbScreen *screen, QPlatformOpenGLContext *share); void init(QXcbScreen *screen, QPlatformOpenGLContext *share, const QVariant &nativeHandle); Display *m_display; GLXFBConfig m_config; GLXContext m_context; GLXContext m_shareContext; QSurfaceFormat m_format; bool m_isPBufferCurrent; bool m_ownsContext; GLenum (APIENTRY * m_getGraphicsResetStatus)(); bool m_lost; static bool m_queriedDummyContext; static bool m_supportsThreading; }; class QGLXPbuffer : public QPlatformOffscreenSurface { public: explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface); ~QGLXPbuffer(); QSurfaceFormat format() const override { return m_format; } bool isValid() const override { return m_pbuffer != 0; } GLXPbuffer pbuffer() const { return m_pbuffer; } private: QXcbScreen *m_screen; QSurfaceFormat m_format; Display *m_display; GLXPbuffer m_pbuffer; }; QT_END_NAMESPACE #endif