|
Blender V4.3
|
#include <mtl_memory.hh>
Public Member Functions | |
| void | flag_in_queue () |
| MEM_CXX_CLASS_ALLOC_FUNCS ("MTLSafeFreeList") | |
Memory Management - MTLBufferPool and MTLSafeFreeList implementations | |
| MTLSafeFreeList () | |
| void | insert_buffer (gpu::MTLBuffer *buffer) |
| bool | should_flush () |
| void | increment_reference () |
| void | decrement_reference () |
Friends | |
| class | MTLBufferPool |
An MTLSafeFreeList is a temporary list of #gpu::MTLBuffers which have been freed by the high level backend, but are pending GPU work execution before the #gpu::MTLBuffers can be returned to the Memory manager pools. This list is implemented as a chunked linked-list.
Only a single MTLSafeFreeList is active at one time and is associated with current command buffer submissions. If an #MTLBuffer is freed during the lifetime of a command buffer, it could still possibly be in-use and as such, the MTLSafeFreeList will increment its reference count for each command buffer submitted while the current pool is active.
A new MTLSafeFreeList will begin each render step (frame). This pooling of buffers, rather than individual buffer resource tracking reduces performance overhead.
NOTE: the Metal API independently tracks resources used by command buffers for the purpose of keeping resources alive while in-use by the driver and CPU, however, this differs from the MTLSafeFreeList mechanism in the Metal backend, which exists for the purpose of allowing previously allocated #MTLBuffer resources to be re-used. This allows us to save on the expensive cost of memory allocation.
Definition at line 296 of file mtl_memory.hh.
| blender::gpu::MTLSafeFreeList::MTLSafeFreeList | ( | ) |
Definition at line 561 of file mtl_memory.mm.
Referenced by insert_buffer().
| void blender::gpu::MTLSafeFreeList::decrement_reference | ( | ) |
Definition at line 616 of file mtl_memory.mm.
References BLI_assert, blender::gpu::MTLContext::get_global_memory_manager(), and blender::gpu::MTLBufferPool::push_completed_safe_list().
Referenced by blender::gpu::MTLBufferPool::begin_new_safe_list(), blender::gpu::present(), and blender::gpu::MTLCommandBufferManager::submit().
|
inline |
Definition at line 335 of file mtl_memory.hh.
References flag_in_queue().
Referenced by flag_in_queue(), and blender::gpu::MTLBufferPool::push_completed_safe_list().
| void blender::gpu::MTLSafeFreeList::increment_reference | ( | ) |
Definition at line 605 of file mtl_memory.mm.
References BLI_assert.
Referenced by blender::gpu::present(), and blender::gpu::MTLCommandBufferManager::submit().
| void blender::gpu::MTLSafeFreeList::insert_buffer | ( | gpu::MTLBuffer * | buffer | ) |
Definition at line 569 of file mtl_memory.mm.
References BLI_assert, insert_buffer(), lock, and MTLSafeFreeList().
Referenced by blender::gpu::MTLBufferPool::free_buffer(), and insert_buffer().
| blender::gpu::MTLSafeFreeList::MEM_CXX_CLASS_ALLOC_FUNCS | ( | "MTLSafeFreeList" | ) |
| bool blender::gpu::MTLSafeFreeList::should_flush | ( | ) |
Definition at line 628 of file mtl_memory.mm.
Referenced by blender::gpu::MTLBackend::render_step().
|
friend |
Definition at line 297 of file mtl_memory.hh.