diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-29 13:21:25 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-03-01 20:41:30 +0100 |
commit | f451b01791536fede40c8d4fb90799c2e23e9386 (patch) | |
tree | 7e9e1b147060cc10024b1601d2edea5698292802 /src/openglwidgets/qopenglwidget.cpp | |
parent | b571634172428263fa83ac733cf89e664bded014 (diff) |
Add QWidgetPrivate::rhi() helper method
For accessing the RHI managed by the widget compositing machinery.
Pick-to: 6.7 6.6 6.5
Change-Id: Ia3c1227cc2d9cfebe95611cad3dbcd7aa6f6f8c7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/openglwidgets/qopenglwidget.cpp')
-rw-r--r-- | src/openglwidgets/qopenglwidget.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp index e4438d226d..a1b33fb560 100644 --- a/src/openglwidgets/qopenglwidget.cpp +++ b/src/openglwidgets/qopenglwidget.cpp @@ -784,9 +784,7 @@ void QOpenGLWidgetPrivate::ensureRhiDependentResources() { Q_Q(QOpenGLWidget); - QRhi *rhi = nullptr; - if (QWidgetRepaintManager *repaintManager = QWidgetPrivate::get(q->window())->maybeRepaintManager()) - rhi = repaintManager->rhi(); + QRhi *rhi = QWidgetPrivate::rhi(); // If there is no rhi, because we are completely offscreen, then there's no wrapperTexture either if (rhi && rhi->backend() == QRhi::OpenGLES2) { @@ -832,7 +830,6 @@ void QOpenGLWidgetPrivate::initialize() // If no global shared context get our toplevel's context with which we // will share in order to make the texture usable by the underlying window's backingstore. QWidget *tlw = q->window(); - QWidgetPrivate *tlwd = get(tlw); // Do not include the sample count. Requesting a multisampled context is not necessary // since we render into an FBO, never to an actual surface. What's more, attempting to @@ -841,9 +838,7 @@ void QOpenGLWidgetPrivate::initialize() requestedSamples = requestedFormat.samples(); requestedFormat.setSamples(0); - QRhi *rhi = nullptr; - if (QWidgetRepaintManager *repaintManager = tlwd->maybeRepaintManager()) - rhi = repaintManager->rhi(); + QRhi *rhi = QWidgetPrivate::rhi(); // Could be that something else already initialized the window with some // other graphics API for the QRhi, that's not good. @@ -1718,8 +1713,8 @@ bool QOpenGLWidget::event(QEvent *e) if (!QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts)) d->reset(); } - if (QWidgetRepaintManager *repaintManager = QWidgetPrivate::get(window())->maybeRepaintManager()) { - if (!d->initialized && !size().isEmpty() && repaintManager->rhi()) { + if (d->rhi()) { + if (!d->initialized && !size().isEmpty()) { d->initialize(); if (d->initialized) { d->recreateFbos(); |