QuickGUI iPhone RenderSystem::Exception

Duffy

23-05-2010 20:37:38

Hey folks,

I recently posted some links about an app were writing for the appstore. We decided to use Ogre and QuickGUI.
Although everything works fine on our windows machines using directx we have some trouble inside the iPhone Simulator using OpenGL ES.

I'm sure the stacktrace says more than my pitiful descriptions, but it seems to have something to do with the RenderSystem.
I'm not even sure this is a QuickGUI error, but it happens when we try to create the guimanager.
I guess it has something to do with the textureformat and/or dimensions that are passed down to the rendersystem, since GL ES is pretty basic.


Process: Spellbound [46142]
Path: /Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/AD02050E-C955-41A6-ACE4-78909CA82159/Spellbound.app/Spellbound
Identifier: Spellbound
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: launchd [154]

Interval Since Last Report: 7687 sec
Crashes Since Last Report: 7
Per-App Interval Since Last Report: 0 sec
Per-App Crashes Since Last Report: 6

Date/Time: 2010-05-23 21:52:50.959 +0200
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: DCB0B2B1-AF3D-49CC-8190-570547892709

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0

Application Specific Information:
iPhone Simulator 3.1 (139.1), iPhone OS 3.1.1 (7C145)

Thread 0 Crashed:
0 Spellbound 0x00546584 Ogre::GLESRenderSystem::_setTexture(unsigned long, bool, Ogre::TexturePtr const&) + 228
1 Spellbound 0x0023e585 Ogre::RenderSystem::_setTextureUnitSettings(unsigned long, Ogre::TextureUnitState&) + 101
2 Spellbound 0x002b9a60 Ogre::SceneManager::_setPass(Ogre::Pass const*, bool, bool) + 1280
3 Spellbound 0x0055b6a0 QuickGUI::Brush::prepareToDraw() + 178
4 Spellbound 0x005a695c QuickGUI::GUIManager::GUIManager(QuickGUI::GUIManagerDesc&) + 696
5 Spellbound 0x005cd620 QuickGUI::Root::createGUIManager(QuickGUI::GUIManagerDesc&) + 894
6 Spellbound 0x000063c9 Spellbound::Game::createQuickGUISystem() + 369 (Game.cpp:240)
7 Spellbound 0x0000730b Spellbound::Game::start() + 89 (Game.cpp:59)
8 Spellbound 0x00005697 -[AppDelegate renderOneFrame:] + 19 (Entry_iPhone.cpp:51)
9 Foundation 0x00bebdad __NSFireTimer + 141
10 CoreFoundation 0x011f4ac0 CFRunLoopRunSpecific + 3696
11 CoreFoundation 0x011f3c48 CFRunLoopRunInMode + 88
12 GraphicsServices 0x034177ad GSEventRunModal + 217
13 GraphicsServices 0x03417872 GSEventRun + 115
14 UIKit 0x0168a003 UIApplicationMain + 1157
15 Spellbound 0x000057bc main + 88 (Entry_iPhone.cpp:11)
16 Spellbound 0x00005506 start + 54

Thread 1:
0 libSystem.B.dylib 0x91565266 mach_msg_trap + 10
1 libSystem.B.dylib 0x9156ca5c mach_msg + 72
2 CoreFoundation 0x011f4382 CFRunLoopRunSpecific + 1842
3 CoreFoundation 0x011f3c48 CFRunLoopRunInMode + 88
4 WebCore 0x0362d803 __ZL12RunWebThreadPv + 467
5 libSystem.B.dylib 0x91596155 _pthread_start + 321
6 libSystem.B.dylib 0x91596012 thread_start + 34

Thread 2:
0 libSystem.B.dylib 0x9156c44e __semwait_signal + 10
1 libSystem.B.dylib 0x91596dcd pthread_cond_wait$UNIX2003 + 73
2 libGLProgrammability.dylib 0x07867353 glvmDoWork + 72
3 libSystem.B.dylib 0x91596155 _pthread_start + 321
4 libSystem.B.dylib 0x91596012 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000001 ebx: 0x005464ae ecx: 0x00000000 edx: 0x00000001
edi: 0x00000001 esi: 0x00000000 ebp: 0xbfffe308 esp: 0xbfffe2d0
ss: 0x0000001f efl: 0x00010202 eip: 0x00546584 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x00000000

Binary Images:
0x1000 - 0x820fe8 +Spellbound ??? (???) <5f6a956ee0c380216d5880382edb7ae9> /Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/AD02050E-C955-41A6-ACE4-78909CA82159/Spellbound.app/Spellbound
0xbaf000 - 0xbb1fff +PBGDBIntrospectionSupport.A.dylib ??? (???) <4d7528a048330bff2744481b88df02c1> /Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib
0xbb7000 - 0xd42ff3 +Foundation ??? (???) <06bb110e19fdbc10f40fe9de518f1fde> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation
0xe37000 - 0x103ffe7 com.apple.CoreGraphics 1.359.16 (???) <9e707e78c80932fe7894847c49ffa004> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x10a6000 - 0x1143ff7 +QuartzCore ??? (???) <aa294f3de58a7be00c92e4f6bc39d93d> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x118c000 - 0x11a2fe7 +OpenGLES ??? (???) <5507cdd0d2528f257bc3bdbdd53747e8> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x11ac000 - 0x12b2ffb +CoreFoundation ??? (???) <3331a811202da58f965529d2b2f13453> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1396000 - 0x13a1ff7 +CoreVideo ??? (???) <9a4f9970de68c4434d677b44fc86bf08> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/CoreVideo.framework/CoreVideo
0x1675000 - 0x2a32ff7 +UIKit ??? (???) <75492665251a6716d2227e7e60714a31> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit
0x2cea000 - 0x2e5ffe7 +libicucore.A.dylib ??? (???) <e0aee6125cfc3b68bf19800de149c41d> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib/libicucore.A.dylib
0x2eb9000 - 0x2fb8fe7 +libxml2.2.dylib ??? (???) <9b64552e6c1604bfa7c0a90b213bb5db> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib/libxml2.2.dylib
0x2fdf000 - 0x3079fe7 +CFNetwork ??? (???) <bb063062e2d4cc8f9e8cc9c0e27d21d7> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x30e9000 - 0x311dff7 +SystemConfiguration ??? (???) <12c9e178015bd3e68d5f1037600f6d3d> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x313f000 - 0x3193ff7 +Security ??? (???) <20d13942d9a08168d6fc44b19a8f16c9> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Security.framework/Security
0x31b9000 - 0x326fff7 +libsqlite3.dylib ??? (???) <28dae89575b379dc40f1f9404f9a0475> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib/libsqlite3.dylib
0x327e000 - 0x3309fff com.apple.framework.IOKit 1.5.1 (???) <a17f9f5ea7e8016a467e67349f4d3d03> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x332f000 - 0x33e9fe7 +ImageIO ??? (???) <560f540efa092f2d93e09c3823c995de> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/ImageIO.framework/ImageIO
0x3413000 - 0x341cff7 +GraphicsServices ??? (???) <226b6772cd655c8283f7abf928e368b8> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x342c000 - 0x3554fe3 +JavaScriptCore ??? (???) <5a3a8c3e2e9dd5aeee17bfef549069cb> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x35a8000 - 0x3cd8fe7 +WebCore ??? (???) <f2ba20464066df631135534a262f18da> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x41e2000 - 0x426cff7 +WebKit ??? (???) <f90f3783f5111a8aaf67b104816c20ee> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x42e6000 - 0x4304ff7 +AddressBook ??? (???) <e268abae32d294547f88611e2d5298a3> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/AddressBook.framework/AddressBook
0x4325000 - 0x445bfe7 +AudioToolbox ??? (???) <bcf9f765b44567001d72f6a7ea8edb1e> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x44ba000 - 0x44c6ff7 +SpringBoardServices ??? (???) <9330628ed5d8cf26ca05e5a95b82bd4b> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x44d1000 - 0x44fdfff +AppSupport ??? (???) <248c1a91a56058fe1fdbb6965aa69a0c> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x451e000 - 0x455bff7 +CoreText ??? (???) <a17467b95aa2e0d91a6b793b50d8767b> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/PrivateFrameworks/CoreText.framework/CoreText
0x4589000 - 0x4597ff7 +MobileCoreServices ??? (???) <ffc2e30100f3a06a24df643585f9ffe6> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x45a2000 - 0x4611fff +CoreAudio ??? (???) <f781349dda6e41b2527588af8c89a2b3> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x469b000 - 0x469fff7 +libGFXShared.dylib ??? (???) <5d6e30bd10e878d12618340ea5fcce67> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x46a5000 - 0x46dbff7 +libGLImage.dylib ??? (???) <a432417824fe105de954172731c14272> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x46e3000 - 0x46eaff3 +libCoreVMClient.dylib ??? (???) <59f799f78bedb95a559909a690c7c966> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
0x76db000 - 0x783bfe7 +GLEngine ??? (???) <69a607f33b822cc5f0e549090bc974f8> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/GLEngine.bundle/GLEngine
0x7866000 - 0x795cff7 +libGLProgrammability.dylib ??? (???) <c727380a438b217687db20390c444c43> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
0x797e000 - 0x814afef +libLLVMContainer.dylib ??? (???) <813ce77cafec551aeade8727941eb081> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libLLVMContainer.dylib
0x834b000 - 0x8366ff7 +GLRendererFloat ??? (???) <cf191c6be19a33d08d8422a43e7d7f53> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/GLRendererFloat.bundle/GLRendererFloat
0x8a71000 - 0x8a9dfe7 +libGLVMPlugin.dylib ??? (???) <18a4b681854c7b8ded46226e15dfcdf6> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/OpenGLES.framework/libGLVMPlugin.dylib
0x8fe00000 - 0x8fe2db43 dyld 97.1 (???) <458eed38a009e5658a79579e7bc26603> /usr/lib/dyld
0x90316000 - 0x90324ffd libz.1.dylib ??? (???) <a98b3b221a72b54faf73ded3dd7000e5> /usr/lib/libz.1.dylib
0x91564000 - 0x916cbff3 libSystem.B.dylib ??? (???) <c8f52e158bf540cc000146ca8a705958> /usr/lib/libSystem.B.dylib
0x943b8000 - 0x94415ffb libstdc++.6.dylib ??? (???) <f75e5133d72769de5ce6c06153fc65f6> /usr/lib/libstdc++.6.dylib
0x94416000 - 0x944f6fff libobjc.A.dylib ??? (???) <400e943f9e8a678eea22a1d1205490ee> /usr/lib/libobjc.A.dylib
0x948e3000 - 0x9490efe7 libauto.dylib ??? (???) <2e44c523b851e8e25f05d13a48070a58> /usr/lib/libauto.dylib
0x96aff000 - 0x96b06ffe libbsm.dylib ??? (???) <fa7ae5f1a621d9b69e7e18747c9405fb> /usr/lib/libbsm.dylib
0x97552000 - 0x97559fe9 libgcc_s.1.dylib ??? (???) <e280ddf3f5fb3049e674edcb109f389a> /usr/lib/libgcc_s.1.dylib
0x97781000 - 0x97785fff libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib
0xfffe8000 - 0xfffebfff libobjc.A.dylib ??? (???) /usr/lib/libobjc.A.dylib
0xffff0000 - 0xffff1780 libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib




Alexander

kungfoomasta

24-05-2010 16:06:55

According to the stack trace, the last function called is '_setTexture', from the RenderSystem. This is a very odd place to crash, since the call is just setting the texture to be used in future rendering operations, no rendering has been done yet. It could be possible the RenderSystem is not yet setup correctly, although I doubt this because QuickGUI only draws during the Overlay queue rendering phase. (rendering of most other objects has already been done, RenderSystem should be prepared to draw things to viewports)

Can you try removing the creation of the QuickGUI GUIManager and instead make a simple call to "_setTexture", to see if that crashes? If it doesn't, its possible the OpenGL es render system does not like the particular Pass I'm using. The pass isn't really needed, and I can take this out if this is the case. Its use is to make sure no vertex/fragment programs are currently binded, but this can be done directly by configuring the render system.

Duffy

24-05-2010 17:57:19

Hey kungfoomaster,

I followed your suggestion and called RenderSystem::_setTexture( ... ) manually.
When I enable the texture by passing "true" it immediately crashes with the same bug, when passing false the line is accepted, but I guess it might crash later, when the texture binding gets enabled.
I'm a little bid bumbed tho since the GL ES Render System works fine with the rest of our application, I'm pretty sure Ogre uses _setTexture aswell when rendering 3D models, doesn't it ?

kungfoomasta

24-05-2010 18:34:27

Yah, unless I"m mistaken I would guess _setTexture is used by Ogre, hidden away from the user. I think the material/pass/textureunitstate objects are classes that configure the render system in various ways prior to rendering an object. The RenderSystem can be used directly using all of the _xyz methods, however most people go the high level route, using entities, manual objects, etc.

When using the _xyz methods directly, you have be careful, a lot of the methods will throw exceptions if called at the wrong time.

What happens if you run code similar to this?

mRenderSystem->_setRenderTarget(myRenderWindow);

mRenderSystem->_setViewport(myViewport);

mRenderSystem->_beginFrame();

// set-up matrices
mRenderSystem->_setWorldMatrix( Ogre::Matrix4::IDENTITY );
mRenderSystem->_setProjectionMatrix( Ogre::Matrix4::IDENTITY );
mRenderSystem->_setViewMatrix( Ogre::Matrix4::IDENTITY );

mRenderSystem->_setTexture(0,true,myImageFile);

mRenderSystem->_endFrame();


I'd be interested to see if the call to _setTexture still fails here.

Duffy

24-05-2010 19:08:51

Well, it does not :(

I posted a similar thread inside the Ogre Main Forum, I'm pretty sure its some basic misunderstanding or specific calling protocol that needs to be done since I do not believe this is plainly a "QuickGUI" issue
or a fatal bug. Otherwise it would crash on "oh so many places" else ;)

kungfoomasta

24-05-2010 19:19:15

The code I posted doesn't generate any kind of crash? I saw your thread, you might want to move it to the developer forums, since its low level and requires more expert knowledge in the render system area.

Duffy

24-05-2010 20:45:03

Hey kungfoo,
it does generate the same crash as all the other examples, masterfalcon responded to my thread and it seems theres a solution, I'll build ogre using the new code snippet and get back to yall ;)

Duffy

25-05-2010 17:43:50

For all who experience the same issue it is indeed a GL ES problem discussed in this thread.

http://www.ogre3d.org/forums/viewtopic. ... 58#p390958