summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qopenglcontext_p.h7
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp4
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp15
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h1
4 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 3cbcd1c06d..280e2e1e33 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -203,6 +203,7 @@ public:
, max_texture_size(-1)
, workaround_brokenFBOReadBack(false)
, workaround_brokenTexSubImage(false)
+ , workaround_missingPrecisionQualifiers(false)
, active_engine(0)
{
}
@@ -233,6 +234,7 @@ public:
bool workaround_brokenFBOReadBack;
bool workaround_brokenTexSubImage;
+ bool workaround_missingPrecisionQualifiers;
QPaintEngineEx *active_engine;
@@ -240,6 +242,11 @@ public:
int maxTextureSize();
+ static QOpenGLContextPrivate *get(QOpenGLContext *context)
+ {
+ return context->d_func();
+ }
+
#if !defined(QT_NO_DEBUG)
static bool toggleMakeCurrentTracker(QOpenGLContext *context, bool value)
{
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 8278e4fb5a..c0e250b0fa 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -429,7 +429,9 @@ bool QOpenGLShader::compileSourceCode(const char *source)
// The precision qualifiers are useful on OpenGL/ES systems,
// but usually not present on desktop systems.
const QSurfaceFormat currentSurfaceFormat = QOpenGLContext::currentContext()->format();
+ QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL
+ || ctx_d->workaround_missingPrecisionQualifiers
#ifdef QT_OPENGL_FORCE_SHADER_DEFINES
|| true
#endif
@@ -439,7 +441,7 @@ bool QOpenGLShader::compileSourceCode(const char *source)
}
#ifdef QOpenGL_REDEFINE_HIGHP
- if (d->shaderType == Fragment) {
+ if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers) {
src.append(redefineHighp);
srclen.append(GLint(sizeof(redefineHighp) - 1));
}
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
index 4d741807d0..9d6d4003f7 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
@@ -46,6 +46,8 @@
#include <QtCore/qdebug.h>
#include <qpa/qwindowsysteminterface.h>
+#include <QtGui/private/qopenglcontext_p.h>
+
QT_BEGIN_NAMESPACE
QAndroidOpenGLContext::QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration,
@@ -75,4 +77,17 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
}
}
+bool QAndroidOpenGLContext::makeCurrent(QPlatformSurface *surface)
+{
+ bool ret = QEglFSContext::makeCurrent(surface);
+
+ const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) {
+ QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
+ ctx_d->workaround_missingPrecisionQualifiers = true;
+ }
+
+ return ret;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
index c4c5a430ad..c419ae8392 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
@@ -58,6 +58,7 @@ public:
EGLenum eglApi = EGL_OPENGL_ES_API);
void swapBuffers(QPlatformSurface *surface);
+ bool makeCurrent(QPlatformSurface *surface);
private:
const QAndroidPlatformIntegration *m_platformIntegration;