Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » iOS framebuffer creation often fails

This thread is locked; no one can reply to it. rss feed Print
iOS framebuffer creation often fails
Michael Moffitt
Member #15,246
July 2013

When starting up an app, with a debugger attached the framebuffer almost always fails to be created in EAGLView.m. Without a debugger attached, or in release configuration, it almost always is successfully created. However, neither is 100% successful or deterministic.

If we take a look at this excerpt from layoutSubviews:
if (!viewRenderbuffer) {
[self createFramebuffer];
/* Depending on the orientation, the initial framebuffer dimensions may be
* rotated so we need to update them. For example
* a call to al_create_display(480, 640) will create a display of
* 640x480 pixels in landscape mode.
*/
allegro_display->w = backingWidth;
allegro_display->h = backingHeight;
}
[self send_resize_event];

createFramebuffer's return message isn't being checked. Perhaps an acceptable hack in the meantime could have it try multiple times to create the framebuffer, with some maximum amount of tries? It would be good to have a check like "int al_eagl_framebuffer_exists(void)" so a developer could do this sort of check too.

jmasterx
Member #11,410
October 2009

Personally, I'm not crazy about the user looking at the framebuffer value and acting on that to 'solve' the problem, but, I think retrying a few times until it works could be a decent solution for now, as long as it basically works 100% of the time.

I tried a few times to find a good solution but could not identify the root cause. It's inconsistent and seems to be os/device specific.

SiegeLord
Member #7,827
October 2006
avatar

There's a NSLog statement inside that code that should be logging the error, could you check the logs and see what it returns? This could very well be a bug in Allegro, although I've personally never seen it happen.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

jmasterx
Member #11,410
October 2009

It never happened to me on my iPad Mini 1. But on my iPad 4th Gen it happens about as often as the OP describes.

Michael Moffitt
Member #15,246
July 2013

I implemented the bad fix as described, and unfortunately, it doesn't help. Something bad (memory allocation failure, race conditions, I have no idea) happens before that, and allowing it to try many times even with periodic thread sleeps between does nothing to help - the same "failed to make complete framebuffer object" message will keep happening.

The check that is making that happen is on line 227 of src/iphone/EAGLView.m:

if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES)

This person's problem sounds like it is similar: http://stackoverflow.com/questions/4093434/opengl-es-iphone-and-intermittent-error-gl-framebuffer-incomplete-attachment-o

EDIT: I can verify that the problem is not from attempting to create an ES2 context, which is activated when flags has ALLEGRO_PROGRAMMABLE_PIPELINE set. I get the same results regardless.

Go to: