Created
October 24, 2012 14:06
-
-
Save zenoalbisser/3946226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit eec7f6e24d8f7a36db5529969ca17087edf37b76 | |
| Author: Zeno Albisser <zeno@webkit.org> | |
| Date: Wed Oct 24 16:04:15 2012 +0200 | |
| Add glxContextForContext function to QXcbNativeInterface. | |
| This change enables receiving the native GLXContext object that is used | |
| by a QOpenGLContext in case of GLX. | |
| This clearly is non-public api that is only meant to be used as a | |
| last resort for cases where it is really necessary to get hold of | |
| a native context object. | |
| Change-Id: I7f1f974f18063ed334b8034a0c0192c875c10cec | |
| diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp | |
| index 335866d..3238ae9 100644 | |
| --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp | |
| +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp | |
| @@ -71,6 +71,7 @@ public: | |
| insert("screen",QXcbNativeInterface::Screen); | |
| insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice); | |
| insert("eglcontext",QXcbNativeInterface::EglContext); | |
| + insert("glxcontext",QXcbNativeInterface::GLXContext); | |
| } | |
| }; | |
| @@ -94,6 +95,9 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt | |
| case EglContext: | |
| result = eglContextForContext(context); | |
| break; | |
| + case GLXContext: | |
| + result = glxContextForContext(context); | |
| + break; | |
| default: | |
| break; | |
| } | |
| @@ -229,4 +233,17 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context) | |
| #endif | |
| } | |
| +void *QXcbNativeInterface::glxContextForContext(QOpenGLContext *context) | |
| +{ | |
| + Q_ASSERT(context); | |
| +#if defined(XCB_USE_GLX) | |
| + QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle()); | |
| + return glxPlatformContext->glxContext(); | |
| +#else | |
| + Q_UNUSED(context); | |
| + return 0; | |
| +#endif | |
| + | |
| +} | |
| + | |
| QT_END_NAMESPACE | |
| diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h | |
| index 1223fdc..a62b852 100644 | |
| --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h | |
| +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h | |
| @@ -58,7 +58,8 @@ public: | |
| Connection, | |
| Screen, | |
| GraphicsDevice, | |
| - EglContext | |
| + EglContext, | |
| + GLXContext | |
| }; | |
| QXcbNativeInterface(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment