set ALLEGRO_NO_PRESERVE_TEXTURE by default on desktop platforms

This almost halves RAM usage on desktop. On mobile, a more elaborate
approach will have to be developed.
This commit is contained in:
Sebastian Krzyszkowiak 2018-08-05 01:17:41 +02:00
parent 1f71f03ef8
commit 4c12939afe
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -197,6 +197,15 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
al_android_set_apk_fs_interface(); al_android_set_apk_fs_interface();
#endif #endif
#if !defined(ALLEGRO_ANDROID) && !defined(ALLEGRO_IPHONE) && !defined(ALLEGRO_SDL)
// We're always using OpenGL which already preserves textures on its own, so avoid
// excessive RAM usage by not backuping the bitmaps when not necessary.
// Android and iOS can threw out the context, so bitmaps need to be preserved there.
// SDL2 backend seems to have some workaround for old SDL bug, worth looking into.
// This will have to be revisited on mobile GNU/Linux platforms.
al_add_new_bitmap_flag(ALLEGRO_NO_PRESERVE_TEXTURE);
#endif
PrintConsole(game, "libsuperderpy 2 (rev " LIBSUPERDERPY_GIT_REV ")"); PrintConsole(game, "libsuperderpy 2 (rev " LIBSUPERDERPY_GIT_REV ")");
PrintConsole(game, "OpenGL%s (%08X)", al_get_opengl_variant() == ALLEGRO_OPENGL_ES ? " ES" : "", al_get_opengl_version()); PrintConsole(game, "OpenGL%s (%08X)", al_get_opengl_variant() == ALLEGRO_OPENGL_ES ? " ES" : "", al_get_opengl_version());