diff options
Diffstat (limited to 'customcontext/context.cpp')
-rw-r--r-- | customcontext/context.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/customcontext/context.cpp b/customcontext/context.cpp index aeffd41..0b8a756 100644 --- a/customcontext/context.cpp +++ b/customcontext/context.cpp @@ -159,6 +159,9 @@ Context::Context(QObject *parent) : QSGContext(parent) , m_sampleCount(0) , m_useMultisampling(false) +#ifdef CUSTOMCONTEXT_USE_HYBRISTEXTURE + , m_hybrisTexture(false) +#endif { m_useMultisampling = !qgetenv("CUSTOMCONTEXT_MULTISAMPLE").isEmpty(); if (m_useMultisampling) { @@ -192,14 +195,6 @@ Context::Context(QObject *parent) m_eglGrallocTexture = qEnvironmentVariableIsEmpty("CUSTOMCONTEXT_NO_EGLGRALLOCTEXTURE"); #endif -#ifdef CUSTOMCONTEXT_HYBRISTEXTURE - m_hybrisTexture = qEnvironmentVariableIsEmpty("CUSTOMCONTEXT_NO_HYBRISTEXTURE"); - if (m_hybrisTexture && strstr(eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer") == 0) { - qDebug() << "EGL_HYBRIS_native_buffer is not available..."; - m_hybrisTexture = false; - } -#endif - #ifdef CUSTOMCONTEXT_THREADUPLOADTEXTURE m_threadUploadTexture = qgetenv("CUSTOMCONTEXT_NO_THREADUPLOADTEXTURE").isEmpty(); connect(this, SIGNAL(invalidated()), &m_threadUploadManager, SLOT(invalidated()), Qt::DirectConnection); @@ -254,9 +249,6 @@ Context::Context(QObject *parent) #ifdef CUSTOMCONTEXT_EGLGRALLOCTEXTURE qDebug(" - EGLImage/Gralloc based texture: %s", m_eglGrallocTexture ? "yes" : "no"); #endif -#ifdef CUSTOMCONTEXT_HYBRISTEXTURE - qDebug(" - EGL/Hybris based texture: %s", m_hybrisTexture ? "yes" : "no"); -#endif #ifdef CUSTOMCONTEXT_MACTEXTURE qDebug(" - mac textures: %s", m_macTexture ? "yes" : "no"); #endif @@ -289,6 +281,25 @@ Context::Context(QObject *parent) } +#ifdef CUSTOMCONTEXT_HYBRISTEXTURE +void Context::renderContextInitialized(QSGRenderContext *ctx) +{ + // This check is delayed until there is an EGL display present. + m_hybrisTexture = qEnvironmentVariableIsEmpty("CUSTOMCONTEXT_NO_HYBRISTEXTURE"); + if (m_hybrisTexture && strstr(eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer") == 0) { + qDebug() << "EGL_HYBRIS_native_buffer is not available..."; + m_hybrisTexture = false; + } +#if defined(CUSTOMCONTEXT_DEBUG) + qDebug(" - EGL/Hybris based texture: %s", m_hybrisTexture ? "yes" : "no"); +#endif + + QSGContext::renderContextInitialized(ctx); +} +#endif + + + void CONTEXT_CLASS::initialize(QOpenGLContext *context) |