Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qxcbglxnativeinterfacehandler.cpp
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
5
6#include "qglxintegration.h"
7#include <QtGui/QOpenGLContext>
9
10static int resourceType(const QByteArray &key)
11{
12 static const QByteArray names[] = { // match QXcbGlxNativeInterfaceHandler::ResourceType
13 QByteArrayLiteral("glxconfig"),
14 QByteArrayLiteral("glxcontext"),
15 };
16 for (size_t i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
17 if (key == names[i])
18 return i;
19 }
20
21 return sizeof(names) / sizeof(names[0]);
22}
23
28
30{
31 switch (resourceType(resource)) {
32 case GLXConfig:
33 return glxConfigForContext;
34 case GLXContext:
35 return glxContextForContext;
36 default:
37 break;
38 }
39 return nullptr;
40}
41
42void *QXcbGlxNativeInterfaceHandler::glxContextForContext(QOpenGLContext *context)
43{
45 QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
46 return glxPlatformContext->glxContext();
47}
48
49void *QXcbGlxNativeInterfaceHandler::glxConfigForContext(QOpenGLContext *context)
50{
52 QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
53 return glxPlatformContext->glxConfig();
54
55}
56
\inmodule QtCore
Definition qbytearray.h:57
GLXFBConfig glxConfig() const
GLXContext glxContext() const
\inmodule QtGui
void *(* NativeResourceForContextFunction)(QOpenGLContext *context)
QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override
QXcbGlxNativeInterfaceHandler(QXcbNativeInterface *nativeInterface)
Combined button and popup list for selecting options.
static void * context
#define QByteArrayLiteral(str)
Definition qbytearray.h:52
static int resourceType(const QByteArray &key)
GLuint64 key
GLuint GLuint * names
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
static QT_BEGIN_NAMESPACE int resourceType(const QByteArray &key)