From 599d6cf4bf3f7d063bf96dd626ff9fb1574fe032 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 17 Jun 2014 21:54:28 +0200 Subject: [PATCH] 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. --- resource_pool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.2