Re: [AD] Not freeing resources of non-preserved bitmaps on Android is considered harmful :)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On October 22, 2015 12:59:01 PM Trent Gamblin wrote:
> After sleep, I realize that this change would break backwards
> compatibility... however, 5.0 never had an Android port and 5.1 is
> "unstable", so that may be OK... Thoughts on that?
> 
> On October 22, 2015 08:41:28 PM Max Savenkov wrote:
> > The only case I'm aware of when context is lost, is when we suspend the
> > application. The context will be lost, but there are two known
> > workarounds:
> > 
> > 1) We can detach SurfaceView from Views hierarchy, and re-attach it when
> > application is resumed. Then, the context won't be destroyed. (I haven't
> > actually tried that, but it's popular on the net)

> > 2) Make current context null during suspend (via call to
> > eglMakeCurrent(m_display,EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT)),
> > but before that, save current context ID. When app is resumed, use saved
> > context id as a share_context parameter to eglCreateContext. Then, we will
> > have access to all resources of the previous context. This is the method
> > used by SDL and at my workplace.

In my opinion this seems like an ugly hack, like you say, it looks leaky... If 
a game is suspended and resumed 100 times, you have 100 contexts...

> > 
> > The second method is what I would attempt to bring to Allegro, even
> > thought
> > it looks a bit leaky - we create a kind of a chain of shared contexts,
> > because each time we suspend/resume an app, we create a new context that
> > shares resources with previous one. However, I can't see it leading to
> > anything bad, and it works, and is easier to pull of than the first
> > method,
> > which seem to require supplying our own hacked version of GLSurfaceView.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/