Metal: Ensure pending MTLSafeFreeList is released on shutdown
Ensure that on closing of the application, all pending SafeFreeLists are released. A new change to ensure release of SafeFreeLists was always deferred until full completion of GPU buffers meant that a pending MTLSafeFreeList container may not be released on shutdown. This change ensures that the container is fully destructed on final shutdown. Authored by Apple: Michael Parkin-White Pull Request: https://projects.blender.org/blender/blender/pulls/114532
This commit is contained in:
committed by
Jeroen Bakker
parent
967e36cf68
commit
bbb71f0859
@@ -70,10 +70,17 @@ void MTLBufferPool::free()
|
|||||||
delete completed_safelist_queue_[safe_pool_free_index];
|
delete completed_safelist_queue_[safe_pool_free_index];
|
||||||
}
|
}
|
||||||
completed_safelist_queue_.clear();
|
completed_safelist_queue_.clear();
|
||||||
|
|
||||||
|
safelist_lock_.lock();
|
||||||
if (current_free_list_ != nullptr) {
|
if (current_free_list_ != nullptr) {
|
||||||
delete current_free_list_;
|
delete current_free_list_;
|
||||||
current_free_list_ = nullptr;
|
current_free_list_ = nullptr;
|
||||||
}
|
}
|
||||||
|
if (prev_free_buffer_list_ != nullptr) {
|
||||||
|
delete prev_free_buffer_list_;
|
||||||
|
prev_free_buffer_list_ = nullptr;
|
||||||
|
}
|
||||||
|
safelist_lock_.unlock();
|
||||||
|
|
||||||
/* Clear and release memory pools. */
|
/* Clear and release memory pools. */
|
||||||
for (std::multiset<blender::gpu::MTLBufferHandle, blender::gpu::CompareMTLBuffer> *buffer_pool :
|
for (std::multiset<blender::gpu::MTLBufferHandle, blender::gpu::CompareMTLBuffer> *buffer_pool :
|
||||||
|
|||||||
Reference in New Issue
Block a user