QPlatformOpenGLContext *EglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { QPlatformOpenGLContext *pctx = egl_device_integration()->createPlatformOpenGLContext(context); if (pctx) return pctx; // If there is a "root" window into which raster and QOpenGLWidget content is // composited, all other contexts must share with its context. QOpenGLContext *compositingContext = OpenGLCompositor::instance()->context(); EGLDisplay dpy = context->screen() ? static_cast<EglFSScreen *>(context->screen()->handle())->display() : display(); QPlatformOpenGLContext *share = compositingContext ? compositingContext->handle() : context->shareHandle(); QVariant nativeHandle = context->nativeHandle(); EglFSContext *ctx; QSurfaceFormat adjustedFormat = egl_device_integration()->surfaceFormatFor(context->format()); if (nativeHandle.isNull()) { EGLConfig config = EglFSIntegration::chooseConfig(dpy, adjustedFormat); ctx = new EglFSContext(adjustedFormat, share, dpy, &config, QVariant()); } else { ctx = new EglFSContext(adjustedFormat, share, dpy, 0, nativeHandle); } nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), dpy)); context->setNativeHandle(nativeHandle); return ctx; }
QEGLPlatformContext *QEglFSIntegration::createContext(const QSurfaceFormat &format, QPlatformOpenGLContext *shareContext, EGLDisplay display, QVariant *nativeHandle) const { QEglFSContext *ctx; QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(format); if (!nativeHandle || nativeHandle->isNull()) { EGLConfig config = QEglFSIntegration::chooseConfig(display, adjustedFormat); ctx = new QEglFSContext(adjustedFormat, shareContext, display, &config, QVariant()); } else { ctx = new QEglFSContext(adjustedFormat, shareContext, display, 0, *nativeHandle); } *nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), display)); return ctx; }
QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display(); QPlatformOpenGLContext *share = context->shareHandle(); QVariant nativeHandle = context->nativeHandle(); QEglFSContext *ctx; QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(context->format()); if (nativeHandle.isNull()) { EGLConfig config = QEglFSIntegration::chooseConfig(dpy, adjustedFormat); ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant()); } else { ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle); } nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), dpy)); context->setNativeHandle(nativeHandle); return ctx; }