Ug, this list gets very annoying to me with needing to reply all...

OK so the reason the NO_PRESERVE texture were not deleted was that upon resume, 
there is nothing to recreate the texture with. Other bitmaps' OpenGL texture is 
deleted (glDeleteTextures) and FBO is removed... FBO is automatically recreated 
by Allegro but OpenGL texture is not. A few lines below this deletion in the 
resume call, bitmaps are uploaded if they are not NO_PRESERVE... this recreate 
the OpenGL texture. So what's needed is to add another branch there that 
creates the OpenGL texture (it can be garbage but it needs to be created...) 
That's my interpretation of it from a quick look.

-----Original Message-----
From: Allegro-developers [mailto:[email protected]] On Behalf 
Of Max Savenkov
Sent: October 22, 2015 1:41 AM
To: [email protected]
Subject: [AD] Not freeing resources of non-preserved bitmaps on Android is 
considered harmful :)

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.

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?

_______________________________________________
Allegro-developers mailing list
[email protected]
https://mail.gna.org/listinfo/allegro-developers


_______________________________________________
Allegro-developers mailing list
[email protected]
https://mail.gna.org/listinfo/allegro-developers

Reply via email to