Page 1 of 1

[0.10.3] OSX missing graphics

Posted: Mon Jul 21, 2014 7:47 am
by Xecutor
Here are details: https://forums.factorio.com/forum/vie ... =49&t=4865
One more example with low res setting turned on:
Image
Looks like one (or probably more) random image fails to load sometimes.
Log contains no errors:

Code: Select all

14:35:34 Info None: 2014:07:21; Factorio 0.10.3 (Build 10432, mac)
14:35:36 Info Mods: Loading mod core 0.0.0
14:35:36 Info Mods: Loading mod base 0.10.3
14:35:37 Info Atlas: Initial atlas bitmap size is 16384
14:35:37 Info Atlas: Created atlas bitmap 16384x2459
14:35:48 Info Updater: Downloading https://www.factorio.com/updater/...

Re: [0.10.3] OSX missing graphics

Posted: Mon Jul 21, 2014 7:58 am
by Xecutor
Ha. I usually maximize game window during loading (right after start)...
Now I tried to wait till the end of loading and then maximize.
No missing images so far.
So ... my guess is - during maximization the game might skip/fail to load an image.

Re: [0.10.3] OSX missing graphics

Posted: Mon Jul 21, 2014 9:17 am
by slpwnd
Thanks for the report. Very strange. Especially the bit about maximizing the window.

Re: [0.10.3] OSX missing graphics

Posted: Tue Jul 22, 2014 3:03 pm
by Xecutor
Just some wild guess, probably completely unrelated.
When I was messing with SDL+OpenGL, I had problems with window resizing on mac os x.
After awhile I figured that opengl context must be reinited after window resize, in order for viewport to display picture properly.
Another note, may be unrelated too, but on windows when you resize the window during load, splash image resizes immediately,
but on mac os it is displayed at left bottom corner with original size. Size is updated only after loading is finished.

Re: [0.10.3] OSX missing graphics

Posted: Wed Jul 23, 2014 1:13 am
by muzzy
Window resize has been causing issues to me all the time as well, some random images fail to work if I resize during loading. It has been like this since the first version I played, and resizing right after starting a new game (i.e. after main menu) has sometimes even crashed the game.

Waitamoment ... I'm resizing the window in-game, and the ores keep jumping around. Does the window size change in middle of a frame, causing the ore layer to be rendered with different offset because of it?!

Also sometimes the window just flashes white while resizing.

If I zoom out a lot and do the resize dance, I can see what looks like uninitialized memory being drawn.

So.... I just kept resizing the window for some 5 (or was it 10?) minutes straight until I got the crash to happen. Yes, I literally have nothing better to do at 4am in the morning.

Code: Select all

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

Thread 2 Crashed:
0   libsystem_platform.dylib      	0x00007fff93fe203a _platform_memmove$VARIANT$Nehalem + 90
1   com.factorio.factorio         	0x000000010068116f _al_convert_bitmap_data + 287
2   com.factorio.factorio         	0x00000001006c0ca4 _al_ogl_unlock_region_new + 708
3   com.factorio.factorio         	0x0000000100683589 al_unlock_bitmap + 105
4   com.factorio.factorio         	0x000000010023696d SubChart::refresh(Chart&) + 237
5   com.factorio.factorio         	0x00000001001d71d1 Chart::refreshRecentlyCharted() + 209
6   com.factorio.factorio         	0x00000001001d6f89 Game::postUpdate() + 105
7   com.factorio.factorio         	0x0000000100308d55 tickStep(bool) + 1317
8   com.factorio.factorio         	0x000000010030939b run(char*, bool) + 283
9   com.factorio.factorio         	0x000000010030af74 _al_mangled_main + 4580
10  com.factorio.factorio         	0x00000001006fb2e7 +[AllegroAppDelegate app_main:] + 23
11  com.apple.Foundation          	0x00007fff96ee776b __NSThread__main__ + 1318
12  libsystem_pthread.dylib       	0x00007fff91ca3899 _pthread_body + 138
13  libsystem_pthread.dylib       	0x00007fff91ca372a _pthread_start + 137
14  libsystem_pthread.dylib       	0x00007fff91ca7fc9 thread_start + 13
Looks like this time it was null pointer in bitmap data during SubChart::refresh() ... i.e. again a piece of code that works with bitmap data, just like the loading sequence does.

Summary: The resize code happens in middle of the frame, likely in another thread, invalidating the rendering context and/or bitmap data while it's being used ... WTF?

Have fun debugging this one :)

Re: [0.10.3] OSX missing graphics

Posted: Fri Jul 25, 2014 7:07 am
by slpwnd
Played with this one for a while and it looks like some Allegro / OpenGL magic. Reinitializing the OpenGL context after resize did not help, though I am not sure if I did it correctly since we don't work with open gl directly but via Allegro. Anyway there is always a "simple solution" of disabling changing the window size on load :|

Re: [0.10.3] OSX missing graphics

Posted: Fri Jul 25, 2014 2:49 pm
by Xecutor
Uh. I wasn't clear enough. Allegro probably reinits opengl context on it's own on resize, and this might be the cause of the problem.
Without reinit there are strange visual artifacts all over the screen.
If loading and message handling are in different threads, then, probably, the image that is being loaded at the moment of reinit is lost.