Blender
V3.3
|
#include <mtl_memory.hh>
Memory Management - MTLBufferPool and MTLSafeFreeList implementations. | |
void | init (id< MTLDevice > device) |
~MTLBufferPool () | |
gpu::MTLBuffer * | allocate (uint64_t size, bool cpu_visible) |
gpu::MTLBuffer * | allocate_aligned (uint64_t size, uint alignment, bool cpu_visible) |
gpu::MTLBuffer * | allocate_with_data (uint64_t size, bool cpu_visible, const void *data=nullptr) |
gpu::MTLBuffer * | allocate_aligned_with_data (uint64_t size, uint alignment, bool cpu_visible, const void *data=nullptr) |
bool | free_buffer (gpu::MTLBuffer *buffer) |
void | update_memory_pools () |
MTLSafeFreeList * | get_current_safe_list () |
void | begin_new_safe_list () |
void | push_completed_safe_list (MTLSafeFreeList *list) |
Definition at line 339 of file mtl_memory.hh.
blender::gpu::MTLBufferPool::~MTLBufferPool | ( | ) |
Definition at line 39 of file mtl_memory.mm.
gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate | ( | uint64_t | size, |
bool | cpu_visible | ||
) |
Definition at line 60 of file mtl_memory.mm.
References allocate_aligned().
gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate_aligned | ( | uint64_t | size, |
uint | alignment, | ||
bool | cpu_visible | ||
) |
Definition at line 76 of file mtl_memory.mm.
References BLI_assert, ceil_to_multiple_ul(), blender::gpu::MTLBuffer::flag_in_use(), blender::gpu::MTLBuffer::get_in_use(), blender::gpu::MTLBuffer::get_metal_buffer(), blender::gpu::MTLBuffer::get_size(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr(), MTL_LOG_INFO, options, blender::compositor::pool, result, blender::gpu::MTLBuffer::set_usage_size(), and size().
Referenced by allocate(), and allocate_aligned_with_data().
gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate_aligned_with_data | ( | uint64_t | size, |
uint | alignment, | ||
bool | cpu_visible, | ||
const void * | data = nullptr |
||
) |
Definition at line 169 of file mtl_memory.mm.
References allocate_aligned(), BLI_assert, data, blender::gpu::MTLBuffer::flush_range(), blender::gpu::MTLBuffer::get_host_ptr(), blender::gpu::MTLBuffer::get_metal_buffer(), blender::gpu::MTLBuffer::get_resource_options(), blender::math::length(), and size().
Referenced by allocate_with_data().
gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate_with_data | ( | uint64_t | size, |
bool | cpu_visible, | ||
const void * | data = nullptr |
||
) |
Definition at line 67 of file mtl_memory.mm.
References allocate_aligned_with_data(), and data.
Referenced by blender::gpu::MTLUniformBuf::update().
void blender::gpu::MTLBufferPool::begin_new_safe_list | ( | ) |
Definition at line 331 of file mtl_memory.mm.
Referenced by init(), and blender::gpu::MTLBackend::render_step().
bool blender::gpu::MTLBufferPool::free_buffer | ( | gpu::MTLBuffer * | buffer | ) |
Definition at line 186 of file mtl_memory.mm.
References BLI_assert, buffer, get_current_safe_list(), and blender::gpu::MTLSafeFreeList::insert_buffer().
Referenced by blender::gpu::MTLBuffer::free().
MTLSafeFreeList * blender::gpu::MTLBufferPool::get_current_safe_list | ( | ) |
Definition at line 325 of file mtl_memory.mm.
Referenced by free_buffer(), blender::gpu::MTLBackend::render_step(), and blender::gpu::MTLCommandBufferManager::submit().
Definition at line 19 of file mtl_memory.mm.
References begin_new_safe_list(), and BLI_assert.
Referenced by blender::gpu::MTLContext::MTLContext().
void blender::gpu::MTLBufferPool::push_completed_safe_list | ( | MTLSafeFreeList * | list | ) |
Definition at line 306 of file mtl_memory.mm.
References BLI_assert, and blender::gpu::MTLSafeFreeList::flag_in_queue().
Referenced by blender::gpu::MTLSafeFreeList::decrement_reference().
void blender::gpu::MTLBufferPool::update_memory_pools | ( | ) |
Definition at line 206 of file mtl_memory.mm.
References BLI_assert, counter, blender::gpu::MTLBuffer::get_in_use(), blender::gpu::MTLBuffer::get_resource_options(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::keys(), min_ii(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), size(), and blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values().
Referenced by blender::gpu::MTLBackend::render_step().