Use global share context in QRhiGles2

Needed for using native textures in WebEngine.

Task-number: QTBUG-78682
Change-Id: I8458b17767bb992357064d85f159781ea24e61dc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Jüri Valdmann 2020-06-22 13:18:03 +02:00
parent f5c132ef28
commit d9a260eabe

View File

@ -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;