Forums - Index Buffer Object offset causing crash with OpenGL ES 1.1

5 posts / 0 new
Last post
Index Buffer Object offset causing crash with OpenGL ES 1.1
Kowalski
Join Date: 6 Sep 11
Posts: 2
Posted: Wed, 2012-01-18 01:40

Hello, 

I am using a mobile device with Adreno 205 ( HTC Desire HD ) and OpenGL ES 1.1 for my application.
Thinking of improving performance I moved to using VBO/IBOs in my rendering but found out that  glDrawElements crashes when I use its last parameter for rendering from a certain offset in the index buffer object. It is always working with zero offset but does not like index offsets different from zero. I over analyzed every aspect ( data, offsets ) and everything is ok, the same code is working perfectly on my desktop.
My vertex attributes are just float type coordinates GL_FLOAT ( 12 bytes total ) and index type is GL_UNSIGNED_SHORT ( 2 bytes ).

Is there an explanation for this behavior?

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Fri, 2012-04-06 00:30

Hi all,

I have the same problem. My code, once developed and tested on Adreno 200 (S.E. Xperia X10i), don't work on Adreno 205 (HTC Desire S) and Adreno 220 (Sony Xperia S).

All problem is directly with a index buffer object. It's actually bound before glDrawElements(). After glGetIntegerv( GL_ELEMENT_ARRAY_BUFFER_BINDING, &ibuf_id ) right IBO id is stored in ibuf_id.
glDrawElements() works correctly with 'indices' set to NULL or if i pass the valid RAM pointer as 'indices' parameter. But not with some non-null 'indices' as offset for bound IBO.
Seems glDrawElements() always tries to use 'indices' parameter as a RAM pointer and it's not matter was IBO bound or not. As result the code dies with SIGSEGV.

I use glDrawElements() like this :

uint32_t vbuf_id = 0;
uint32_t ibuf_id = 0;
glGetIntegerv( GL_ARRAY_BUFFER_BINDING, (GLint*)&vbuf_id );
glGetIntegerv( GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint*)&ibuf_id );
NT_LOG_INFO( "vbuf : %d; ibuf : %d; face : %d; idx: 0x%08X", vbuf_id, ibuf_id, face, idx );

glDrawElements( GL_TRIANGLES, face, GL_UNSIGNED_SHORT, idx );

My log output is :
...
make vertex buffer for #25 object; 800 bytes with 20B stride per vertex [40 vertices]
...
Selected index buffer #26 [0x0000001A]; size : 60
...
vbuf : #25; ibuf : #26; face : 6; idx: 0x00000060
...

Right after that i have next log:
...
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'SEMC/LT26i_1257-8629/LT26i:2.3.7/6.0.A.3.67/vPP_zw:user/release-keys'
pid: 17796, tid: 17806 >>> com.multicontext.test <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000006a
r0 00001403 r1 6fd47648 r2 80000000 r3 00001401
r4 003ee908 r5 00000060 r6 4d65f91d r7 00000004
r8 00001403 r9 00000005 10 4d35528d fp 00000001
ip 00000000 sp 3097f868 lr 00000008 pc 4d5182c4 cpsr 60000830
d0 0000000400000004 d1 0000000000000004
d2 000000e400000000 d3 00000000003ea710
d4 00000000be88771c d5 ffffffffffff0000
d6 3a03233800000000 d7 3f8000003f800000
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000008066b65103 d17 0000008066b65103
d18 0000000000000000 d19 ffffffffffff0000
d20 0000000000000000 d21 ffffffffffff0000
d22 0000000000000000 d23 ffffffffffff0000
d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
d26 0000000000000000 d27 0000000000000000
d28 0000000000000000 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 60000013
#00 pc 000182c4 /system/lib/egl/libGLESv1_CM_adreno200.so
#01 pc 0000ca92 /system/lib/egl/libGLESv1_CM_adreno200.so
#02 pc 002844da /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#03 pc 00234778 /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#04 pc 0024378a /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#05 pc 0023ce4a /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#06 pc 0023cdb6 /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#07 pc 0021e17a /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#08 pc 002ee07c /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#09 pc 001a79ca /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#10 pc 002ece2c /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#11 pc 0035532c /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
#12 pc 00011e78 /system/lib/libc.so
#13 pc 00011a38 /system/lib/libc.so
code around pc:
4d5182a4 b195d513 4301f241 39fff109 bf084598
4d5182b4 1009f815 1c98d006 bf144580 31fff04f
4d5182c4 1019f835 f7fb4620 2100fe1b 1624f8c4
4d5182d4 1408f8c4 87f0e8bd 000168c6 fffffd9c
4d5182e4 41f0e92d 46884606 f7fd4617 4d1dfac1
code around lr:
stack:
3097f828 00899b80
3097f82c fffffd08
3097f830 00000006
3097f834 00556000
3097f838 be88771c
3097f83c 4d6667ed /system/lib/egl/libGLESv2_adreno200.so
3097f840 00000060
3097f844 4d65f91d /system/lib/egl/libGLESv2_adreno200.so
3097f848 00000004
3097f84c 00001403
3097f850 00000006
3097f854 4d35528d /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
3097f858 00000001
3097f85c 4d65f929 /system/lib/egl/libGLESv2_adreno200.so
3097f860 df002777
3097f864 e3a070ad
#00 3097f868 4d51823d /system/lib/egl/libGLESv1_CM_adreno200.so
3097f86c 003860e8
3097f870 0039ec80
3097f874 00000078
3097f878 00100000
3097f87c 0037b6b8
3097f880 4d35528d /mnt/asec/com.multicontext.test-1/lib/libtest-core.so
3097f884 4d50ca95 /system/lib/egl/libGLESv1_CM_adreno200.so
#01 3097f888 4d399a80
3097f88c 4d2844dd /mnt/asec/com.multicontext.test-1/lib/libtest-core.so

..."fault addr 0000006a"
I guess this fault address is offset from my 0x60L (idx value) to fifth index position.
It means that glDrawElements() tries to use 'indices' as a RAM pointer while IBO is bound.

My code perfectly works on Adreno 200 (S.E. Xperia X10i and Samsung Galaxy Ace) and PowerVR GPU's. Also my code works on Adreno 205 too, but device is Samsung Wave 3 and OS is Bada. Code dies on Android devices with Adreno 205+.
Can somebody talk with me about this problem?

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Thu, 2012-04-26 11:12

I can't believe that no one else has stuck with this problem too.

Here is some small code to demonstrate the problem. You can pull it using GIT, repository is here :

https://github.com/FrankStain/com.multicontext.test

Version without 'USE_SELECT_IBO' works fine on all Adreno GPU's i use. Version with 'USE_SELECT_IBO' causes described SIGSEGV on Adreno 205 and 220.

Code tested on :
S.E. Xperia X10i (works exelent with all build configurations)
Sony Xperia S (works fine only without 'USE_SELECT_IBO' && 'USE_MULTICONTEXT', SIGSEGV in other any configuration) 
Samsung Galaxy Ace (works fine with(and without) 'USE_SELECT_IBO', SIGSEGV in other cases) 
HTC Desire S (Like Xperia S, works only without 'USE_SELECT_IBO' && 'USE_MULTICONTEXT') 
Samsung Galaxy S (works like on X10i, perfect, but onboard GPU is not Adreno)

I need to understand why glDrawElements() don't work correctly. Hope for your support. Thanks.

  • Up0
  • Down0
jerrychio
Join Date: 1 Jan 14
Posts: 1
Posted: Wed, 2014-01-01 20:01

Hi,

Have you guys solve this problem already? I have the same problem as well....!

Or just update to newest driver to fix this?

 

Jerry

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Wed, 2014-01-01 21:11

Hi, jerrychio.

No, i, personally, didn't. But i found other way - use OpenGL ES 2.0.
Seems, the problem lies inside Adreno GLES1 wrapper for that GPUs (also, for all later GPUs too).

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.