summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-15 11:49:58 +0000
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-15 14:29:16 +0200
commit8565f97ce37faef6c29fa80c1d3e70dac38d3396 (patch)
tree21bbf091b801a041f61cc7aae5d7d92e7393063e
parentcc4d473fff90f269bc3b16ea74db31747d8a3f3c (diff)
Delay querying for EGL extension string until we are live with GL
Change-Id: I7317a5157d7692f6e3357479a5b4c0c7906c3f77 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
-rw-r--r--customcontext/context.cpp33
-rw-r--r--customcontext/context.h1
2 files changed, 23 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)
diff --git a/customcontext/context.h b/customcontext/context.h
index ab2b229..0b0e65f 100644
--- a/customcontext/context.h
+++ b/customcontext/context.h
@@ -112,6 +112,7 @@ public:
#if QT_VERSION >= 0x050200
QSGRenderContext *createRenderContext() { return new RenderContext(this); }
+ void renderContextInitialized(QSGRenderContext *renderContext) Q_DECL_OVERRIDE;
#else
void initialize(QOpenGLContext *context);
void invalidate();