From d9a260eabe4a3bd4f4e1e69f0430af2589d45a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Mon, 22 Jun 2020 13:18:03 +0200 Subject: [PATCH] Use global share context in QRhiGles2 Needed for using native textures in WebEngine. Task-number: QTBUG-78682 Change-Id: I8458b17767bb992357064d85f159781ea24e61dc Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhigles2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 139375fbec8..9a311101e15 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -413,6 +413,10 @@ bool QRhiGles2::create(QRhi::Flags flags) if (!importedContext) { ctx = new QOpenGLContext; ctx->setFormat(requestedFormat); + if (QOpenGLContext *shareContext = qt_gl_global_share_context()) { + ctx->setShareContext(shareContext); + ctx->setScreen(shareContext->screen()); + } if (!ctx->create()) { qWarning("QRhiGles2: Failed to create context"); delete ctx;