Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: karlkang on March 03, 2014, 07:08:05 PM

Title: Crash occurs in kitkat (under opengl 2.0)
Post by: karlkang on March 03, 2014, 07:08:05 PM
Hi there

At first I am shocked with excellent performance of latest version of NGUI. Really thanks for ur efforts for enhancing software.
But it seems that there is slight problem in the lastest version of ngui, under circumstances of kikat os and opengl 2.0,
crashes occur.   
(when i use opengl 3.0, crash doesn't occur. It works perfectly.  But most of phones doesn't support opengl 3.0. it's not compatible)
Followings are the conditions of problem

API : opengl 2.0
version of ngui : 3.5.3
OS : kitkat (4.4.2)
Phones : LG G2, Samsung Galaxy Note3, Galaxy S4 lte-a

any solution does exist? or plan to update?

Thanks for answering the questions in advance!!
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 03, 2014, 10:10:43 PM
I would need a lot more details than this to go on. What's the crash, where, how to reproduce it, etc. However generally anything related to stability is a bug that should go to Unity, not NGUI.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 06, 2014, 05:35:15 AM
Here is the same question on Unity Answers:

http://answers.unity3d.com/questions/655219/crash-on-opengl-es-30-device.html

Crash-log (NGUI 3.5.1):

java.lang.Error: FATAL EXCEPTION [UnityMain]
Unity version : 4.3.4f1
Device model : samsung GT-I9505
Device fingerprint: samsung/jfltexx/jflte:4.4.2/KOT49H/I9505XXUFNB8:user/release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 7e007000
Build fingerprint: 'samsung/jfltexx/jflte:4.4.2/KOT49H/I9505XXUFNB8:user/release-keys'
Revision: '11'
pid: 31218, tid: 31235, name: UnityMain >>> com.bla.bla <<<
r0 7e007000 r1 7dd32050 r2 000006c0 r3 435c0000
r4 000006c0 r5 7896c994 r6 7e007000 r7 7dd32010
r8 000006c0 r9 00000001 sl 7dd32280 fp 00000001
ip 00000010 sp 7896c910 lr 00000280 pc 4013525c cpsr 0000000b

at libc.__memcpy_base(__memcpy_base:227)
at libGLESv2_adreno.rb_memcpy(rb_memcpy:282)
at libGLESv2_adreno.rb_vbo_cache_buffer(rb_vbo_cache_buffer:320)
at libGLESv2_adreno.cache_vbo_attrib(cache_vbo_attrib:298)
at libGLESv2_adreno.0004962d(Native Method)
at libGLESv2_adreno.core_glDrawElementsInstancedXXX(core_glDrawElementsInstancedXXX:140)
at libGLESv2_adreno.core_glDrawElements(core_glDrawElements:10)
at libGLESv2_adreno.glDrawElements(glDrawElements:28)
at libunity.0035a918(Native Method)
at libunity.0035cca0(Native Method)
at libunity.0033d438(Native Method)
at libunity.002257d4(Native Method)
at libunity.0022583c(Native Method)
at libunity.001f2478(Native Method)
at libunity.000dc690(Native Method)
at libunity.000e1480(Native Method)
at libunity.000e6e2c(Native Method)
at libunity.000f07c8(Native Method)
at libunity.0010d584(Native Method)
at libunity.001128a8(Native Method)
at libunity.0027a290(Native Method)
at libunity.0028486c(Native Method)
at libunity.003a208c(Native Method)
at libunity.003a21e8(Native Method)
at libdvm.dvmPlatformInvoke(dvmPlatformInvoke:112)
at libdvm.dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)(dvmCallJNIMethod:398)
at libdvm.0002a060(Native Method)
at libdvm.dvmMterpStd(Thread*)(dvmMterpStd:76)
at libdvm.dvmInterpret(Thread*, Method const*, JValue*)(dvmInterpret:184)
at libdvm.dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)(dvmCallMethodV:336)
at libdvm.dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)(dvmCallMethod:20)
at libdvm.00058b6b(Native Method)


Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 06, 2014, 11:18:06 AM
Do you have multi-threaded rendering enabled?
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 06, 2014, 11:22:26 AM
No
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 06, 2014, 11:25:55 AM
So when does the crash occur? When you start? When you play? On exit? The more details the better.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 06, 2014, 11:54:08 AM
Many of our user report this bug with Samsung Galaxy S4 and Samsung Galaxy Note3. The crash occurs after few seconds (30s maybe after Start).
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 06, 2014, 11:58:55 AM
Then it sounds like this: http://forum.unity3d.com/threads/213331-Android-Black-Screen

It's a bug in Unity 4.3 and the fix seems to be making your app use a 32 bit buffer.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 07, 2014, 04:15:03 AM
32 bit buffer setting was not helpful.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 07, 2014, 05:44:41 AM
Backtrace

03-07 10:37:55.592: I/DEBUG(267): backtrace:
03-07 10:37:55.592: I/DEBUG(267):     #00  pc 0002225c  /system/lib/libc.so (__memcpy_base+227)
03-07 10:37:55.592: I/DEBUG(267):     #01  pc 00071107  /system/vendor/lib/egl/libGLESv2_adreno.so (rb_memcpy+282)
03-07 10:37:55.592: I/DEBUG(267):     #02  pc 0007d4a1  /system/vendor/lib/egl/libGLESv2_adreno.so (rb_vbo_cache_buffer+320)
03-07 10:37:55.592: I/DEBUG(267):     #03  pc 000465a7  /system/vendor/lib/egl/libGLESv2_adreno.so (cache_vbo_attrib+298)
03-07 10:37:55.592: I/DEBUG(267):     #04  pc 0004962d  /system/vendor/lib/egl/libGLESv2_adreno.so
03-07 10:37:55.592: I/DEBUG(267):     #05  pc 00049da5  /system/vendor/lib/egl/libGLESv2_adreno.so (core_glDrawElementsInstancedXXX+140)
03-07 10:37:55.592: I/DEBUG(267):     #06  pc 00049fd7  /system/vendor/lib/egl/libGLESv2_adreno.so (core_glDrawElements+10)
03-07 10:37:55.592: I/DEBUG(267):     #07  pc 00039767  /system/vendor/lib/egl/libGLESv2_adreno.so (glDrawElements+28)
03-07 10:37:55.592: I/DEBUG(267):     #08  pc 003cdbb4  /data/app-lib/com.bla.bla/libunity.so (GLES2VBO::DrawInternal(int, int, ChannelAssigns const&, void*, unsigned int, GfxPrimitiveType, unsigned int, unsigned int, unsigned int)+400)
03-07 10:37:55.592: I/DEBUG(267):     #09  pc 003ce754  /data/app-lib/com.bla.bla/libunity.so (GLES2VBO::DrawVBO(ChannelAssigns const&, unsigned int, unsigned int, GfxPrimitiveType, unsigned int, unsigned int)+132)
03-07 10:37:55.592: I/DEBUG(267):     #10  pc 003b68d8  /data/app-lib/com.bla.bla/libunity.so (ThreadedVBO::DrawVBO(ChannelAssigns const&, unsigned int, unsigned int, GfxPrimitiveType, unsigned int, unsigned int)+508)
03-07 10:37:55.592: I/DEBUG(267):     #11  pc 001f47b0  /data/app-lib/com.bla.bla/libunity.so (DrawUtil::DrawVBOMeshRaw(VBO&, Mesh&, ChannelAssigns const&, int, unsigned int)+104)
03-07 10:37:55.592: I/DEBUG(267):     #12  pc 001f4824  /data/app-lib/com.bla.bla/libunity.so (DrawUtil::DrawMeshRaw(ChannelAssigns const&, Mesh&, int)+60)
03-07 10:37:55.592: I/DEBUG(267):     #13  pc 0015ec34  /data/app-lib/com.bla.bla/libunity.so (MeshRenderer::Render(int, ChannelAssigns const&)+92)
03-07 10:37:55.592: I/DEBUG(267):     #14  pc 001e4ae0  /data/app-lib/com.bla.bla/libunity.so (BatchRenderer::Flush()+116)
03-07 10:37:55.592: I/DEBUG(267):     #15  pc 000eba48  /data/app-lib/com.bla.bla/libunity.so (ForwardShaderRenderLoop::PerformRendering(ActiveLight const*, RenderTexture*, ShadowCullData const&, bool, bool, bool)+1964)
03-07 10:37:55.592: I/DEBUG(267):     #16  pc 000ed0f8  /data/app-lib/com.bla.bla/libunity.so (DoForwardShaderRenderLoop(RenderLoopContext&, dynamic_array<RenderObjectData, 4u, (MemLabelIdentifier)53>&, bool, bool, RenderTexture*, ActiveLights&, bool, bool)+3624)
03-07 10:37:55.592: I/DEBUG(267):     #17  pc 000f7500  /data/app-lib/com.bla.bla/libunity.so (DoRenderLoop(RenderLoop&, RenderingPath, CullResults&, bool)+1436)
03-07 10:37:55.592: I/DEBUG(267):     #18  pc 000fc3dc  /data/app-lib/com.bla.bla/libunity.so (Camera::DoRender(CullResults&, void (*)(Camera&, RenderLoop&, CullResults&), int)+284)
03-07 10:37:55.592: I/DEBUG(267):     #19  pc 00103854  /data/app-lib/com.bla.bla/libunity.so (Camera::Render(CullResults&, int)+260)
03-07 10:37:55.592: I/DEBUG(267):     #20  pc 001284d4  /data/app-lib/com.bla.bla/libunity.so (RenderManager::RenderCameras()+240)
03-07 10:37:55.592: I/DEBUG(267):     #21  pc 00288490  /data/app-lib/com.bla.bla/libunity.so (PlayerRender(bool)+144)
03-07 10:37:55.592: I/DEBUG(267):     #22  pc 002890b0  /data/app-lib/com.bla.bla/libunity.so (PlayerLoop(bool, bool, IHookEvent*)+2596)
03-07 10:37:55.592: I/DEBUG(267):     #23  pc 003ff820  /data/app-lib/com.bla.bla/libunity.so (UnityPlayerLoop()+712)
03-07 10:37:55.592: I/DEBUG(267):     #24  pc 004043e0  /data/app-lib/com.bla.bla/libunity.so (nativeRender(_JNIEnv*, _jobject*)+80)
03-07 10:37:55.592: I/DEBUG(267):     #25  pc 00020bcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
03-07 10:37:55.592: I/DEBUG(267):     #26  pc 00051927  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
03-07 10:37:55.592: I/DEBUG(267):     #27  pc 0002a060  /system/lib/libdvm.so
03-07 10:37:55.592: I/DEBUG(267):     #28  pc 00031510  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
03-07 10:37:55.592: I/DEBUG(267):     #29  pc 0002eba8  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
03-07 10:37:55.592: I/DEBUG(267):     #30  pc 00063e75  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
03-07 10:37:55.592: I/DEBUG(267):     #31  pc 00063e99  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 07, 2014, 07:53:52 AM
Please submit a bug to Unity so they can look into this. None of this is in NGUI's code, so I have nothing to look into here. The stack trace points to adreno-based rendering inside Unity.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 24, 2014, 06:03:00 AM
We suspect that is a NGUI Tween issue (UITweener). We try to narrow it down and build a small repro project.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tyomaa88 on March 24, 2014, 08:16:56 AM
Hi there. We are having the same issue here.

For our project we upgraded NGUI from 3.0.4 to 3.5.0 and started to experience this crash (w/ same stacktrace). We have not upgraded Unity - all of the last builds were made in 4.2.2 version of Unity, so it seems pretty logical for me that there might be a problem in NGUI =(

Crash is easily reproduced on Samsung Galaxy Note 3 (Qualcomm Snapdragon 800 / Adreno 330) but not on several other devices. Previous builds (on NGUI 3.0.4) never crashed on exact same device.

Aren, that would be really nice if you could dig a little bit more into this issue, this is a real problem for our game =(
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 24, 2014, 12:36:55 PM
It seems this is not a Tween issue, but a Font / widget depth issue (maybe???). It is difficult to reproduce! This is definitely a NGUI Bug.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 25, 2014, 04:43:50 AM
The Sony Xperia Z Ultra is a new device with this crash, because Android KitKat now rolling out to Sony Xperia Z Ultra.

Here are the the crash candidates (all Android-KitKat with OpenGL ES supported devices, but not the Nexus devices)
http://en.wikipedia.org/wiki/OpenGL_ES#OpenGL_ES_3.0_2

Downgraded to NGUI 3.0.8f4, not crash!
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tyomaa88 on March 25, 2014, 07:18:44 AM
Seems like updating from 3.5.0 to 3.5.5 solved an issue! But we were able to test it only on Samsung Galaxy Note 3
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 25, 2014, 09:33:40 AM
No, Version 3.5.5 solved not the issue. We have tested it with Samsung Galaxy S4. The Galaxy S4 crashed after a longer time.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tyomaa88 on March 25, 2014, 09:45:21 AM
We've experienced this crash almost immediately when displaying our most complex gui screen on Note 3 and it's gone in 3.5.5 ngui. Maybe you've got another type of crash on S4, does it have absolutely the same trace? I'll try to play our game for a little bit more time then and see if it crashes on 3.5.5
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tyomaa88 on March 25, 2014, 10:09:30 AM
Yeah, we've crashed too on other screen, but it took a little bit more time than on 3.5.0
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on March 26, 2014, 12:16:39 PM
no solution?
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on March 26, 2014, 07:09:40 PM
Try this... UIDrawCall, line 406 is currently:
  1. // If the number of vertices in the buffer is less than half of the full buffer, trim it
  2. if (!trim && (verts.size << 1) < verts.buffer.Length) trim = true;
...change it to be simply:
  1. trim = true;
I'm flying in the blind with this issue as it's a problem in Unity itself, and only Unity can fix it properly.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tyomaa88 on March 27, 2014, 11:35:59 AM
Also didn't help. We are out of ideas =(
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ChrisPruett on April 11, 2014, 11:46:35 AM
We have a bunch of users who are experiencing this as well, but haven't been able to reproduce it locally yet.

What we do know is that dynamic batching isn't related to this crash.  Same failure occurs on or off.  This is also not the same as the 32-bit depth buffer workaround.  Symptoms are that users are able to play for a while before the process suddenly dies without warning.

I'm agreed that the bug here is in the Adreno 320 driver, but if there's a way to workaround it I'd like to find it.

Aren, other than the UIDrawCall trimming, is there anything that changed between 3.0.8f4 and latest that might have something to do with VBO caching that I could poke at?  It's likely that nothing NGUI is doing is explicitly wrong, but if some subtle change in the way that vertex arrays are handled has caused this bug to surface, I might be able to work around it by changing that area of behavior.

Thanks.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ChrisPruett on April 11, 2014, 06:52:45 PM
I think I've found a workaround.

This is clearly not an NGUI bug.  It's not even a Unity bug.  The Adreno 320 / 330 GLES2 driver is at fault here.  Here's some folks who are not using Unity at all that have hit this crash:

https://github.com/opensciencemap/vtm/issues/52

Anyway, the crash callstack is proceeded by some spew from the driver like this:

04-11 13:41:21.927: W/Adreno-GSL(12206): <ioctl_kgsl_sharedmem_write:1668>: kgsl_sharedmem_write:invalid arg offset 49152 size 1536 memdesc size 4096

and the crash itself is in memcpy, so it looks like this has something to do with moving verts to a buffer that isn't sized correctly.  Or something.

On one of my test devices I was able to get the crash to occur at a particular point, and then by manipulating unrelated things, I actually moved the point of the crash about 2 seconds into the future (i.e. it took 2 seconds longer to occur than the normal trigger point).  This suggests to me that this might be some sort of cache buffer overflow in the driver; perhaps error accumulates until finally the crash occurs.

On the theory that reducing the number of vbo size changes might placate the driver, I commented out the line that Aren indicated above (setting trim if the number of verts is < 50% of the buffer in UIDrawCall).  This probably wastes some memory, as we have some VBOs that are allocated for many more verts than they need, but on the other hand if we have a case where the contents of the VBOs change rapidly, and if the driver dies because of an accumulated overflow, this might be sufficient to avoid the crash.

So far it appears to work.  I've run for about an hour on the Galaxy S4 with zero crashes (before this change I could repro in < 1 minute).  I need to do some more testing on other devices, but for now it seems like a pretty benign way to work around the crappy driver.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ChrisPruett on April 15, 2014, 09:53:09 AM
Update: commenting out the space-saving trim has indeed resolved 100% of our crashes on Adreno 320/330 devices.  It also significantly improved performance on one particular device (the Moto X, I think).

I suppose our use case, or possibly NGUI, causes VBO reallocations at high frequency.  At any rate, this is probably something to consider for anybody shipping an NGUI game on Android.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on April 15, 2014, 10:06:26 AM
Thanks, Chris. So to confirm, you basically did this?
  1. #if !UNITY_4_3 || !UNITY_ANDROID
  2.                                 // If the number of vertices in the buffer is less than half of the full buffer, trim it
  3.                                 if (!trim && (verts.size << 1) < verts.buffer.Length) trim = true;
  4. #endif
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ChrisPruett on April 16, 2014, 06:17:19 PM
I actually just commented out the entire line because I wanted to see if there would be side-effects in the editor.  I don't think the Unity version has much to do with the actual problem, although perhaps something under the hood masks the issue.  But yes, that change would have effectively solved it for me, as I wouldn't be trimming in this case on Android.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: SirCoolbeans on April 18, 2014, 08:32:43 AM
I've also started to get this problem.

I'm on Unity 4.3.4 and NGUI 3.5.3. The device is a Galaxy S4.

Using a 32 bit buffer and/or the trim changes in UIDrawCall made no difference to me.

The issue appears to be related to OpenGL 2.0. Running my game using OpenGL 3.0 on Android clears things up.

Obviously that's not an ideal solution, it works for me right now as I can continue development.

If I find a proper solution I'll let you guys know. If anyone gets there first it would be awesome to share the knowledge. :-)
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: JSorrentino on April 18, 2014, 11:54:40 AM
  1. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  2. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  3. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  4. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  5. W/qdhwcomposer(  281): Excessive delay reading vsync: took 382 ms
  6. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  7. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  8. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  9. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  10. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  11. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  12. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  13. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  14. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  15. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  16. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  17. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192
  18. W/Adreno-GSL(28962): <ioctl_kgsl_sharedmem_write:1605>: kgsl_sharedmem_write:invalid arg offset 98304 size 1152 memdesc size 8192

Same issue as ChrisPruett - exactly.

I've been trying to find this error for a while now and have been alleviating anything I can to narrow it down.  Disableing animations, textures, coroutines, removing switch statements - anything I could think of.

Commenting the line out resolved my issues.  Samsung Galaxy S4, also the new S5 had the same crash/anr pointing to a memcpy issue.

Chris, thanks for posting the details, it really helped.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: RogueRocket on April 25, 2014, 01:51:56 PM
Just started noticing reports of this in our console.  Unfortunately, we're on NGUI 3.4.8 and that line that is being commented/#if'd out doesn't even exist yet in 3.4.8
I'm hesitant to update to a newer NGUI right now as I'm meant to be launching an app update this week.

Did this change need to be combined w/ setting to 32-bit buffer?
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: tayl0r on June 27, 2014, 10:35:37 AM
The Unity 4.5 release notes say this:

* Fixed crash on Android 4.4.2 when running on certain Adreno GPUs.

And I'm assuming that is referring to this issue. Can anyone confirm? It seems fixed to me but a guy on the tk2d forums is saying its not.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on June 27, 2014, 12:26:17 PM
NGUI "fixed" it a few months ago (with a work-around), so it's unlikely that you will run into this even prior to 4.5, assuming you're using the latest NGUI version.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on July 07, 2014, 06:34:42 AM
The bug is present again in Android 4.4.4  :(.

These devices are currently affected:
- Sony Xperia Z1
- Sony Xperia Z1 Compact
- Sony Xperia Z Ultra

http://www.androidcentral.com/sony-android-444-xperia-z1-compact

We use Unity 4.5.1p3 and NGUI 3.6.5.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on July 08, 2014, 02:55:19 AM
We have a new (libc.memcpy) Bug Report in our Google Play Developer Console:

java.lang.Error: FATAL EXCEPTION [UnityMain]
Unity version : 4.5.1p3
Device model : HUAWEI HUAWEI G6-U10
Device fingerprint: Huawei/G6-U10/hwG6-U10:4.3/HuaweiG6-U10/C900B116:user/ota-rel-keys,release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 71d35000
Build fingerprint: 'Huawei/G6-U10/hwG6-U10:4.3/HuaweiG6-U10/C900B116:user/ota-rel-keys,release-keys'
Revision: '0'
pid: 23425, tid: 23460, name: UnityMain >>> de.bla.bla <<<
r0 71d35000 r1 65bcc050 r2 00000780 r3 c28c5a12
r4 00000780 r5 60c45c60 r6 71d35000 r7 65bcc010
r8 00000780 r9 00000001 sl 65bcc280 fp 00000001
ip 00000013 sp 60c45bd8 lr 00000280 pc 40064250 cpsr 2f303155

at libc.memcpy(memcpy:272)
at Unknown.0000077c(Unknown Source)

These devices are currently affected:
- Sony Xperia M2 with Android 4.3
- Huawei Ascend G6 with Android 4.3
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on July 08, 2014, 12:10:30 PM
You should submit that to Unity, Russel.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: gdeglin on July 09, 2014, 02:09:04 AM
Also experiencing this problem. Seems like we'll have to delay the release of our game because of it.

Someone mentioned that NGUI 3.4.9 doesn't have this problem, but I would hate to have to downgrade so far back.

@Russel Did you submit this to Unity? Could you post the bug number if you have one.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on July 09, 2014, 04:10:28 AM
Here is the Unity Forum Link:
http://forum.unity3d.com/threads/crash-occurs-in-kitkat-under-opengl-2-0.232643/

How do I get a bug number?
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: chowon on July 09, 2014, 04:13:21 AM
I had the same problem. No problem in OpenGL ES 3.0(in KitKat). OpenGL ES 2.0 only problem(in KitKat).
However, there are many devices that use OpenGL ES 2.0. That's why I can not build OpenGL ES 3.0.
This is a very serious issue that our development team.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on July 09, 2014, 05:13:33 PM
Help -> Report a Bug
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: gdeglin on July 09, 2014, 08:27:02 PM
Just reported it myself. Case 618714 http://fogbugz.unity3d.com/default.asp?618714_cqbtk45pudo6t8if

My attempts to put together a test case have failed so far, so I pointed them at this thread and a few others threads about this issue I found on the Unity forum. If you don't mind submitting your project to Unity, please use the report a bug feature too and reference Case 618714.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: gdeglin on July 09, 2014, 09:45:06 PM
Hey all. We might have a fix.

In UIDrawCall change:
  1. #if !UNITY_4_3 || !UNITY_ANDROID
  2.         // If the number of vertices in the buffer is less than half of the full buffer, trim it
  3.         if (!trim && (verts.size << 1) < verts.buffer.Length) trim = true;
  4. #endif
  5.  
to
  1. #if !UNITY_ANDROID
  2.         // If the number of vertices in the buffer is less than half of the full buffer, trim it
  3.         if (!trim && (verts.size << 1) < verts.buffer.Length) trim = true;
  4. #endif
  5.  

Let me know if this works for you!

Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Russel on July 10, 2014, 04:11:52 AM
@ArenMook Thank you!

@gdeglin We don't have a test device where the issue occurs. Thanks for your help!

Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on July 10, 2014, 09:01:20 PM
This was supposedly fixed in Unity 4.5 according to version notes, so if that's not the case then Unity should certainly be made aware of the problem. The #if section @gdeglin mentioned was a hack around the problem, and it's not used in 4.5 as Unity said they fixed it.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: gdeglin on July 10, 2014, 09:08:30 PM
Yep, that's the conclusion I reached too. Explains why the error went away and then came back though -- it was due to people upgrading to Unity 4.5.

We've been testing our game quite a bit and it seems stable now after the change. Hopefully someone else can test and confirm if this workaround fixes things through.

No response to my Unity bug ticket yet.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: Skjalg on August 26, 2014, 06:32:39 AM
Any update from unity on this issue? We're experiencing crashes on xperia devices too. (using unity 4.5.2)
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: 4nn0y1ng_0r4ng3 on September 18, 2014, 07:05:43 AM
I have the same issue with Xiaomi Mi3W (Adreno 330)

I have all updated:

-Unity 4.5.4f1
-NGUI 3.7.2
-Android SDK

Where can I download NGUI 3.0.8f4 for try to downgrade?

Like Russel -> http://www.tasharen.com/forum/index.php?topic=8415.msg41357#msg41357

I need a solution because I can't have the game with this problem.

Thanks

EDIT -> SOLUTION:

You have to force the Graphics Level to OpenGL ES 2.0

File -> Build Settings -> Player Settings -> Other Settings -> Graphics Level to OpenGL ES 2.0

(http://i59.tinypic.com/fvg508.png)

Now works :)
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: ArenMook on September 18, 2014, 03:41:49 PM
The same code is still there. Line 406 of UIDrawCall.cs.

Unity fixed it in some version... 4.5.2 maybe? If it's back, then they re-introduced it as a regression bug. They tend to do that often. Help -> Report a Bug.
Title: Re: Crash occurs in kitkat (under opengl 2.0)
Post by: 4nn0y1ng_0r4ng3 on September 19, 2014, 08:42:47 AM
I found a solution -> You have to force the Graphics Level to OpenGL ES 2.0