As the shaders change during our development process, we frequently crash and fail in glLinkProgram.
If we isolate the vertex shader and fragment shader and compile it and link it separately, it works fine. Here's the strange part, if we reverse the order of loading the programs, then all compile and link successfully. But this only works on some devices, but not on others.
Here are the devices we have tested that have the issue:
HTC Verizon HTC Droid Incredible 2 (Model Number ADR6350), using Adreno 205
HTC Sensation 4G, using Adreno 220
We have not been able to isolate the failure conditions or find robust workarounds.
Any suggestions? Is there any way to get stack traces or symbols for the driver crashes to send to you?
Jed
P.S. Also, we are not getting any output from the linker logs. Is there a way to turn on verbose logging during linking?
// compile vertex shader
// compile fragment shader
// get uniforms
glLinkProgram(prog); // << crashes in driver
// >> Or fails, but with no log...
glGetProgramiv(prog, GL_LINK_STATUS, &status);
// If we get here, then logLength is always zero
GLint logLength;
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength);
// Even when ignoring logLength=0 returned from above, log is empty
const GLsizei logLength2 = 4000;
char szLogBuffer[logLength2];
logLength = logLength2;
glGetProgramInfoLog(prog, logLength, &logLength, szLogBuffer);
The android drivers seem to be different versions: Here is the output from 'adb shell ls -l /system/lib/egl'
ADR6350
-rw-r--r-- root root 26 2011-04-28 13:41 egl.cfg
-rw-r--r-- root root 84048 2011-07-06 04:55 libEGL_adreno200.so
-rw-r--r-- root root 93672 2011-07-06 04:55 libGLES_android.so
-rw-r--r-- root root 175264 2011-07-06 04:55 libGLESv1_CM_adreno200.so
-rw-r--r-- root root 1858544 2011-07-06 04:55 libGLESv2_adreno200.so
-rw-r--r-- root root 210864 2011-07-06 04:55 libq3dtools_adreno200.so
D/PAGE44 ( 3699): OGL vendor=Qualcomm
D/PAGE44 ( 3699): OGL renderer=Adreno 205
D/PAGE44 ( 3699): OGL version=OpenGL ES 2.0 1403843
HTC Incredible 4G
-rw-r--r-- root root 26 2011-04-22 12:31 egl.cfg
-rw-r--r-- root root 84096 2011-08-23 09:39 libEGL_adreno200.so
-rw-r--r-- root root 97816 2011-05-22 22:02 libGLES_android.so
-rw-r--r-- root root 162992 2011-08-23 09:39 libGLESv1_CM_adreno200.so
-rw-r--r-- root root 1793184 2011-08-23 09:39 libGLESv2_adreno200.so
-rw-r--r-- root root 206768 2011-08-23 09:39 libq3dtools_adreno200.so
D/PAGE44 (10370): OGL vendor=Qualcomm
D/PAGE44 (10370): OGL renderer=Adreno (TM) 220
D/PAGE44 (10370): OGL version=OpenGL ES 2.0 1566933
Changing the precision modifiers in the fragment shader from lowp to mediump fixed the problem.
A similar (if not the same) crash for a different reason:
https://developer.qualcomm.com/forum/qdevnet-forums/mobile-technologies/...