Runtime depend on GLES in all egl backends
As we don't have GLPLatform before the backend is fully created the AbstractEglBackend has a new method isOpenGLES() -> bool which determines based on QOpenGLContext::openGLModuleType().
This commit is contained in:
parent
2f065b9c6b
commit
14d943caea
6 changed files with 110 additions and 124 deletions
|
@ -88,14 +88,10 @@ bool AbstractEglBackend::initEglAPI()
|
|||
}
|
||||
qCDebug(KWIN_CORE) << "Egl Initialize succeeded";
|
||||
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#else
|
||||
if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) {
|
||||
if (eglBindAPI(isOpenGLES() ? EGL_OPENGL_ES_API : EGL_OPENGL_API) == EGL_FALSE) {
|
||||
qCCritical(KWIN_CORE) << "bind OpenGL API failed";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
qCDebug(KWIN_CORE) << "EGL version: " << major << "." << minor;
|
||||
return true;
|
||||
}
|
||||
|
@ -178,6 +174,11 @@ void AbstractEglBackend::doneCurrent()
|
|||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
|
||||
bool AbstractEglBackend::isOpenGLES() const
|
||||
{
|
||||
return QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES;
|
||||
}
|
||||
|
||||
AbstractEglTexture::AbstractEglTexture(SceneOpenGL::Texture *texture, AbstractEglBackend *backend)
|
||||
: SceneOpenGL::TexturePrivate()
|
||||
, q(texture)
|
||||
|
|
|
@ -68,6 +68,7 @@ protected:
|
|||
void initClientExtensions();
|
||||
void initWayland();
|
||||
bool hasClientExtension(const QByteArray &ext) const;
|
||||
bool isOpenGLES() const;
|
||||
|
||||
private:
|
||||
EGLDisplay m_display = EGL_NO_DISPLAY;
|
||||
|
|
|
@ -132,14 +132,14 @@ bool EglGbmBackend::initRenderingContext()
|
|||
initBufferConfigs();
|
||||
|
||||
EGLContext context = EGL_NO_CONTEXT;
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
if (isOpenGLES()) {
|
||||
const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs);
|
||||
#else
|
||||
} else {
|
||||
const EGLint context_attribs_31_core[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
|
||||
|
@ -160,7 +160,7 @@ bool EglGbmBackend::initRenderingContext()
|
|||
|
||||
if (context == EGL_NO_CONTEXT)
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs_legacy);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (context == EGL_NO_CONTEXT) {
|
||||
qCCritical(KWIN_DRM) << "Create Context failed";
|
||||
|
@ -233,11 +233,7 @@ bool EglGbmBackend::initBufferConfigs()
|
|||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_ALPHA_SIZE, 0,
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#else
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
#endif
|
||||
EGL_RENDERABLE_TYPE, isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
|
||||
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
|
|
@ -113,14 +113,14 @@ bool EglGbmBackend::initRenderingContext()
|
|||
}
|
||||
|
||||
EGLContext context = EGL_NO_CONTEXT;
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
if (isOpenGLES()) {
|
||||
const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs);
|
||||
#else
|
||||
} else {
|
||||
const EGLint context_attribs_31_core[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
|
||||
|
@ -138,7 +138,7 @@ bool EglGbmBackend::initRenderingContext()
|
|||
|
||||
if (context == EGL_NO_CONTEXT)
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs_legacy);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (context == EGL_NO_CONTEXT) {
|
||||
// qCCritical(KWIN_DRM) << "Create Context failed";
|
||||
|
@ -158,11 +158,7 @@ bool EglGbmBackend::initBufferConfigs()
|
|||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_ALPHA_SIZE, 0,
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#else
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
#endif
|
||||
EGL_RENDERABLE_TYPE, isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
|
||||
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
|
|
@ -114,14 +114,14 @@ bool EglWaylandBackend::initRenderingContext()
|
|||
initBufferConfigs();
|
||||
|
||||
EGLContext context = EGL_NO_CONTEXT;
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
if (isOpenGLES()) {
|
||||
const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs);
|
||||
#else
|
||||
} else {
|
||||
const EGLint context_attribs_31_core[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
|
||||
|
@ -142,7 +142,7 @@ bool EglWaylandBackend::initRenderingContext()
|
|||
|
||||
if (context == EGL_NO_CONTEXT)
|
||||
context = eglCreateContext(eglDisplay(), config(), EGL_NO_CONTEXT, context_attribs_legacy);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (context == EGL_NO_CONTEXT) {
|
||||
qCCritical(KWIN_WAYLAND_BACKEND) << "Create Context failed";
|
||||
|
@ -201,11 +201,7 @@ bool EglWaylandBackend::initBufferConfigs()
|
|||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_ALPHA_SIZE, 0,
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#else
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
#endif
|
||||
EGL_RENDERABLE_TYPE, isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
|
||||
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
|
|
@ -227,14 +227,14 @@ bool EglOnXBackend::initRenderingContext()
|
|||
setSurface(surface);
|
||||
|
||||
EGLContext ctx = EGL_NO_CONTEXT;
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
if (isOpenGLES()) {
|
||||
const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
ctx = eglCreateContext(dpy, config(), EGL_NO_CONTEXT, context_attribs);
|
||||
#else
|
||||
} else {
|
||||
const EGLint context_attribs_31_core[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
|
||||
|
@ -254,7 +254,7 @@ bool EglOnXBackend::initRenderingContext()
|
|||
|
||||
if (ctx == EGL_NO_CONTEXT)
|
||||
ctx = eglCreateContext(dpy, config(), EGL_NO_CONTEXT, context_attribs_legacy);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ctx == EGL_NO_CONTEXT) {
|
||||
qCCritical(KWIN_CORE) << "Create Context failed";
|
||||
|
@ -284,11 +284,7 @@ bool EglOnXBackend::initBufferConfigs()
|
|||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_ALPHA_SIZE, 0,
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#else
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
#endif
|
||||
EGL_RENDERABLE_TYPE, isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
|
||||
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue