I use gles part in grafika, but it cashes on Nexus 6(Android 5.0). I add the debug information as following:
* Issues the draw call. Does the full setup on every call.
*
* @param mvpMatrix The 4x4 projection matrix.
* @param vertexBuffer Buffer with vertex position data.
* @param firstVertex Index of first vertex to use in vertexBuffer.
* @param vertexCount Number of vertices in vertexBuffer.
* @param coordsPerVertex The number of coordinates per vertex (e.g. x,y is 2).
* @param vertexStride Width, in bytes, of the position data for each vertex (often
* vertexCount * sizeof(float)).
* @param texMatrix A 4x4 transformation matrix for texture coords. (Primarily intended
* for use with SurfaceTexture.)
* @param texBuffer Buffer with vertex texture data.
* @param texStride Width, in bytes, of the texture data for each vertex.
*/
public boolean draw(float[] mvpMatrix, FloatBuffer vertexBuffer, int firstVertex,
int vertexCount, int coordsPerVertex, int vertexStride,
float[] texMatrix, FloatBuffer texBuffer, int textureId, int texStride) {
if (!GlUtil.checkGlError("draw start")) {
return false;
}
Log.i(TAG, "mvpMatrix.length:" + mvpMatrix.length + ", vertexBuffer:" + vertexBuffer
+ ",firstVertex:" + firstVertex + ",vertexCount:" + vertexCount + ",coordsPerVertex:" + coordsPerVertex
+ "texMatrix:" + texMatrix + ", texMatrix.length:" + texMatrix.length + ",textureId:" + textureId + ",texStride:" + texStride);
// Select the program.
GLES20.glUseProgram(mProgramHandle);
if (!GlUtil.checkGlError("glUseProgram")) {
return false;
}
// Set the texture.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(mTextureTarget, textureId);
// Copy the model / view / projection matrix over.
GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mvpMatrix, 0);
if (!GlUtil.checkGlError("glUniformMatrix4fv")) {
return false;
}
// Copy the texture transformation matrix over.
GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, texMatrix, 0);
if (!GlUtil.checkGlError("glUniformMatrix4fv")) {
return false;
}
// Enable the "aPosition" vertex attribute.
GLES20.glEnableVertexAttribArray(maPositionLoc);
if (!GlUtil.checkGlError("glEnableVertexAttribArray")) {
return false;
}
// Connect vertexBuffer to "aPosition".
GLES20.glVertexAttribPointer(maPositionLoc, coordsPerVertex,
GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);
if (!GlUtil.checkGlError("glVertexAttribPointer")) {
return false;
}
// Enable the "aTextureCoord" vertex attribute.
GLES20.glEnableVertexAttribArray(maTextureCoordLoc);
if (!GlUtil.checkGlError("glEnableVertexAttribArray")) {
return false;
}
// Connect texBuffer to "aTextureCoord".
GLES20.glVertexAttribPointer(maTextureCoordLoc, 2,
GLES20.GL_FLOAT, false, texStride, texBuffer);
if (!GlUtil.checkGlError("glVertexAttribPointer")) {
return false;
}
// Populate the convolution kernel, if present.
if (muKernelLoc >= 0) {
GLES20.glUniform1fv(muKernelLoc, KERNEL_SIZE, mKernel, 0);
GLES20.glUniform2fv(muTexOffsetLoc, KERNEL_SIZE, mTexOffset, 0);
GLES20.glUniform1f(muColorAdjustLoc, mColorAdjust);
}
Log.i(TAG, "draw 000000000 firstVertex:" + firstVertex + ",vertexCount:" + vertexCount);
// Draw the rect.
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, firstVertex, vertexCount);
if (!GlUtil.checkGlError("glDrawArrays")) {
return false;
}
Log.i(TAG, "draw 1111111111");
// Done -- disable vertex array, texture, and program.
GLES20.glDisableVertexAttribArray(maPositionLoc);
Log.i(TAG, "draw 2222222");
GLES20.glDisableVertexAttribArray(maTextureCoordLoc);
Log.i(TAG, "draw 3333333");
GLES20.glBindTexture(mTextureTarget, 0);
GLES20.glUseProgram(0);
Log.i(TAG, "draw 4444444");
return true;
}
The logs as following:
09-22 06:54:48.216 I/GlUtil ( 3797): draw 000000000 firstVertex:0,vertexCount:4 09-22 06:54:48.216 I/GlUtil ( 3797): draw 1111111111 09-22 06:54:48.216 I/GlUtil ( 3797): draw 2222222 09-22 06:54:48.217 I/GlUtil ( 3797): draw 3333333 09-22 06:54:48.217 I/GlUtil ( 3797): draw 4444444 09-22 06:54:48.224 W/ActivityManager( 830): getTasks: caller 10093 does not hold GET_TASKS; limiting output 09-22 06:54:48.247 I/DEBUG ( 3746): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 09-22 06:54:48.247 I/DEBUG ( 3746): Build fingerprint: 'google/shamu/shamu:5.0/LRX21O/1570415:user/release-keys' 09-22 06:54:48.248 I/DEBUG ( 3746): Revision: '33696' 09-22 06:54:48.248 I/DEBUG ( 3746): ABI: 'arm' 09-22 06:54:48.248 I/DEBUG ( 3746): pid: 3797, tid: 4379, name: MovieEncoder >>> com.camera.demo <<< 09-22 06:54:48.248 I/DEBUG ( 3746): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10 09-22 06:54:48.267 W/ActivityManager( 830): getTasks: caller 10093 does not hold GET_TASKS; limiting output 09-22 06:54:48.294 I/DEBUG ( 3746): r0 00000000 r1 00000006 r2 00000000 r3 a3733690 09-22 06:54:48.294 I/DEBUG ( 3746): r4 0000000c r5 afeb6a00 r6 00000001 r7 00000000 09-22 06:54:48.294 I/DEBUG ( 3746): r8 af55b440 r9 00000001 sl af768ea4 fp 9b03765c 09-22 06:54:48.294 I/DEBUG ( 3746): ip 00000000 sp 9d001798 lr ab502525 pc ab502540 cpsr 800f0030 09-22 06:54:48.295 I/DEBUG ( 3746): 09-22 06:54:48.295 I/DEBUG ( 3746): backtrace: 09-22 06:54:48.295 I/DEBUG ( 3746): #00 pc 0012c540 /system/vendor/lib/egl/libGLESv2_adreno.so (A4xTextureObject::IsAstcSrgba()+75) 09-22 06:54:48.295 I/DEBUG ( 3746): #01 pc 0012fc0f /system/vendor/lib/egl/libGLESv2_adreno.so (A4xContext::SetupAstcSrgbaMask()+210) 09-22 06:54:48.295 I/DEBUG ( 3746): #02 pc 00137a35 /system/vendor/lib/egl/libGLESv2_adreno.so (A4xContext::ValidateState(EsxDrawDescriptor const*)+1372) 09-22 06:54:48.295 I/DEBUG ( 3746): #03 pc 00137ca5 /system/vendor/lib/egl/libGLESv2_adreno.so (A4xContext::HwValidateGfxState(EsxDrawDescriptor const*)+8) 09-22 06:54:48.295 I/DEBUG ( 3746): #04 pc 001079ef /system/vendor/lib/egl/libGLESv2_adreno.so (EsxContext::ValidateGfxState(EsxDrawDescriptor const*)+366) 09-22 06:54:48.295 I/DEBUG ( 3746): #05 pc 00107a79 /system/vendor/lib/egl/libGLESv2_adreno.so (EsxContext::DrawArraysInstanced(EsxPrimType, int, unsigned int, unsigned int)+104) 09-22 06:54:48.295 I/DEBUG ( 3746): #06 pc 000a9511 /system/vendor/lib/egl/libGLESv2_adreno.so (EsxContext::GlDrawArrays(unsigned int, int, int)+52) 09-22 06:54:48.295 I/DEBUG ( 3746): #07 pc 000da2b3 /system/vendor/lib/egl/libGLESv2_adreno.so (EsxGlApiParamValidate::GlDrawArrays(EsxDispatch*, unsigned int, int, int)+58) 09-22 06:54:48.296 I/DEBUG ( 3746): #08 pc 000a0209 /system/vendor/lib/egl/libGLESv2_adreno.so (glDrawArrays+44) 09-22 06:54:48.296 I/DEBUG ( 3746): #09 pc 010340b7 /data/dalvik-cache/arm/system@[email protected] PS: The crash happens by accident, but not all the time.