Crash at glDrawElements on PowerVR SGX530 GPU

381 views Asked by At

I'm writing a game on Android, use OpenGL ES 2.0, native code (Android NDK). At a certain point in my game, it crashes at glDrawElements() function.

After debugging, I can make sure that:

  • The mode is GL_TRIANGLES.

  • No VBO (array or element) is used.

  • No problem with index / vertex attribute data (pointers that are passed to glVertexAttribPointer and glDrawElements are quite valid).

  • The number of vertex is small (just 6 to draw a rectangle). Even with 3 vertices, the crash still happens. With zero vertices, the crash doesn't happen, certainly :)

  • No problem with shaders. I replaced the original shaders with very simple shaders but the crash is still there.

  • If I don't call glDrawElements at that point, the game runs normally (with black screen at that point), no crash.

  • The vertex attribute array is enabled correctly (by glEnableVertexAttribArray/glDisableVertexAttribArray).

Here is the log from adb logcat:

[2014/5/24 13:54:9.606] I/DEBUG   ( 6002): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
[2014/5/24 13:54:9.612] I/DEBUG   ( 6002): Build fingerprint: 'samsung/GT-I9003/GT-I9003:2.3.6/GINGERBREAD/XXKPQ:user/release-keys'
[2014/5/24 13:54:9.616] I/DEBUG   ( 6002): pid: 7354, tid: 7371  >>> com.test <<<
[2014/5/24 13:54:9.620] I/DEBUG   ( 6002): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
[2014/5/24 13:54:9.624] I/DEBUG   ( 6002):  r0 00000000  r1 00000006  r2 00001403  r3 004b50f8
[2014/5/24 13:54:9.628] I/DEBUG   ( 6002):  r4 003b2808  r5 00000004  r6 00001403  r7 00000006
[2014/5/24 13:54:9.632] I/DEBUG   ( 6002):  r8 48253b68  r9 476e5f4c  10 00000000  fp 801a5374
[2014/5/24 13:54:9.635] I/DEBUG   ( 6002):  ip 000010a8  sp 482534d0  lr 81e0df70  pc 81e0abdc  cpsr 20000050
[2014/5/24 13:54:9.640] I/DEBUG   ( 6002):  d0  000000003b23d70a  d1  0000000000000000
[2014/5/24 13:54:9.644] I/DEBUG   ( 6002):  d2  bb88888900000000  d3  0000000000000000
[2014/5/24 13:54:9.647] I/DEBUG   ( 6002):  d4  0000000000000000  d5  00000000bf800000
[2014/5/24 13:54:9.650] I/DEBUG   ( 6002):  d6  3f7f999abf7fc28f  d7  3f80000080000000
[2014/5/24 13:54:9.653] I/DEBUG   ( 6002):  d8  000000004416a000  d9  0000000000000000
[2014/5/24 13:54:9.657] I/DEBUG   ( 6002):  d10 0000000000000000  d11 0000000000000000
[2014/5/24 13:54:9.660] I/DEBUG   ( 6002):  d12 0000000000000000  d13 0000000000000000
[2014/5/24 13:54:9.663] I/DEBUG   ( 6002):  d14 0000000000000000  d15 0000000000000000
[2014/5/24 13:54:9.666] I/DEBUG   ( 6002):  d16 c1d5d3b6fd839581  d17 3f50624dd2f1a9fc
[2014/5/24 13:54:9.670] I/DEBUG   ( 6002):  d18 41a1b969b0000000  d19 3fd147ad7b84c878
[2014/5/24 13:54:9.672] I/DEBUG   ( 6002):  d20 bf4e7ea8a8683c65  d21 be5ad3a57a4fe92a
[2014/5/24 13:54:9.675] I/DEBUG   ( 6002):  d22 bc8fefd900000000  d23 3de5d93a5acfd57c
[2014/5/24 13:54:9.679] I/DEBUG   ( 6002):  d24 bfb3b0f2af749a7c  d25 3fb10d66a0d03d5e
[2014/5/24 13:54:9.682] I/DEBUG   ( 6002):  d26 bfadde2d52defdad  d27 3fa97b4b24760df3
[2014/5/24 13:54:9.685] I/DEBUG   ( 6002):  d28 bfa2b4442c6a6c2f  d29 3f1460ea3e6884d0
[2014/5/24 13:54:9.688] I/DEBUG   ( 6002):  d30 3efb2a7074bf7ad4  d31 3e6cae7be7400000
[2014/5/24 13:54:9.741] I/DEBUG   ( 6002):  scr 60000013
[2014/5/24 13:54:9.748] I/DEBUG   ( 6002):
[2014/5/24 13:54:10.157] I/DEBUG   ( 6002):          #00  pc 0000abdc  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
[2014/5/24 13:54:10.164] I/DEBUG   ( 6002):          #01  lr 81e0df70  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
[2014/5/24 13:54:10.170] I/DEBUG   ( 6002):
[2014/5/24 13:54:10.176] I/DEBUG   ( 6002): code around pc:
[2014/5/24 13:54:10.182] I/DEBUG   ( 6002): 81e0abbc e3a00002 e5854000 e8bd8070 e301c0a8
[2014/5/24 13:54:10.186] I/DEBUG   ( 6002): 81e0abcc e92d4010 e790000c e3500000 15900024
[2014/5/24 13:54:10.189] I/DEBUG   ( 6002): 81e0abdc 15900000 10803003 e3010403 e1520000
[2014/5/24 13:54:10.193] I/DEBUG   ( 6002): 81e0abec 0a00000a e2800002 e1520000 0a000003
[2014/5/24 13:54:10.196] I/DEBUG   ( 6002): 81e0abfc e2400004 e1520000 18bd8010 ea000007
[2014/5/24 13:54:10.199] I/DEBUG   ( 6002):
[2014/5/24 13:54:10.202] I/DEBUG   ( 6002): code around lr:
[2014/5/24 13:54:10.205] I/DEBUG   ( 6002): 81e0df50 e59d3020 e1a00004 e1a01007 e28dc044
[2014/5/24 13:54:10.209] I/DEBUG   ( 6002): 81e0df60 e58dc000 e28dc040 e58dc004 ebfff315
[2014/5/24 13:54:10.212] I/DEBUG   ( 6002): 81e0df70 e59d8040 e59d9044 e3012401 e5943590
[2014/5/24 13:54:10.216] I/DEBUG   ( 6002): 81e0df80 e2888001 e0698008 e1560002 13530000
[2014/5/24 13:54:10.218] I/DEBUG   ( 6002): 81e0df90 10888009 11a0900a ea000001 e3a08000
[2014/5/24 13:54:10.221] I/DEBUG   ( 6002):
[2014/5/24 13:54:10.275] I/DEBUG   ( 6002): stack:
[2014/5/24 13:54:10.282] I/DEBUG   ( 6002):     48253490  00001100
[2014/5/24 13:54:10.288] I/DEBUG   ( 6002):     48253494  00645fd4
[2014/5/24 13:54:10.294] I/DEBUG   ( 6002):     48253498  003b3a08
[2014/5/24 13:54:10.299] I/DEBUG   ( 6002):     4825349c  003070f0
[2014/5/24 13:54:10.304] I/DEBUG   ( 6002):     482534a0  00307108
[2014/5/24 13:54:10.308] I/DEBUG   ( 6002):     482534a4  0094b8a0
[2014/5/24 13:54:10.311] I/DEBUG   ( 6002):     482534a8  003b3a08
[2014/5/24 13:54:10.314] I/DEBUG   ( 6002):     482534ac  003070f0
[2014/5/24 13:54:10.317] I/DEBUG   ( 6002):     482534b0  00307108
[2014/5/24 13:54:10.320] I/DEBUG   ( 6002):     482534b4  81e05138  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
[2014/5/24 13:54:10.323] I/DEBUG   ( 6002):     482534b8  003b2808
[2014/5/24 13:54:10.326] I/DEBUG   ( 6002):     482534bc  00000004
[2014/5/24 13:54:10.329] I/DEBUG   ( 6002):     482534c0  00001403
[2014/5/24 13:54:10.333] I/DEBUG   ( 6002):     482534c4  00000006
[2014/5/24 13:54:10.336] I/DEBUG   ( 6002):     482534c8  df002777
[2014/5/24 13:54:10.339] I/DEBUG   ( 6002):     482534cc  e3a070ad
[2014/5/24 13:54:10.342] I/DEBUG   ( 6002): #00 482534d0  003b2808
[2014/5/24 13:54:10.346] I/DEBUG   ( 6002):     482534d4  81e0df70  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
[2014/5/24 13:54:10.349] I/DEBUG   ( 6002):     482534d8  4825351c
[2014/5/24 13:54:10.352] I/DEBUG   ( 6002):     482534dc  48253518
[2014/5/24 13:54:10.355] I/DEBUG   ( 6002):     482534e0  004ad0fc
[2014/5/24 13:54:10.359] I/DEBUG   ( 6002):     482534e4  89bc26fc  /data/data/com.test/lib/libtest.so
[2014/5/24 13:54:10.363] I/DEBUG   ( 6002):     482534e8  00000003
[2014/5/24 13:54:10.366] I/DEBUG   ( 6002):     482534ec  00000003
[2014/5/24 13:54:10.369] I/DEBUG   ( 6002):     482534f0  0010059f
[2014/5/24 13:54:10.372] I/DEBUG   ( 6002):     482534f4  004b50f8
[2014/5/24 13:54:10.376] I/DEBUG   ( 6002):     482534f8  004b50f8
[2014/5/24 13:54:10.379] I/DEBUG   ( 6002):     482534fc  81e4e4cc
[2014/5/24 13:54:10.382] I/DEBUG   ( 6002):     48253500  00000006
[2014/5/24 13:54:10.385] I/DEBUG   ( 6002):     48253504  00000000
[2014/5/24 13:54:10.388] I/DEBUG   ( 6002):     48253508  00000018
[2014/5/24 13:54:10.391] I/DEBUG   ( 6002):     4825350c  004ad0fc
[2014/5/24 13:54:10.394] I/DEBUG   ( 6002):     48253510  016ec8a0
[2014/5/24 13:54:10.397] I/DEBUG   ( 6002):     48253514  00000000

The log says that the crash is near at glClear, but removing all glClear calling in my source code does not fix the crash.

My device info:

Samsung GT-i9003L
Android Gingerbread 2.3.6
GL_VENDOR = Imagination Technologies
GL_VERSION = OpenGL ES 2.0
GL_EXTENSIONS = GL_OES_rgb8_rgba8 GL_OES_depth24 GL_OES_vertex_half_float GL_OES_texture_float GL_OES_texture_half_float GL_OES_element_index_uint GL_OES_mapbuffer GL_OES_fragment_precision_high GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_required_internalformat GL_OES_depth_texture GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_standard_derivatives GL_OES_vertex_array_object GL_OES_egl_sync GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_EXT_discard_framebuffer GL_EXT_shader_texture_lod GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_stream2 GL_IMG_texture_npot GL_IMG_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_program_binary GL_IMG_multisampled_render_to_texture
GL_RENDERER = PowerVR SGX 530
0

There are 0 answers