diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-06 06:38:22 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:21 +0200 |
commit | da8096e6e35af250dcc56a1af76b8a211df63a90 (patch) | |
tree | 5bac3a389afddd1ba23a9fb2ea410c077c28f3b8 /src/shader_recompiler/object_pool.h | |
parent | shader: Add pools and rename files (diff) | |
download | yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.gz yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.bz2 yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.lz yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.xz yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.zst yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.zip |
Diffstat (limited to 'src/shader_recompiler/object_pool.h')
-rw-r--r-- | src/shader_recompiler/object_pool.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index 7c65bbd92..a573add32 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h @@ -6,6 +6,7 @@ #include <memory> #include <type_traits> +#include <utility> namespace Shader { @@ -31,14 +32,12 @@ public: void ReleaseContents() { Chunk* chunk{&root}; - if (chunk) { - const size_t free_objects{chunk->free_objects}; - if (free_objects == chunk_size) { + while (chunk) { + if (chunk->free_objects == chunk_size) { break; } - chunk->free_objects = chunk_size; - for (size_t obj_id = free_objects; obj_id < chunk_size; ++obj_id) { - chunk->storage[obj_id].object.~T(); + for (; chunk->free_objects < chunk_size; ++chunk->free_objects) { + chunk->storage[chunk->free_objects].object.~T(); } chunk = chunk->next.get(); } |