diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-10-28 16:05:10 +0100 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-11-04 19:17:47 +0100 |
| commit | 48c176e1b891428af504087b117a72bcaa806930 (patch) | |
| tree | 005d6eb8ddb6cc0651e31ca5b903178912815eca /tests/auto/sql/kernel/qsqldatabase/tst_databases.h | |
| parent | 332f49f2d8c5675bab8bde6acfb377d567961d4a (diff) | |
macOS: Update NSOpenGLContext drawable on beginning of frame if needed
If the size or DPR of the window we're drawing to with QOpenGLContext
changes we need to call [NSOpenGLContext update] to recreate the backing
texture.
We were doing this in QCocoaGLContext::makeCurrent(), based on the
assumption that clients would always call makeCurrent() before drawing,
which is a documented requirement of QOpenGLContext:
"To be able to support certain platforms, QOpenGLContext requires
that you call makeCurrent() again before starting rendering a new
frame, after calling swapBuffers()."
However RHI doesn't follow this rule, and skips makeCurrent() from
QRhiGles2::ensureContext() if the context is already current.
This was causing issues when moving a window between screens with
different device-pixel-ratios, as we were correctly rendering to
the window with the updated DPR, but we had not resized the target
texture to match.
Changing QRhiGles2::ensureContext() might be an option, but nowadays
we have QPlatformOpenGLContext::beginFrame(), which is guaranteed
to be called (by RHI, not by generic QOpenGLContext clients).
To cater for RHI we now call [NSOpenGLContext update] also from
the beginFrame callback.
Fixes: QTBUG-114873
Pick-to: 6.8 6.5
Change-Id: I9461135109fb1473ef9965f72f52beeb41b03680
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/auto/sql/kernel/qsqldatabase/tst_databases.h')
0 files changed, 0 insertions, 0 deletions
