swapBuffers crash
by Justin Mosiman · in iTorque 2D · 10/12/2010 (2:38 am) · 6 replies
Has anybody experience a crash in iPhoneOGLVideo swapBuffers? I was looking at the crash reports for War Evolved, and the majority of them look something like:
I've modified iPhoneOGLVideo to handle touch a little differently, so the code that it crashes at is:
I've personally never experienced this crash so I wanted to see if anybody had any ideas. There are only crash reports for iOS 4.x, none for 3.x. However it isn't just the older devices, as the crash report above was from an iPhone 4.
Thanks,
Justin
Quote:
Hardware Model: iPhone3,1
Process: War Evolved [404]
Path: /var/mobile/Applications/4058EA1B-42EC-4568-9EFC-4B60B84A77D5/War Evolved.app/War Evolved
Identifier: War Evolved
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2010-10-02 22:28:20.327 +0800
OS Version: iPhone OS 4.1 (8B117)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x00078ac8 __kill + 8
1 libSystem.B.dylib 0x00078ab8 kill + 4
2 libSystem.B.dylib 0x00078aaa raise + 10
3 libSystem.B.dylib 0x0008d03a abort + 50
4 IMGSGX535GLDriver 0x00001874 glrReturnNotPermittedKillClient + 20
5 IMGSGX535GLDriver 0x00005360 SubmitPacketsIfAny + 256
6 IMGSGX535GLDriver 0x0000540c gldFlush + 4
7 GLEngine 0x000e6608 gliPresentViewES + 184
8 OpenGLES 0x00003754 -[EAGLContext presentRenderbuffer:] + 36
9 War Evolved 0x00194b60 -[iPhoneOGLVideo swapBuffers] (iPhoneOGLVideo.mm:355)
10 War Evolved 0x00194bbc OpenGLDevice::swapBuffers() (iPhoneOGLVideo.mm:208)
11 War Evolved 0x000b74ac GuiCanvas::swapBuffers() (guiCanvas.cc:1590)
12 War Evolved 0x000b903c GuiCanvas::renderFrame(bool, bool) (guiCanvas.cc:1576)
13 War Evolved 0x000495f8 DemoGame::processTimeEvent(TimeEvent*) (main.cc:774)
14 War Evolved 0x000563ac GameInterface::processEvents() (gameInterface.cc:222)
15 War Evolved 0x00192e8c _iPhoneGameInnerLoop() (iPhoneMain.mm:84)
16 War Evolved 0x0018c60c -[TGBAppDelegate runMainLoop] (TGBAppDelegate.mm:52)
17 QuartzCore 0x000926fc CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 144
18 QuartzCore 0x00092820 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 44
19 IOMobileFramebuffer 0x00001bf4 IOMobileFramebufferVsyncNotifyFunc + 68
20 ??? 0x35079040 0 + 889688128
21 CoreFoundation 0x0003d30c __CFMachPortPerform + 204
22 CoreFoundation 0x00034cdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
23 CoreFoundation 0x00034ca0 __CFRunLoopDoSource1 + 160
24 CoreFoundation 0x00027566 __CFRunLoopRun + 514
25 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
26 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
27 GraphicsServices 0x000045ec GSEventRunModal + 108
28 GraphicsServices 0x00004698 GSEventRun + 56
29 UIKit 0x0000411c -[UIApplication _run] + 396
30 UIKit 0x31e4f128
31 War Evolved 0x00192cd0 main (iPhoneMain.mm:324)
32 War Evolved 0x00034970 0x1000 + 211312
I've modified iPhoneOGLVideo to handle touch a little differently, so the code that it crashes at is:
-(void)swapBuffers {
if( isLayedOut == true ) {
//-Mat moved to layoutSubviews
// [EAGLContext setCurrentContext:context];
// glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
// glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES]; // <---- crash
//<Mat> added ClearColor to swapBuffers to see what parts of the screen are not being drawn to
//glClearColor(0.0f, 0.2f, 0.35f, 1.0f);
//glClear(GL_COLOR_BUFFER_BIT);
}
}I've personally never experienced this crash so I wanted to see if anybody had any ideas. There are only crash reports for iOS 4.x, none for 3.x. However it isn't just the older devices, as the crash report above was from an iPhone 4.
Thanks,
Justin
#2
Do you have any suggestions for a possible fix or anything that I should look into? I doubt there will be a response from GG.
10/12/2010 (2:24 pm)
Marc,Do you have any suggestions for a possible fix or anything that I should look into? I doubt there will be a response from GG.
#3
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
so check the layoutSubviews if its there and if it is, disable it there and reenable it here cause layoutSubviews won't happen only on changes of the subview so the bind could as a matter of facts be lost.
if it is used somewhere thats called continously it should be fine though.
10/12/2010 (9:38 pm)
I would have to check through the code but generally, the line right above it, glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
so check the layoutSubviews if its there and if it is, disable it there and reenable it here cause layoutSubviews won't happen only on changes of the subview so the bind could as a matter of facts be lost.
if it is used somewhere thats called continously it should be fine though.
#4
One choice is to stop calling any opengl calls once it enters background mode (there are two app delegate calls for enterBackground and enterForeground, i don't remember what they are called exactly off the top of my head but you can find them searching.) and then fix your app to work after suspending is over. I tried this with iT2D 1.4 and all i got was a black screen on resuming. Also you need to make sure you save anything you would normally save on app exit because your app can be killed without calling applicationWillTerminate if the OS decides to.
The other choice is to force your app to behave like iOS 3 and before where it terminates when you press the Home button. This is what I did as we are pressed for time to get an update out. You can do so by adding the following to your plist:
UIApplicationExitsOnSuspend and make sure its a boolean value and check the box.
12/30/2010 (4:08 pm)
The problem is apple changed the way the Home Button works in iOS 4. If you compiled your app with the 4 SDK when a device has iOS4 installed, instead of quitting the app when you press home it will suspend it. This is part of the "Fast application switching" they added. Basically your app will stay suspended in ram unless the OS needs to terminate it to free memory. The problem here is that when your app is suspended any opengl calls crash the app. SO you have 2 choices. One choice is to stop calling any opengl calls once it enters background mode (there are two app delegate calls for enterBackground and enterForeground, i don't remember what they are called exactly off the top of my head but you can find them searching.) and then fix your app to work after suspending is over. I tried this with iT2D 1.4 and all i got was a black screen on resuming. Also you need to make sure you save anything you would normally save on app exit because your app can be killed without calling applicationWillTerminate if the OS decides to.
The other choice is to force your app to behave like iOS 3 and before where it terminates when you press the Home button. This is what I did as we are pressed for time to get an update out. You can do so by adding the following to your plist:
UIApplicationExitsOnSuspend and make sure its a boolean value and check the box.
#5
*update* I fixed my problem. Turns out it was a problem with Flurry SDK. It was sending data on sleep and crashing the program so I had to turn that off.
04/19/2012 (2:53 pm)
@Justin did you ever find a fix for this. I'm experiencing the same problem.*update* I fixed my problem. Turns out it was a problem with Flurry SDK. It was sending data on sleep and crashing the program so I had to turn that off.
#6
04/21/2012 (8:42 am)
No, I never did figure it out. I'll have to look into Flurry and see if that was it for me as well. Thanks for updating your post.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft