diff options
author | Thomas Senyk <thomas.senyk@qt.io> | 2022-12-14 08:20:36 +0100 |
---|---|---|
committer | Thomas Senyk <thomas.senyk@qt.io> | 2023-01-12 19:03:15 +0100 |
commit | 17a59f661398bf56aeaba4187f55d07eea09c578 (patch) | |
tree | 8d651db27a7be2f8058cab95f9f7498b4346abbd /src/gui/opengl/platform/egl/qeglplatformcontext_p.h | |
parent | 8745a73c4fa42e6fc304bc5b53075ac071a918ed (diff) |
Add QEGLContext::invalidateContext
QEGLContext::invalidateContext will mark that egl context is invalide
and trigger SceneGraph to destroy it, create a new one and re-create
and re-upload all resources (e.g. textures) associated with the current
state of the SceneGraph
In addition this change also improves
QEglFSWindow::invalidateSurface() and
QEglFSContext::eglSurfaceForPlatformSurface(..)
Where QEglFSWindow::invalidateSurface() will now destroy the
corresponding EGLSurface via eglDestroySurface, including "unbinding"
it from the current thread via eglMakeCurrent and
un-setting the screen's EGLSurface in case it's the same resource.
QEglFSContext::eglSurfaceForPlatformSurface(..) will now call
QEglFSWindow::resetSurface() in case of getting a EGL_NO_SURFACE
from the QEglFSWindow (which happens if above invalidateSurface()
was called before) - therefor re-creating the resource if
it was destoyed via QEglFSWindow::invalidateSurface()
Pick-to: 6.5
Change-Id: I37badd1fc11e993c395fb1502e9bd27ebe18b821
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/opengl/platform/egl/qeglplatformcontext_p.h')
-rw-r--r-- | src/gui/opengl/platform/egl/qeglplatformcontext_p.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/opengl/platform/egl/qeglplatformcontext_p.h b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h index 556fbabee4..b1e9c4b4c2 100644 --- a/src/gui/opengl/platform/egl/qeglplatformcontext_p.h +++ b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h @@ -69,12 +69,14 @@ public: QSurfaceFormat format() const override; bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; } - bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT; } + bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT && !m_markedInvalid; } EGLContext nativeContext() const override { return eglContext(); } EGLConfig config() const override { return eglConfig(); } EGLDisplay display() const override { return eglDisplay(); } + virtual void invalidateContext() override { m_markedInvalid = true; } + EGLContext eglContext() const; EGLDisplay eglDisplay() const; EGLConfig eglConfig() const; @@ -102,6 +104,8 @@ private: Flags m_flags; bool m_ownsContext = false; QList<EGLint> m_contextAttrs; + + bool m_markedInvalid = false; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QEGLPlatformContext::Flags) |