kernel/qopenglcontext.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8class QGuiGLThreadContext -
9{ -
10public: -
11 QGuiGLThreadContext() -
12 : context(0) -
13 { -
14 }
never executed: }
0
15 ~QGuiGLThreadContext() { -
16 if (context)
never evaluated: context
0
17 context->doneCurrent();
never executed: context->doneCurrent();
0
18 }
never executed: }
0
19 QOpenGLContext *context; -
20}; -
21 -
22static QThreadStorage<QGuiGLThreadContext *> qwindow_context_storage; -
23QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context) -
24{ -
25 QGuiGLThreadContext *threadContext = qwindow_context_storage.localData(); -
26 if (!threadContext) {
never evaluated: !threadContext
0
27 if (!QThread::currentThread()) {
never evaluated: !QThread::currentThread()
0
28 QMessageLogger("kernel/qopenglcontext.cpp", 168, __PRETTY_FUNCTION__).warning("No QTLS available. currentContext won't work"); -
29 return 0;
never executed: return 0;
0
30 } -
31 threadContext = new QGuiGLThreadContext; -
32 qwindow_context_storage.setLocalData(threadContext); -
33 }
never executed: }
0
34 QOpenGLContext *previous = threadContext->context; -
35 threadContext->context = context; -
36 return previous;
never executed: return previous;
0
37} -
38 -
39int QOpenGLContextPrivate::maxTextureSize() -
40{ -
41 if (max_texture_size != -1)
never evaluated: max_texture_size != -1
0
42 return max_texture_size;
never executed: return max_texture_size;
0
43 -
44 glGetIntegerv(0x0D33, &max_texture_size); -
45 -
46 -
47 -
48 -
49 GLenum proxy = 0x8064; -
50 -
51 GLint size; -
52 GLint next = 64; -
53 glTexImage2D(proxy, 0, 0x1908, next, next, 0, 0x1908, 0x1401, 0); -
54 glGetTexLevelParameteriv(proxy, 0, 0x1000, &size); -
55 if (size == 0) {
never evaluated: size == 0
0
56 return max_texture_size;
never executed: return max_texture_size;
0
57 } -
58 do { -
59 size = next; -
60 next = size * 2; -
61 -
62 if (next > max_texture_size)
never evaluated: next > max_texture_size
0
63 break;
never executed: break;
0
64 glTexImage2D(proxy, 0, 0x1908, next, next, 0, 0x1908, 0x1401, 0); -
65 glGetTexLevelParameteriv(proxy, 0, 0x1000, &next); -
66 } while (next > size);
never evaluated: next > size
never executed: }
0
67 -
68 max_texture_size = size; -
69 return max_texture_size;
never executed: return max_texture_size;
0
70 -
71} -
72 -
73 -
74 -
75 -
76 -
77QOpenGLContext* QOpenGLContext::currentContext() -
78{ -
79 QGuiGLThreadContext *threadContext = qwindow_context_storage.localData(); -
80 if(threadContext) {
never evaluated: threadContext
0
81 return threadContext->context;
never executed: return threadContext->context;
0
82 } -
83 return 0;
never executed: return 0;
0
84} -
85 -
86 -
87 -
88 -
89bool QOpenGLContext::areSharing(QOpenGLContext *first, QOpenGLContext *second) -
90{ -
91 return first->shareGroup() == second->shareGroup();
never executed: return first->shareGroup() == second->shareGroup();
0
92} -
93 -
94 -
95 -
96 -
97 -
98 -
99QPlatformOpenGLContext *QOpenGLContext::handle() const -
100{ -
101 const QOpenGLContextPrivate * const d = d_func(); -
102 return d->platformGLContext;
never executed: return d->platformGLContext;
0
103} -
104 -
105 -
106 -
107 -
108 -
109 -
110 -
111QPlatformOpenGLContext *QOpenGLContext::shareHandle() const -
112{ -
113 const QOpenGLContextPrivate * const d = d_func(); -
114 if (d->shareContext)
never evaluated: d->shareContext
0
115 return d->shareContext->handle();
never executed: return d->shareContext->handle();
0
116 return 0;
never executed: return 0;
0
117} -
118QOpenGLContext::QOpenGLContext(QObject *parent) -
119 : QObject(*new QOpenGLContextPrivate(), parent) -
120{ -
121 QOpenGLContextPrivate * const d = d_func(); -
122 d->screen = QGuiApplication::primaryScreen(); -
123}
never executed: }
0
124 -
125 -
126 -
127 -
128 -
129void QOpenGLContext::setFormat(const QSurfaceFormat &format) -
130{ -
131 QOpenGLContextPrivate * const d = d_func(); -
132 d->requestedFormat = format; -
133}
never executed: }
0
134 -
135 -
136 -
137 -
138 -
139void QOpenGLContext::setShareContext(QOpenGLContext *shareContext) -
140{ -
141 QOpenGLContextPrivate * const d = d_func(); -
142 d->shareContext = shareContext; -
143}
never executed: }
0
144 -
145 -
146 -
147 -
148 -
149void QOpenGLContext::setScreen(QScreen *screen) -
150{ -
151 QOpenGLContextPrivate * const d = d_func(); -
152 d->screen = screen; -
153 if (!d->screen)
never evaluated: !d->screen
0
154 d->screen = QGuiApplication::primaryScreen();
never executed: d->screen = QGuiApplication::primaryScreen();
0
155}
never executed: }
0
156bool QOpenGLContext::create() -
157{ -
158 destroy(); -
159 -
160 QOpenGLContextPrivate * const d = d_func(); -
161 d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this); -
162 if (!d->platformGLContext)
never evaluated: !d->platformGLContext
0
163 return false;
never executed: return false;
0
164 d->platformGLContext->setContext(this); -
165 if (!d->platformGLContext->isSharing())
never evaluated: !d->platformGLContext->isSharing()
0
166 d->shareContext = 0;
never executed: d->shareContext = 0;
0
167 d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;
never evaluated: d->shareContext
0
168 d->shareGroup->d_func()->addContext(this); -
169 return d->platformGLContext;
never executed: return d->platformGLContext;
0
170} -
171void QOpenGLContext::destroy() -
172{ -
173 QOpenGLContextPrivate * const d = d_func(); -
174 if (d->platformGLContext)
never evaluated: d->platformGLContext
0
175 aboutToBeDestroyed();
never executed: aboutToBeDestroyed();
0
176 if (QOpenGLContext::currentContext() == this)
never evaluated: QOpenGLContext::currentContext() == this
0
177 doneCurrent();
never executed: doneCurrent();
0
178 if (d->shareGroup)
never evaluated: d->shareGroup
0
179 d->shareGroup->d_func()->removeContext(this);
never executed: d->shareGroup->d_func()->removeContext(this);
0
180 d->shareGroup = 0; -
181 delete d->platformGLContext; -
182 d->platformGLContext = 0; -
183 delete d->functions; -
184 d->functions = 0; -
185}
never executed: }
0
186QOpenGLContext::~QOpenGLContext() -
187{ -
188 destroy(); -
189 -
190 -
191 -
192 -
193}
never executed: }
0
194 -
195 -
196 -
197 -
198 -
199 -
200bool QOpenGLContext::isValid() const -
201{ -
202 const QOpenGLContextPrivate * const d = d_func(); -
203 return d->platformGLContext && d->platformGLContext->isValid();
never executed: return d->platformGLContext && d->platformGLContext->isValid();
0
204} -
205QOpenGLFunctions *QOpenGLContext::functions() const -
206{ -
207 const QOpenGLContextPrivate * const d = d_func(); -
208 if (!d->functions)
never evaluated: !d->functions
0
209 const_cast<QOpenGLFunctions *&>(d->functions) = new QOpenGLExtensions(QOpenGLContext::currentContext());
never executed: const_cast<QOpenGLFunctions *&>(d->functions) = new QOpenGLExtensions(QOpenGLContext::currentContext());
0
210 return d->functions;
never executed: return d->functions;
0
211} -
212QSet<QByteArray> QOpenGLContext::extensions() const -
213{ -
214 const QOpenGLContextPrivate * const d = d_func(); -
215 if (d->extensionNames.isEmpty()) {
never evaluated: d->extensionNames.isEmpty()
0
216 QOpenGLExtensionMatcher matcher; -
217 d->extensionNames = matcher.extensions(); -
218 }
never executed: }
0
219 -
220 return d->extensionNames;
never executed: return d->extensionNames;
0
221} -
222bool QOpenGLContext::hasExtension(const QByteArray &extension) const -
223{ -
224 return extensions().contains(extension);
never executed: return extensions().contains(extension);
0
225} -
226GLuint QOpenGLContext::defaultFramebufferObject() const -
227{ -
228 if (!isValid())
never evaluated: !isValid()
0
229 return 0;
never executed: return 0;
0
230 -
231 const QOpenGLContextPrivate * const d = d_func(); -
232 if (!d->surface || !d->surface->surfaceHandle())
never evaluated: !d->surface
never evaluated: !d->surface->surfaceHandle()
0
233 return 0;
never executed: return 0;
0
234 -
235 return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
never executed: return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
0
236} -
237bool QOpenGLContext::makeCurrent(QSurface *surface) -
238{ -
239 QOpenGLContextPrivate * const d = d_func(); -
240 if (!isValid())
never evaluated: !isValid()
0
241 return false;
never executed: return false;
0
242 -
243 if (thread() != QThread::currentThread())
never evaluated: thread() != QThread::currentThread()
0
244 QMessageLogger("kernel/qopenglcontext.cpp", 504, __PRETTY_FUNCTION__).fatal("Cannot make QOpenGLContext current in a different thread");
never executed: QMessageLogger("kernel/qopenglcontext.cpp", 504, __PRETTY_FUNCTION__).fatal("Cannot make QOpenGLContext current in a different thread");
0
245 -
246 if (!surface) {
never evaluated: !surface
0
247 doneCurrent(); -
248 return true;
never executed: return true;
0
249 } -
250 -
251 if (!surface->surfaceHandle())
never evaluated: !surface->surfaceHandle()
0
252 return false;
never executed: return false;
0
253 -
254 if (surface->surfaceType() != QSurface::OpenGLSurface) {
never evaluated: surface->surfaceType() != QSurface::OpenGLSurface
0
255 QMessageLogger("kernel/qopenglcontext.cpp", 515, __PRETTY_FUNCTION__).warning() << "QOpenGLContext::makeCurrent() called with non-opengl surface"; -
256 return false;
never executed: return false;
0
257 } -
258 -
259 QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this); -
260 -
261 if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
never evaluated: d->platformGLContext->makeCurrent(surface->surfaceHandle())
0
262 d->surface = surface; -
263 -
264 d->shareGroup->d_func()->deletePendingResources(this); -
265 -
266 -
267 -
268 -
269 -
270 return true;
never executed: return true;
0
271 } -
272 -
273 QOpenGLContextPrivate::setCurrentContext(previous); -
274 -
275 return false;
never executed: return false;
0
276} -
277void QOpenGLContext::doneCurrent() -
278{ -
279 QOpenGLContextPrivate * const d = d_func(); -
280 if (!isValid())
never evaluated: !isValid()
0
281 return;
never executed: return;
0
282 -
283 if (QOpenGLContext::currentContext() == this)
never evaluated: QOpenGLContext::currentContext() == this
0
284 d->shareGroup->d_func()->deletePendingResources(this);
never executed: d->shareGroup->d_func()->deletePendingResources(this);
0
285 -
286 d->platformGLContext->doneCurrent(); -
287 QOpenGLContextPrivate::setCurrentContext(0); -
288 -
289 d->surface = 0; -
290}
never executed: }
0
291 -
292 -
293 -
294 -
295 -
296 -
297QSurface *QOpenGLContext::surface() const -
298{ -
299 const QOpenGLContextPrivate * const d = d_func(); -
300 return d->surface;
never executed: return d->surface;
0
301} -
302void QOpenGLContext::swapBuffers(QSurface *surface) -
303{ -
304 QOpenGLContextPrivate * const d = d_func(); -
305 if (!isValid())
never evaluated: !isValid()
0
306 return;
never executed: return;
0
307 -
308 if (!surface) {
never evaluated: !surface
0
309 QMessageLogger("kernel/qopenglcontext.cpp", 585, __PRETTY_FUNCTION__).warning() << "QOpenGLContext::swapBuffers() called with null argument"; -
310 return;
never executed: return;
0
311 } -
312 -
313 if (surface->surfaceType() != QSurface::OpenGLSurface) {
never evaluated: surface->surfaceType() != QSurface::OpenGLSurface
0
314 QMessageLogger("kernel/qopenglcontext.cpp", 590, __PRETTY_FUNCTION__).warning() << "QOpenGLContext::swapBuffers() called with non-opengl surface"; -
315 return;
never executed: return;
0
316 } -
317 -
318 if (surface->surfaceClass() == QSurface::Window
never evaluated: surface->surfaceClass() == QSurface::Window
0
319 && !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose)
never evaluated: !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose
0
320 { -
321 QMessageLogger("kernel/qopenglcontext.cpp", 597, __PRETTY_FUNCTION__).warning() << "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined"; -
322 }
never executed: }
0
323 -
324 QPlatformSurface *surfaceHandle = surface->surfaceHandle(); -
325 if (!surfaceHandle)
never evaluated: !surfaceHandle
0
326 return;
never executed: return;
0
327 -
328 -
329 -
330 -
331 -
332 if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
never evaluated: surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer
0
333 glFlush();
never executed: glFlush();
0
334 d->platformGLContext->swapBuffers(surfaceHandle); -
335}
never executed: }
0
336 -
337 -
338 -
339 -
340 -
341 -
342QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) const -
343{ -
344 const QOpenGLContextPrivate * const d = d_func(); -
345 if (!d->platformGLContext)
never evaluated: !d->platformGLContext
0
346 return 0;
never executed: return 0;
0
347 return d->platformGLContext->getProcAddress(procName);
never executed: return d->platformGLContext->getProcAddress(procName);
0
348} -
349 -
350 -
351 -
352 -
353 -
354 -
355QSurfaceFormat QOpenGLContext::format() const -
356{ -
357 const QOpenGLContextPrivate * const d = d_func(); -
358 if (!d->platformGLContext)
never evaluated: !d->platformGLContext
0
359 return d->requestedFormat;
never executed: return d->requestedFormat;
0
360 return d->platformGLContext->format();
never executed: return d->platformGLContext->format();
0
361} -
362 -
363 -
364 -
365 -
366QOpenGLContextGroup *QOpenGLContext::shareGroup() const -
367{ -
368 const QOpenGLContextPrivate * const d = d_func(); -
369 return d->shareGroup;
never executed: return d->shareGroup;
0
370} -
371 -
372 -
373 -
374 -
375 -
376 -
377 -
378QOpenGLContext *QOpenGLContext::shareContext() const -
379{ -
380 const QOpenGLContextPrivate * const d = d_func(); -
381 return d->shareContext;
never executed: return d->shareContext;
0
382} -
383 -
384 -
385 -
386 -
387QScreen *QOpenGLContext::screen() const -
388{ -
389 const QOpenGLContextPrivate * const d = d_func(); -
390 return d->screen;
never executed: return d->screen;
0
391} -
392 -
393 -
394 -
395 -
396 -
397 -
398 -
399void *QOpenGLContext::qGLContextHandle() const -
400{ -
401 const QOpenGLContextPrivate * const d = d_func(); -
402 return d->qGLContextHandle;
never executed: return d->qGLContextHandle;
0
403} -
404 -
405 -
406 -
407 -
408void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)) -
409{ -
410 QOpenGLContextPrivate * const d = d_func(); -
411 d->qGLContextHandle = handle; -
412 d->qGLContextDeleteFunction = qGLContextDeleteFunction; -
413}
never executed: }
0
414 -
415 -
416 -
417 -
418void QOpenGLContext::deleteQGLContext() -
419{ -
420 QOpenGLContextPrivate * const d = d_func(); -
421 if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
never evaluated: d->qGLContextDeleteFunction
never evaluated: d->qGLContextHandle
0
422 d->qGLContextDeleteFunction(d->qGLContextHandle); -
423 d->qGLContextDeleteFunction = 0; -
424 d->qGLContextHandle = 0; -
425 }
never executed: }
0
426}
never executed: }
0
427QOpenGLContextGroup::QOpenGLContextGroup() -
428 : QObject(*new QOpenGLContextGroupPrivate()) -
429{ -
430}
never executed: }
0
431 -
432 -
433 -
434 -
435QOpenGLContextGroup::~QOpenGLContextGroup() -
436{ -
437 QOpenGLContextGroupPrivate * const d = d_func(); -
438 d->cleanup(); -
439}
never executed: }
0
440 -
441 -
442 -
443 -
444QList<QOpenGLContext *> QOpenGLContextGroup::shares() const -
445{ -
446 const QOpenGLContextGroupPrivate * const d = d_func(); -
447 return d->m_shares;
never executed: return d->m_shares;
0
448} -
449 -
450 -
451 -
452 -
453 -
454 -
455QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup() -
456{ -
457 QOpenGLContext *current = QOpenGLContext::currentContext(); -
458 return current ? current->shareGroup() : 0;
never executed: return current ? current->shareGroup() : 0;
0
459} -
460 -
461void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx) -
462{ -
463 QMutexLocker locker(&m_mutex); -
464 m_refs.ref(); -
465 m_shares << ctx; -
466}
never executed: }
0
467 -
468void QOpenGLContextGroupPrivate::removeContext(QOpenGLContext *ctx) -
469{ -
470 QOpenGLContextGroup * const q = q_func(); -
471 -
472 bool deleteObject = false; -
473 -
474 { -
475 QMutexLocker locker(&m_mutex); -
476 m_shares.removeOne(ctx); -
477 -
478 if (ctx == m_context && !m_shares.isEmpty())
never evaluated: ctx == m_context
never evaluated: !m_shares.isEmpty()
0
479 m_context = m_shares.first();
never executed: m_context = m_shares.first();
0
480 -
481 if (!m_refs.deref()) {
never evaluated: !m_refs.deref()
0
482 cleanup(); -
483 deleteObject = true; -
484 }
never executed: }
0
485 } -
486 -
487 if (deleteObject) {
never evaluated: deleteObject
0
488 if (q->thread() == QThread::currentThread())
never evaluated: q->thread() == QThread::currentThread()
0
489 delete q;
never executed: delete q;
0
490 else -
491 q->deleteLater();
never executed: q->deleteLater();
0
492 } -
493}
never executed: }
0
494 -
495void QOpenGLContextGroupPrivate::cleanup() -
496{ -
497 QOpenGLContextGroup * const q = q_func(); -
498 { -
499 QHash<QOpenGLMultiGroupSharedResource *, QOpenGLSharedResource *>::const_iterator it, end; -
500 end = m_resources.constEnd(); -
501 for (it = m_resources.constBegin(); it != end; ++it)
never evaluated: it != end
0
502 it.key()->cleanup(q, it.value());
never executed: it.key()->cleanup(q, it.value());
0
503 m_resources.clear(); -
504 } -
505 -
506 QList<QOpenGLSharedResource *>::iterator it = m_sharedResources.begin(); -
507 QList<QOpenGLSharedResource *>::iterator end = m_sharedResources.end(); -
508 -
509 while (it != end) {
never evaluated: it != end
0
510 (*it)->invalidateResource(); -
511 (*it)->m_group = 0; -
512 ++it; -
513 }
never executed: }
0
514 -
515 m_sharedResources.clear(); -
516 -
517 qDeleteAll(m_pendingDeletion.begin(), m_pendingDeletion.end()); -
518 m_pendingDeletion.clear(); -
519}
never executed: }
0
520 -
521void QOpenGLContextGroupPrivate::deletePendingResources(QOpenGLContext *ctx) -
522{ -
523 QMutexLocker locker(&m_mutex); -
524 -
525 QList<QOpenGLSharedResource *> pending = m_pendingDeletion; -
526 m_pendingDeletion.clear(); -
527 -
528 QList<QOpenGLSharedResource *>::iterator it = pending.begin(); -
529 QList<QOpenGLSharedResource *>::iterator end = pending.end(); -
530 while (it != end) {
never evaluated: it != end
0
531 (*it)->freeResource(ctx); -
532 delete *it; -
533 ++it; -
534 }
never executed: }
0
535}
never executed: }
0
536QOpenGLSharedResource::QOpenGLSharedResource(QOpenGLContextGroup *group) -
537 : m_group(group) -
538{ -
539 QMutexLocker locker(&m_group->d_func()->m_mutex); -
540 m_group->d_func()->m_sharedResources << this; -
541}
never executed: }
0
542 -
543QOpenGLSharedResource::~QOpenGLSharedResource() -
544{ -
545} -
546 -
547 -
548void QOpenGLSharedResource::free() -
549{ -
550 if (!m_group) {
never evaluated: !m_group
0
551 delete this; -
552 return;
never executed: return;
0
553 } -
554 -
555 QMutexLocker locker(&m_group->d_func()->m_mutex); -
556 m_group->d_func()->m_sharedResources.removeOne(this); -
557 m_group->d_func()->m_pendingDeletion << this; -
558 -
559 -
560 QOpenGLContext *current = QOpenGLContext::currentContext(); -
561 if (current && current->shareGroup() == m_group) {
never evaluated: current
never evaluated: current->shareGroup() == m_group
0
562 m_group->d_func()->deletePendingResources(current); -
563 }
never executed: }
0
564}
never executed: }
0
565void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context) -
566{ -
567 if (m_id) {
never evaluated: m_id
0
568 QOpenGLFunctions functions(context); -
569 m_func(&functions, m_id); -
570 m_id = 0; -
571 }
never executed: }
0
572}
never executed: }
0
573QOpenGLMultiGroupSharedResource::QOpenGLMultiGroupSharedResource() -
574 : active(0) -
575{ -
576 -
577 -
578 -
579}
never executed: }
0
580 -
581QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource() -
582{ -
583 -
584 -
585 -
586 for (int i = 0; i < m_groups.size(); ++i) {
never evaluated: i < m_groups.size()
0
587 if (!m_groups.at(i)->shares().isEmpty()) {
never evaluated: !m_groups.at(i)->shares().isEmpty()
0
588 QOpenGLContext *context = m_groups.at(i)->shares().first(); -
589 QOpenGLSharedResource *resource = value(context); -
590 if (resource)
never evaluated: resource
0
591 resource->free();
never executed: resource->free();
0
592 }
never executed: }
0
593 m_groups.at(i)->d_func()->m_resources.remove(this); -
594 active.deref(); -
595 }
never executed: }
0
596 -
597 -
598 -
599 -
600 -
601 -
602 -
603}
never executed: }
0
604 -
605void QOpenGLMultiGroupSharedResource::insert(QOpenGLContext *context, QOpenGLSharedResource *value) -
606{ -
607 -
608 -
609 -
610 QOpenGLContextGroup *group = context->shareGroup(); -
611 qt_noop(); -
612 group->d_func()->m_resources.insert(this, value); -
613 m_groups.append(group); -
614 active.ref(); -
615}
never executed: }
0
616 -
617QOpenGLSharedResource *QOpenGLMultiGroupSharedResource::value(QOpenGLContext *context) -
618{ -
619 QOpenGLContextGroup *group = context->shareGroup(); -
620 return group->d_func()->m_resources.value(this, 0);
never executed: return group->d_func()->m_resources.value(this, 0);
0
621} -
622 -
623QList<QOpenGLSharedResource *> QOpenGLMultiGroupSharedResource::resources() const -
624{ -
625 QList<QOpenGLSharedResource *> result; -
626 for (QList<QOpenGLContextGroup *>::const_iterator it = m_groups.constBegin(); it != m_groups.constEnd(); ++it) {
never evaluated: it != m_groups.constEnd()
0
627 QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast<QOpenGLMultiGroupSharedResource *>(this), 0); -
628 if (resource)
never evaluated: resource
0
629 result << resource;
never executed: result << resource;
0
630 }
never executed: }
0
631 return result;
never executed: return result;
0
632} -
633 -
634void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenGLSharedResource *value) -
635{ -
636 -
637 -
638 -
639 value->invalidateResource(); -
640 value->free(); -
641 active.deref(); -
642 -
643 qt_noop(); -
644 m_groups.removeOne(group); -
645}
never executed: }
0
646 -
647 -
648 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial