diff options
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 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <type_traits> | 8 | #include <type_traits> |
| 9 | #include <utility> | ||
| 9 | 10 | ||
| 10 | namespace Shader { | 11 | namespace Shader { |
| 11 | 12 | ||
| @@ -31,14 +32,12 @@ public: | |||
| 31 | 32 | ||
| 32 | void ReleaseContents() { | 33 | void ReleaseContents() { |
| 33 | Chunk* chunk{&root}; | 34 | Chunk* chunk{&root}; |
| 34 | if (chunk) { | 35 | while (chunk) { |
| 35 | const size_t free_objects{chunk->free_objects}; | 36 | if (chunk->free_objects == chunk_size) { |
| 36 | if (free_objects == chunk_size) { | ||
| 37 | break; | 37 | break; |
| 38 | } | 38 | } |
| 39 | chunk->free_objects = chunk_size; | 39 | for (; chunk->free_objects < chunk_size; ++chunk->free_objects) { |
| 40 | for (size_t obj_id = free_objects; obj_id < chunk_size; ++obj_id) { | 40 | chunk->storage[chunk->free_objects].object.~T(); |
| 41 | chunk->storage[obj_id].object.~T(); | ||
| 42 | } | 41 | } |
| 43 | chunk = chunk->next.get(); | 42 | chunk = chunk->next.get(); |
| 44 | } | 43 | } |