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 10:40:56 AM Max Savenkov wrote:
> I think I found another bug in Android implementation. For some reason,
> in 'android_acknowledge_drawing_halt(ALLEGRO_DISPLAY *dpy)' Allegro does
> not delete resources of bitmap if it has ALLEGRO_NO_PRESERVE_TEXTURE
> flag set. Since in reality FBOs and textures for those bitmaps are
> deleted when OpenGL context is deleted during suspension, this leads to
> corruption after the game is resumed. I'm not very clear on details, but
> somehow OTHER bitmaps may end up corrupted because of this.
> 
> I tried commenting out this flag and it seems to make everything better
> 
> :) So unless there is some remembered reason for it being there, I
> 
> propose to strike out this check.

I'll check this tomorrow.

> Also, I'd like to question the whole approach Allegro takes to
> suspension/resuming on Android. Why doesn't it uses the same method as
> SDL, which preserves the whole OpenGL context, instead of re-uploading
> bitmaps after resuming? This would eliminate the difference between
> NO_PRESERVE_TEXTRURE and other bitmaps (as it should be with OpenGL) and
> also preserve shaders (which presently has to be re-created as well
> during resuming). This would allow Allegro (or its user at least) to
> save memory by setting NO_PRESERVE_TEXTURE for all bitmaps and not store
> in-memory copy of data. Is there any reason not to do so, or is it just
> a historical decision?

If it's possible to preserve the context then NO_PRESERVE_TEXTURE should be a 
no-op on Android like on PC. If you wish to create a patch for this then I'll 
be happy to take a look at it.

Thanks.




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