OSX: Custom resolution SegV

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
milipili
Posts: 5
Joined: Sun Mar 23, 2008 4:43 pm
Location: Paris
Contact:

OSX: Custom resolution SegV

Post by milipili »

Hi !

On OS X, i tried to initialize the Irrlicht engine (The "Hello World" sample actually) like this :

Code: Select all

#ifdef _IRR_OSX_PLATFORM_
		createDevice( video::EDT_OPENGL, dimension2d<s32>(1344, 1008), 16,
			false, false, false, 0);
#else
...
I have got a nice exception error :)

GDB output :

Code: Select all

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x001bff5c in irr::CIrrDeviceMacOSX::setResize (this=0x7142b0, width=1344, height=988) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:310
310		getVideoDriver()->OnResize(core::dimension2d<s32>(width, height));
(gdb) bt
#0  0x001bff5c in irr::CIrrDeviceMacOSX::setResize (this=0x7142b0, width=1344, height=988) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:310
#1  0x001c3b86 in -[AppDelegate windowDidResize:] (self=0x71c470, _cmd=0x954c091c, aNotification=0x7191a0) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/AppDelegate.mm:53
#2  0x9553e64c in _nsnote_callback ()
#3  0x94d25aba in __CFXNotificationPost ()
#4  0x94d25d93 in _CFXNotificationPostNotification ()
#5  0x9553b7b0 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#6  0x95544ff8 in -[NSNotificationCenter postNotificationName:object:] ()
#7  0x918a325a in -[NSWindow _setFrameCommon:display:stashSize:] ()
#8  0x918a2b52 in -[NSWindow setFrame:display:] ()
#9  0x918ac156 in -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#10 0x918abde8 in -[NSWindow orderWindow:relativeTo:] ()
#11 0x91873772 in -[NSWindow makeKeyAndOrderFront:] ()
#12 0x001bfac8 in irr::CIrrDeviceMacOSX::createWindow (this=0x7142b0) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:215
#13 0x001c1c9b in irr::CIrrDeviceMacOSX::CIrrDeviceMacOSX (this=0x7142b0, param=@0xbfffe490) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:103
#14 0x001c1dac in irr::createDeviceEx (param=@0xbfffe490) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../MacOSX/CIrrDeviceMacOSX.mm:700
#15 0x0015a511 in irr::createDevice (driverType=irr::video::EDT_OPENGL, windowSize=@0xbfffe4fc, bits=32, fullscreen=false, stencilbuffer=false, vsync=false, res=0x0) at /Users/milipili/Projects/irrlicht_1.4.1/source/Irrlicht/MacOSX/../Irrlicht.cpp:39
#16 0x00016b17 in Yuni::Private::Gfx::Irrlicht::Engine::initialize (this=0x31da60, dc=@0xbfffe55c) at /Users/milipili/Projects/yuni/trunk/src/yuni/private/gfx3d/irrlicht/irr.engine.cpp:75
#17 0x000163ca in Yuni::Gfx::Engine::initialize (this=0x31dbe0, dc=@0xbfffe59c) at /Users/milipili/Projects/yuni/trunk/src/yuni/gfx/engine.cpp:69
#18 0x00014b7f in Yuni::Application::Gfx3D::initializeEngine (this=0xbfffe5f8) at /Users/milipili/Projects/yuni/trunk/src/yuni/application/gfx3d.cpp:26
Here are all available resolutions for my screen :

Code: Select all

Name: <Unknown>, guid:4d8863532f4b98c831bd82e67b0be608, primary, Hardware-Accelerated
  . 1680x1050 (32Bits)
  . 1600x1000 (32Bits)
  . 1344x1008 (32Bits)
  . 1344x840 (32Bits)
  . 1280x960 (32Bits)
  . 1280x800 (32Bits)
  . 1024x768 (32Bits)
  . 1024x640 (32Bits)
  . 800x640 (32Bits)
  . 800x640 (32Bits)
  . 640x640 (32Bits)
> Mac OS X Leopard (10.5.4), OpenGL / ATI Video card (MacBookPro), Irrlicht stable 1.4.1 (compiled with XCode)

Any idea ?
Last edited by milipili on Sat Sep 13, 2008 7:24 pm, edited 5 times in total.
milipili
Posts: 5
Joined: Sun Mar 23, 2008 4:43 pm
Location: Paris
Contact:

Post by milipili »

I forgot to mention it works fine in fullscreen mode, and in a window mode with a resolution of 800x600 or 1024x768.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Looks like the video driver isn't initialized when OnResize is called. Maybe the Mac needs some cleanup of the event handling.
Please open a bug ticket at the SourceForge tracker, might take longer...
milipili
Posts: 5
Joined: Sun Mar 23, 2008 4:43 pm
Location: Paris
Contact:

Post by milipili »

I asked to be notified when a reply is posted
and it seems the forum is aware of that ("Stop watching this topic" appears at the bottom of the page and the checkbox is checked).
I have checked my address email and that's ok.
However I did not receive any mail about the new post. Is it normal ?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

milipili wrote:I asked to be notified when a reply is posted
and it seems the forum is aware of that ("Stop watching this topic" appears at the bottom of the page and the checkbox is checked).
I have checked my address email and that's ok.
However I did not receive any mail about the new post. Is it normal ?
Yes, sourceforge doesn't allow us to send emails from PHP otherwise spammers would use their service to send junk mail to everyone.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can post a tracker item. If you login to SF before doing so you will automatically monitor the ticket, and see any progress mentioned there.
fabietto
Posts: 93
Joined: Wed Sep 24, 2008 4:38 pm
Location: Plymouth, UK
Contact:

Post by fabietto »

A similar problem happens to me, but just using my MacBook Air (which doesn't have a dedicated graphics card).

I previously posted a thread on the forum (http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=30830), but after reading this post I've tried to play a bit with the resolutions.

I create the Irrlicht device using the following instruction:

Code: Select all

device = irr::createDevice(video::EDT_OPENGL, dimension2d<s32>(1024,768), 16, false, false, false, 0); 
and it produces exactly the same error described in this post. Playing with the vertical resolution, I've seen that the application crashes only if this value is actually equal or bigger than 757...
hts13
Posts: 1
Joined: Thu Dec 18, 2008 11:10 pm

There is no bounds checking when not in fullscreen mode

Post by hts13 »

The quick answer to the problem is that there is no bounds checking in the CIrrDeviceMacOSX::createWindow code [in CIrrDeviceMacOSX.mm]. When a window is created that would extend beneath the menubar and/or the dock the window creation fails. [v1.4.2]

Clipping the size of the winow before the window is allocated will fix the problem.

The tricky part is figuring out how much to clip. The display size is easy to get (it's already in there) but you need to subtract the height of the menubar and the dock. But the dock can move around so you have to know where the dock is before you can correctly clip the bounds.

Hopefully this will make it into the 1.5 MacOSX port. :)
Post Reply