summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2022-04-04 11:41:06 +0800
committerJiDe Zhang <zhangjide@uniontech.com>2022-04-12 01:23:53 +0800
commit251e9f0bed6dd0206cc430365b6c6653f78969e1 (patch)
treec9dafe59c11ee3856598c9a982e5d628f5d4ae99 /src
parented5f33a3f19005eacc18d5dcd6379721d5f67f6b (diff)
Use the QSurface for QRhiGles2InitParams::fallbackSurface
There is no need to limit the type to QOffscreenSurface here, QRhi does not depend on the behavior in QOffscreenSurface. Users can use the custom offscreen QSurface types if needed. Task-number: QTBUG-102257 Change-Id: I47a064496f8c5f1986a0e11ec748ea32a03b903e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/rhi/qrhigles2.cpp15
-rw-r--r--src/gui/rhi/qrhigles2_p.h3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index cbafa95f5d..6dae48e6a1 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -68,9 +68,10 @@ QT_BEGIN_NAMESPACE
\inmodule QtGui
\brief OpenGL specific initialization parameters.
- An OpenGL-based QRhi needs an already created QOffscreenSurface at minimum.
- Additionally, while optional, it is recommended that the QWindow the first
- QRhiSwapChain will target is passed in as well.
+ An OpenGL-based QRhi needs an already created QSurface that can be used in
+ combination with QOpenGLContext. Most commonly, this is a QOffscreenSurface
+ in practice. Additionally, while optional, it is recommended that the QWindow
+ the first QRhiSwapChain will target is passed in as well.
\badcode
QOffscreenSurface *fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
@@ -98,10 +99,10 @@ QT_BEGIN_NAMESPACE
adjustedFormat() to query the effective format that is passed to
QOpenGLContext::setFormat() internally.
- A QOffscreenSurface has to be specified in \l fallbackSurface. In order to
- prevent mistakes in threaded situations, this is never created
- automatically by the QRhi since, like QWindow, QOffscreenSurface can only
- be created on the gui/main thread.
+ A QSurface has to be specified in \l fallbackSurface. In order to prevent
+ mistakes in threaded situations, this is never created automatically by the
+ QRhi because, like QWindow, instances of QSurface subclasses can often be
+ created on the gui/main thread only.
As a convenience, applications can use newFallbackSurface() which creates
and returns a QOffscreenSurface that is compatible with the QOpenGLContext
diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h
index b948b42be5..71ddabf2e9 100644
--- a/src/gui/rhi/qrhigles2_p.h
+++ b/src/gui/rhi/qrhigles2_p.h
@@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOffscreenSurface;
+class QSurface;
class QWindow;
struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
@@ -65,7 +66,7 @@ struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
QRhiGles2InitParams();
QSurfaceFormat format;
- QOffscreenSurface *fallbackSurface = nullptr;
+ QSurface *fallbackSurface = nullptr;
QWindow *window = nullptr;
QOpenGLContext *shareContext = nullptr;