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
qopengl_p.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
4#ifndef QOPENGL_P_H
5#define QOPENGL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <qopengl.h>
20#include <private/qopenglcontext_p.h>
21#include <QtCore/qset.h>
22#include <QtCore/qstring.h>
23#include <QtCore/qversionnumber.h>
24
26
27class QJsonDocument;
28
29class Q_GUI_EXPORT QOpenGLExtensionMatcher
30{
31public:
33
34 bool match(const QByteArray &extension) const
35 {
36 return m_extensions.contains(extension);
37 }
38
39 QSet<QByteArray> extensions() const { return m_extensions; }
40
41private:
42 QSet<QByteArray> m_extensions;
43};
44
45class Q_GUI_EXPORT QOpenGLConfig
46{
47public:
48 struct Q_GUI_EXPORT Gpu {
49 Gpu() : vendorId(0), deviceId(0) {}
50 bool isValid() const { return deviceId || !glVendor.isEmpty(); }
51 bool equals(const Gpu &other) const {
52 return vendorId == other.vendorId && deviceId == other.deviceId && driverVersion == other.driverVersion
53 && driverDescription == other.driverDescription && glVendor == other.glVendor;
54 }
55
61
62 static Gpu fromDevice(uint vendorId, uint deviceId, QVersionNumber driverVersion, const QByteArray &driverDescription) {
63 Gpu gpu;
64 gpu.vendorId = vendorId;
65 gpu.deviceId = deviceId;
66 gpu.driverVersion = driverVersion;
67 gpu.driverDescription = driverDescription;
68 return gpu;
69 }
70
71 static Gpu fromGLVendor(const QByteArray &glVendor) {
72 Gpu gpu;
73 gpu.glVendor = glVendor;
74 return gpu;
75 }
76
77 static Gpu fromContext();
78 };
79
80 static QSet<QString> gpuFeatures(const Gpu &gpu,
81 const QString &osName, const QVersionNumber &kernelVersion, const QString &osVersion,
82 const QJsonDocument &doc);
83 static QSet<QString> gpuFeatures(const Gpu &gpu,
84 const QString &osName, const QVersionNumber &kernelVersion, const QString &osVersion,
85 const QString &fileName);
86 static QSet<QString> gpuFeatures(const Gpu &gpu, const QJsonDocument &doc);
87 static QSet<QString> gpuFeatures(const Gpu &gpu, const QString &fileName);
88};
89
91{
92 return a.equals(b);
93}
94
96{
97 return !a.equals(b);
98}
99
100inline size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed = 0)
101{
102 return (qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion)) ^ seed;
103}
104
106
107#endif // QOPENGL_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
bool match(const QByteArray &extension) const
Definition qopengl_p.h:34
QSet< QByteArray > extensions() const
Definition qopengl_p.h:39
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
void extension()
[6]
Definition dialogs.cpp:230
Combined button and popup list for selecting options.
bool operator!=(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
Definition qopengl_p.h:95
bool operator==(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
Definition qopengl_p.h:90
size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed=0)
Definition qopengl_p.h:100
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
unsigned int uint
Definition qtypes.h:34
QSharedPointer< T > other(t)
[5]
bool isValid() const
Definition qopengl_p.h:50
bool equals(const Gpu &other) const
Definition qopengl_p.h:51
static Gpu fromDevice(uint vendorId, uint deviceId, QVersionNumber driverVersion, const QByteArray &driverDescription)
Definition qopengl_p.h:62
QVersionNumber driverVersion
Definition qopengl_p.h:58
QByteArray glVendor
Definition qopengl_p.h:60
static Gpu fromGLVendor(const QByteArray &glVendor)
Definition qopengl_p.h:71
QByteArray driverDescription
Definition qopengl_p.h:59