From: Steinar H. Gunderson Date: Tue, 17 Jun 2014 19:54:28 +0000 (+0200) Subject: When the texture freelist is too large, cut from the back, not the front. X-Git-Tag: 1.1.2~3 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=599d6cf4bf3f7d063bf96dd626ff9fb1574fe032 When the texture freelist is too large, cut from the back, not the front. All the other freelists had this right, but the texture freelist would start pruning the _newest_ entries, which obviously gave poor performance. Patch by Christophe Thommeret. --- diff --git a/resource_pool.cpp b/resource_pool.cpp index 39af866..eba7923 100644 --- a/resource_pool.cpp +++ b/resource_pool.cpp @@ -294,8 +294,8 @@ void ResourcePool::release_2d_texture(GLuint texture_num) texture_freelist_bytes += estimate_texture_size(texture_formats[texture_num]); while (texture_freelist_bytes > texture_freelist_max_bytes) { - GLuint free_texture_num = texture_freelist.front(); - texture_freelist.pop_front(); + GLuint free_texture_num = texture_freelist.back(); + texture_freelist.pop_back(); assert(texture_formats.count(free_texture_num) != 0); texture_freelist_bytes -= estimate_texture_size(texture_formats[free_texture_num]); texture_formats.erase(free_texture_num);