qopengl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopengl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8typedef const GLubyte * ( * qt_glGetStringi)(GLenum, GLuint);-
9-
10-
11QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()-
12{-
13 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
14 QOpenGLFunctions *funcs = ctx->functions();-
15 const char *extensionStr = 0;-
16-
17 if (ctx->isOpenGLES()
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
|| ctx->format().majorVersion() < 3
ctx->format()....rVersion() < 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
18 extensionStr = reinterpret_cast<const char *>(funcs->glGetString(0x1F03));
never executed: extensionStr = reinterpret_cast<const char *>(funcs->glGetString(0x1F03));
0
19-
20 if (extensionStr
extensionStrDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
21 QByteArray ba(extensionStr);-
22 QList<QByteArray> extensions = ba.split(' ');-
23 m_extensions = extensions.toSet();-
24 }
never executed: end of block
else {
0
25-
26-
27 while (funcs->glGetError()
funcs->glGetError()Description
TRUEnever evaluated
FALSEnever evaluated
) {}
never executed: end of block
0
28-
29 if (ctx
ctxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
30 qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");-
31-
32 if (!glGetStringi
!glGetStringiDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
33 return;
never executed: return;
0
34-
35 GLint numExtensions = 0;-
36 funcs->glGetIntegerv(0x821D, &numExtensions);-
37-
38 for (int i = 0; i < numExtensions
i < numExtensionsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
39 const char *str = reinterpret_cast<const char *>(glGetStringi(0x1F03, i));-
40 m_extensions.insert(str);-
41 }
never executed: end of block
0
42 }
never executed: end of block
0
43-
44 }
never executed: end of block
0
45}-
46QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g)-
47{-
48 QDebugStateSaver s(d);-
49 d.nospace();-
50 d << "Gpu(";-
51 if (g.isValid()
g.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
52 d << "vendor=" << hex << showbase <<g.vendorId << ", device=" << g.deviceId-
53 << "version=" << g.driverVersion;-
54 }
never executed: end of block
else {
0
55 d << 0;-
56 }
never executed: end of block
0
57 d << ')';-
58 return
never executed: return d;
d;
never executed: return d;
0
59}-
60-
61typedef QJsonArray::ConstIterator JsonArrayConstIt;-
62-
63static inline bool contains(const QJsonArray &haystack, unsigned needle)-
64{-
65 for (JsonArrayConstIt it = haystack.constBegin(), cend = haystack.constEnd(); it != cend
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
66 if (needle == it->toString().toUInt(nullptr, 0)
needle == it->...nt(nullptr, 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
67 return
never executed: return true;
true;
never executed: return true;
0
68 }
never executed: end of block
0
69 return
never executed: return false;
false;
never executed: return false;
0
70}-
71-
72static inline bool contains(const QJsonArray &haystack, const QString &needle)-
73{-
74 for (JsonArrayConstIt it = haystack.constBegin(), cend = haystack.constEnd(); it != cend
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
75 if (needle == it->toString()
needle == it->toString()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
76 return
never executed: return true;
true;
never executed: return true;
0
77 }
never executed: end of block
0
78 return
never executed: return false;
false;
never executed: return false;
0
79}-
80-
81namespace {-
82enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan };-
83static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="};-
84-
85-
86-
87struct VersionTerm {-
88 VersionTerm() : op(NotEqual) {}
never executed: end of block
0
89 static VersionTerm fromJson(const QJsonValue &v);-
90 bool isNull() const { return
never executed: return number.isNull();
number.isNull();
never executed: return number.isNull();
}
0
91 bool matches(const QVersionNumber &other) const;-
92-
93 QVersionNumber number;-
94 Operator op;-
95};-
96-
97bool VersionTerm::matches(const QVersionNumber &other) const-
98{-
99 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
|| other.isNull()
other.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 QMessageLogger(__FILE__, 177, __PRETTY_FUNCTION__).warning("called with invalid parameters");-
101 return
never executed: return false;
false;
never executed: return false;
0
102 }-
103 switch (op) {-
104 case
never executed: case NotEqual:
NotEqual:
never executed: case NotEqual:
0
105 return
never executed: return other != number;
other != number;
never executed: return other != number;
0
106 case
never executed: case LessThan:
LessThan:
never executed: case LessThan:
0
107 return
never executed: return other < number;
other < number;
never executed: return other < number;
0
108 case
never executed: case LessEqualThan:
LessEqualThan:
never executed: case LessEqualThan:
0
109 return
never executed: return other <= number;
other <= number;
never executed: return other <= number;
0
110 case
never executed: case Equals:
Equals:
never executed: case Equals:
0
111 return
never executed: return other == number;
other == number;
never executed: return other == number;
0
112 case
never executed: case GreaterThan:
GreaterThan:
never executed: case GreaterThan:
0
113 return
never executed: return other > number;
other > number;
never executed: return other > number;
0
114 case
never executed: case GreaterEqualThan:
GreaterEqualThan:
never executed: case GreaterEqualThan:
0
115 return
never executed: return other >= number;
other >= number;
never executed: return other >= number;
0
116 }-
117 return
never executed: return false;
false;
never executed: return false;
0
118}-
119-
120VersionTerm VersionTerm::fromJson(const QJsonValue &v)-
121{-
122 VersionTerm result;-
123 if (!v.isObject()
!v.isObject()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
124 return
never executed: return result;
result;
never executed: return result;
0
125 const QJsonObject o = v.toObject();-
126 result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());-
127 const QString opS = o.value(QLatin1String("op")).toString();-
128 for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0])
i < sizeof(ope...(operators[0])Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
129 if (opS == QLatin1String(operators[i])
opS == QLatin1...(operators[i])Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
130 result.op = static_cast<Operator>(i);-
131 break;
never executed: break;
0
132 }-
133 }
never executed: end of block
0
134 return
never executed: return result;
result;
never executed: return result;
0
135}-
136-
137-
138-
139struct OsTypeTerm-
140{-
141 static OsTypeTerm fromJson(const QJsonValue &v);-
142 static QString hostOs();-
143 static QVersionNumber hostKernelVersion() { return
never executed: return QVersionNumber::fromString(QSysInfo::kernelVersion());
QVersionNumber::fromString(QSysInfo::kernelVersion());
never executed: return QVersionNumber::fromString(QSysInfo::kernelVersion());
}
0
144 static QString hostOsRelease() {-
145 QString ver;-
146 return
never executed: return ver;
ver;
never executed: return ver;
0
147 }-
148-
149 bool isNull() const { return
never executed: return type.isEmpty();
type.isEmpty();
never executed: return type.isEmpty();
}
0
150 bool matches(const QString &osName, const QVersionNumber &kernelVersion, const QString &osRelease) const-
151 {-
152 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
|| osName.isEmpty()
osName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| kernelVersion.isNull()
kernelVersion.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
153 QMessageLogger(__FILE__, 255, __PRETTY_FUNCTION__).warning("called with invalid parameters");-
154 return
never executed: return false;
false;
never executed: return false;
0
155 }-
156 if (type != osName
type != osNameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
157 return
never executed: return false;
false;
never executed: return false;
0
158 if (!versionTerm.isNull()
!versionTerm.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !versionTerm.matches(kernelVersion)
!versionTerm.m...kernelVersion)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
159 return
never executed: return false;
false;
never executed: return false;
0
160-
161 if (!release.isEmpty()
!release.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !contains(release, osRelease)
!contains(release, osRelease)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
162 return
never executed: return false;
false;
never executed: return false;
0
163 return
never executed: return true;
true;
never executed: return true;
0
164 }-
165-
166 QString type;-
167 VersionTerm versionTerm;-
168 QJsonArray release;-
169};-
170-
171OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)-
172{-
173 OsTypeTerm result;-
174 if (!v.isObject()
!v.isObject()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
175 return
never executed: return result;
result;
never executed: return result;
0
176 const QJsonObject o = v.toObject();-
177 result.type = o.value(QLatin1String("type")).toString();-
178 result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));-
179 result.release = o.value(QLatin1String("release")).toArray();-
180 return
never executed: return result;
result;
never executed: return result;
0
181}-
182-
183QString OsTypeTerm::hostOs()-
184{-
185-
186-
187-
188-
189 return
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "linux")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "linux" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
([]() -> QString { enum { Size = sizeof(u"" "linux")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "linux" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}());
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "linux")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "linux" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
0
190-
191-
192-
193-
194-
195-
196-
197}-
198}-
199-
200static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)-
201{-
202 QString result;-
203 QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()-
204 << " (\"" << object.value(QLatin1String("description")).toString()-
205 << "\"): " << what;-
206 return
never executed: return result;
result;
never executed: return result;
0
207}-
208-
209-
210-
211-
212static bool matches(const QJsonObject &object,-
213 const QString &osName,-
214 const QVersionNumber &kernelVersion,-
215 const QString &osRelease,-
216 const QOpenGLConfig::Gpu &gpu)-
217{-
218 const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os")));-
219 if (!os.isNull()
!os.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !os.matches(osName, kernelVersion, osRelease)
!os.matches(os...on, osRelease)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
220 return
never executed: return false;
false;
never executed: return false;
0
221-
222 const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));-
223 if (exceptionsV.isArray()
exceptionsV.isArray()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
224 const QJsonArray exceptionsA = exceptionsV.toArray();-
225 for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
226 if (matches(it->toObject(), osName, kernelVersion, osRelease, gpu)
matches(it->to...sRelease, gpu)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
227 return
never executed: return false;
false;
never executed: return false;
0
228 }
never executed: end of block
0
229 }
never executed: end of block
0
230-
231 const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));-
232 if (vendorV.isString()
vendorV.isString()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
233 if (gpu.vendorId != vendorV.toString().toUInt(nullptr, 0)
gpu.vendorId !...nt(nullptr, 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
234 return
never executed: return false;
false;
never executed: return false;
0
235 }
never executed: end of block
else {
0
236 if (object.contains(QLatin1String("gl_vendor"))
object.contain...("gl_vendor"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
237 const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();-
238 if (!gpu.glVendor.contains(glVendorV)
!gpu.glVendor....ins(glVendorV)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
239 return
never executed: return false;
false;
never executed: return false;
0
240 }
never executed: end of block
0
241 }
never executed: end of block
0
242-
243 if (gpu.deviceId
gpu.deviceIdDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
244 const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));-
245 switch (deviceIdV.type()) {-
246 case
never executed: case QJsonValue::Array:
QJsonValue::Array:
never executed: case QJsonValue::Array:
0
247 if (!contains(deviceIdV.toArray(), gpu.deviceId)
!contains(devi... gpu.deviceId)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
248 return
never executed: return false;
false;
never executed: return false;
0
249 break;
never executed: break;
0
250 case
never executed: case QJsonValue::Undefined:
QJsonValue::Undefined:
never executed: case QJsonValue::Undefined:
0
251 case
never executed: case QJsonValue::Null:
QJsonValue::Null:
never executed: case QJsonValue::Null:
0
252 break;
never executed: break;
0
253 default
never executed: default:
:
never executed: default:
0
254 QMessageLogger(__FILE__, 356, __PRETTY_FUNCTION__).warning().noquote()-
255 << msgSyntaxWarning(object,-
256 QLatin1String("Device ID must be of type array."));-
257 }
never executed: end of block
0
258 }-
259 if (!gpu.driverVersion.isNull()
!gpu.driverVersion.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
260 const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));-
261 switch (driverVersionV.type()) {-
262 case
never executed: case QJsonValue::Object:
QJsonValue::Object:
never executed: case QJsonValue::Object:
0
263 if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion)
!VersionTerm::...driverVersion)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
264 return
never executed: return false;
false;
never executed: return false;
0
265 break;
never executed: break;
0
266 case
never executed: case QJsonValue::Undefined:
QJsonValue::Undefined:
never executed: case QJsonValue::Undefined:
0
267 case
never executed: case QJsonValue::Null:
QJsonValue::Null:
never executed: case QJsonValue::Null:
0
268 break;
never executed: break;
0
269 default
never executed: default:
:
never executed: default:
0
270 QMessageLogger(__FILE__, 372, __PRETTY_FUNCTION__).warning().noquote()-
271 << msgSyntaxWarning(object,-
272 QLatin1String("Driver version must be of type object."));-
273 }
never executed: end of block
0
274 }-
275-
276 if (!gpu.driverDescription.isEmpty()
!gpu.driverDes...tion.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
277 const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));-
278 if (driverDescriptionV.isString()
driverDescriptionV.isString()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
279 if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8())
!gpu.driverDes...ng().toUtf8())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
280 return
never executed: return false;
false;
never executed: return false;
0
281 }
never executed: end of block
0
282 }
never executed: end of block
0
283-
284 return
never executed: return true;
true;
never executed: return true;
0
285}-
286-
287static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,-
288 const QString &osName,-
289 const QVersionNumber &kernelVersion,-
290 const QString &osRelease,-
291 const QJsonDocument &doc,-
292 QSet<QString> *result,-
293 QString *errorMessage)-
294{-
295 result->clear();-
296 errorMessage->clear();-
297 const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));-
298 if (!entriesV.isArray()
!entriesV.isArray()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
299 *errorMessage = QLatin1String("No entries read.");-
300 return
never executed: return false;
false;
never executed: return false;
0
301 }-
302-
303 const QJsonArray entriesA = entriesV.toArray();-
304 for (JsonArrayConstIt eit = entriesA.constBegin(), ecend = entriesA.constEnd(); eit != ecend
eit != ecendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++eit) {
0
305 if (eit->isObject()
eit->isObject()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
306 const QJsonObject object = eit->toObject();-
307 if (matches(object, osName, kernelVersion, osRelease, gpu)
matches(object...sRelease, gpu)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
308 const QJsonValue featuresListV = object.value(QLatin1String("features"));-
309 if (featuresListV.isArray()
featuresListV.isArray()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
310 const QJsonArray featuresListA = featuresListV.toArray();-
311 for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend
fit != fcendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++fit)
0
312 result->insert(fit->toString());
never executed: result->insert(fit->toString());
0
313 }
never executed: end of block
0
314 }
never executed: end of block
0
315 }
never executed: end of block
0
316 }
never executed: end of block
0
317 return
never executed: return true;
true;
never executed: return true;
0
318}-
319-
320static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,-
321 const QString &osName,-
322 const QVersionNumber &kernelVersion,-
323 const QString &osRelease,-
324 const QByteArray &jsonAsciiData,-
325 QSet<QString> *result, QString *errorMessage)-
326{-
327 result->clear();-
328 errorMessage->clear();-
329 QJsonParseError error;-
330 const QJsonDocument document = QJsonDocument::fromJson(jsonAsciiData, &error);-
331 if (document.isNull()
document.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
332 const int lineNumber = 1 + jsonAsciiData.left(error.offset).count('\n');-
333 QTextStream str(errorMessage);-
334 str << "Failed to parse data: \"" << error.errorString()-
335 << "\" at line " << lineNumber << " (offset: "-
336 << error.offset << ").";-
337 return
never executed: return false;
false;
never executed: return false;
0
338 }-
339 return
never executed: return readGpuFeatures(gpu, osName, kernelVersion, osRelease, document, result, errorMessage);
readGpuFeatures(gpu, osName, kernelVersion, osRelease, document, result, errorMessage);
never executed: return readGpuFeatures(gpu, osName, kernelVersion, osRelease, document, result, errorMessage);
0
340}-
341-
342static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,-
343 const QString &osName,-
344 const QVersionNumber &kernelVersion,-
345 const QString &osRelease,-
346 const QString &fileName,-
347 QSet<QString> *result, QString *errorMessage)-
348{-
349 result->clear();-
350 errorMessage->clear();-
351 QFile file(fileName);-
352 if (!file.open(QIODevice::ReadOnly)
!file.open(QIO...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
353 QTextStream str(errorMessage);-
354 str << "Cannot open \"" << QDir::toNativeSeparators(fileName) << "\": "-
355 << file.errorString();-
356 return
never executed: return false;
false;
never executed: return false;
0
357 }-
358 const bool success = readGpuFeatures(gpu, osName, kernelVersion, osRelease, file.readAll(), result, errorMessage);-
359 if (!success
!successDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
360 errorMessage->prepend(QLatin1String("Error reading \"")-
361 + QDir::toNativeSeparators(fileName)-
362 + QLatin1String("\": "));-
363 }
never executed: end of block
0
364 return
never executed: return success;
success;
never executed: return success;
0
365}-
366-
367QSet<QString> QOpenGLConfig::gpuFeatures(const QOpenGLConfig::Gpu &gpu,-
368 const QString &osName,-
369 const QVersionNumber &kernelVersion,-
370 const QString &osRelease,-
371 const QJsonDocument &doc)-
372{-
373 QSet<QString> result;-
374 QString errorMessage;-
375 if (!readGpuFeatures(gpu, osName, kernelVersion, osRelease, doc, &result, &errorMessage)
!readGpuFeatur...&errorMessage)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
376 QMessageLogger(__FILE__, 478, __PRETTY_FUNCTION__).warning().noquote() << errorMessage;
never executed: QMessageLogger(__FILE__, 478, __PRETTY_FUNCTION__).warning().noquote() << errorMessage;
0
377 return
never executed: return result;
result;
never executed: return result;
0
378}-
379-
380QSet<QString> QOpenGLConfig::gpuFeatures(const QOpenGLConfig::Gpu &gpu,-
381 const QString &osName,-
382 const QVersionNumber &kernelVersion,-
383 const QString &osRelease,-
384 const QString &fileName)-
385{-
386 QSet<QString> result;-
387 QString errorMessage;-
388 if (!readGpuFeatures(gpu, osName, kernelVersion, osRelease, fileName, &result, &errorMessage)
!readGpuFeatur...&errorMessage)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
389 QMessageLogger(__FILE__, 491, __PRETTY_FUNCTION__).warning().noquote() << errorMessage;
never executed: QMessageLogger(__FILE__, 491, __PRETTY_FUNCTION__).warning().noquote() << errorMessage;
0
390 return
never executed: return result;
result;
never executed: return result;
0
391}-
392-
393QSet<QString> QOpenGLConfig::gpuFeatures(const Gpu &gpu, const QJsonDocument &doc)-
394{-
395 return
never executed: return gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), doc);
gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), doc);
never executed: return gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), doc);
0
396}-
397-
398QSet<QString> QOpenGLConfig::gpuFeatures(const Gpu &gpu, const QString &fileName)-
399{-
400 return
never executed: return gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), fileName);
gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), fileName);
never executed: return gpuFeatures(gpu, OsTypeTerm::hostOs(), OsTypeTerm::hostKernelVersion(), OsTypeTerm::hostOsRelease(), fileName);
0
401}-
402-
403QOpenGLConfig::Gpu QOpenGLConfig::Gpu::fromContext()-
404{-
405 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
406 QScopedPointer<QOpenGLContext> tmpContext;-
407 QScopedPointer<QOffscreenSurface> tmpSurface;-
408 if (!ctx
!ctxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
409 tmpContext.reset(new QOpenGLContext);-
410 if (!tmpContext->create()
!tmpContext->create()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
411 QMessageLogger(__FILE__, 513, __PRETTY_FUNCTION__).warning("QOpenGLConfig::Gpu::fromContext: Failed to create temporary context");-
412 return
never executed: return QOpenGLConfig::Gpu();
QOpenGLConfig::Gpu();
never executed: return QOpenGLConfig::Gpu();
0
413 }-
414 tmpSurface.reset(new QOffscreenSurface);-
415 tmpSurface->setFormat(tmpContext->format());-
416 tmpSurface->create();-
417 tmpContext->makeCurrent(tmpSurface.data());-
418 }
never executed: end of block
0
419-
420 QOpenGLConfig::Gpu gpu;-
421 ctx = QOpenGLContext::currentContext();-
422 const GLubyte *p = ctx->functions()->glGetString(0x1F00);-
423 if (p
pDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
424 gpu.glVendor = QByteArray(reinterpret_cast<const char *>(p));
never executed: gpu.glVendor = QByteArray(reinterpret_cast<const char *>(p));
0
425-
426 return
never executed: return gpu;
gpu;
never executed: return gpu;
0
427}-
428-
429__attribute__((visibility("default"))) std::set<QByteArray> *qgpu_features(const QString &filename)-
430{-
431 const QSet<QString> features = QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu::fromContext(), filename);-
432 std::set<QByteArray> *result = new std::set<QByteArray>;-
433 for (const QString &feature : features)-
434 result->insert(feature.toUtf8());
never executed: result->insert(feature.toUtf8());
0
435 return
never executed: return result;
result;
never executed: return result;
0
436}-
437-
438-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9