QML and Android emulator OpenGL error

Lately, after an Android emulator image update, a strange error regarding OpenGL is coming up using official Android emulator. This error refer to some OpenGL failed operation and, as consequence, doesn't allow the app to run correctly. QML make a large use of OpenGL that's mean each app developed using this technology doesn't work anymore (on the emulator).


The error is usually like the following:

(null):0 ((null)): QOpenGLShader::compile(Fragment): ERROR: 0:1: '' : No precision specified for (float)

(null):0 ((null)): *** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
varying lowp vec4 color;

void main()
{
    gl_FragColor = color;
}
***
(null):0 ((null)): shader compilation failed:
""
(null):0 ((null)): QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
(null):0 ((null)): QOpenGLShaderProgram::uniformLocation(opacity): shader program is not linked
(null):0 ((null)): QOpenGLShader::compile(Fragment): ERROR: 0:1: '' : No precision specified for (float)

(null):0 ((null)): *** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
varying highp vec2 qt_TexCoord;

uniform sampler2D qt_Texture;

void main()
{
    gl_FragColor = texture2D(qt_Texture, qt_TexCoord);
}
***
(null):0 ((null)): shader compilation failed:
""
(null):0 ((null)): QOpenGLShaderProgram::uniformLocation(qt_Matrix): shader program is not linked

This "incompatibility" has already been reported to Qt team in the bug tacking system however, to temporary fix the problem, the only way I found to get emulator working again is to maually execute the emulator image using the following param in red:

emulator.exe -avd [your emulator image name] -gpu swiftshader

Based to the official documentation here this option "Use SwiftShader to render graphics in software". In my understanding this option should have the same effect of disable the emulator "Use Host GPU" flags but this solution doesn't seem to work, maybe for a bug of emulator or image? I don't know. However I fixed my problem using this way, if it will not work for you I don't know how to help, I'm sorry...

Comments

Popular posts from this blog

Access GPIO from Linux user space

Launch an app from Android shell terminal

Qt 5 and " Failed to load platform plugin 'windows' " error