BUG report. "sgx error: background gpu access not permitted" [SOLVED]
by Pedro Vicente · in iTorque 2D · 07/04/2011 (3:55 am) · 2 replies
Build: 1.4.1
Platform: only iDevice (iPad)
Issues: Switching between iTorque2D application and another iPad app causes application to crash with the message in the XCode debug console.
I know this report does not offer many details but does anyone ever get this error?
Platform: only iDevice (iPad)
Issues: Switching between iTorque2D application and another iPad app causes application to crash with the message in the XCode debug console.
Quote:
sgx error: background gpu access not permitted
I know this report does not offer many details but does anyone ever get this error?
Torque 3D Owner Pedro Vicente
Space Research Software LLC
To reproduce, just create an empty project and add sound to it.
The error is triggered by this call in iPhoneOGLVideo.mm
-(void)swapBuffers { if( isLayedOut == true ) { [context presentRenderbuffer:GL_RENDERBUFFER_OES]; } }In my code I have a global flag that enables/disables sound like this
If I disable sound, the error does *not* happen.
But I think the root cause of the problem is that, according to Apple's guidelines, an Open GL app must stop sending commands to the graphics pipeline while in the background.
Implementing a Multitasking-aware OpenGL ES Application
developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_Pro...
Fix
As posted here
www.garagegames.com/community/forums/viewthread/118571
an easy fix is to add a boolean flag to stop the game loop while in the background.
I added this code to iPhoneMain.mm
bool bDoNotRun = false; S32 gLastStart = 0; void _iPhoneGameInnerLoop() { if(bDoNotRun) { return; }and then in these 2 functions
void _iPhoneGameResignActive() { Con::executef( 1, "oniPhoneResignActive" ); bDoNotRun = true; } void _iPhoneGameBecomeActive() { Con::executef( 1, "oniPhoneBecomeActive" ); bDoNotRun = false; }Like this my app only does not crash but also it resumes game play if put on foreground (without the change and no sound the app did not crash but terminated execution)