|
Blender V4.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 363 of file mtl_memory.hh.
| blender::gpu::MTLBufferPool::~MTLBufferPool | ( | ) |
Definition at line 54 of file mtl_memory.mm.
| gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate | ( | uint64_t | size, |
| bool | cpu_visible ) |
Definition at line 96 of file mtl_memory.mm.
References allocate_aligned().
Referenced by blender::gpu::MTLVertBuf::bind(), blender::gpu::MTLVertBuf::duplicate_data(), blender::gpu::MTLContext::ensure_texture_bindings(), blender::gpu::MTLContext::ensure_texture_bindings(), blender::gpu::MTLIndexBuf::get_index_buffer(), blender::gpu::MTLStorageBuf::init(), blender::gpu::MTLStorageBuf::read(), blender::gpu::MTLVertBuf::read(), blender::gpu::MTLStorageBuf::update(), and blender::gpu::MTLIndexBuf::upload_data().
| gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate_aligned | ( | uint64_t | size, |
| uint | alignment, | ||
| bool | cpu_visible ) |
Definition at line 112 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, and blender::gpu::MTLBuffer::set_usage_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 213 of file mtl_memory.mm.
References allocate_aligned(), BLI_assert, blender::gpu::MTLBuffer::flush_range(), blender::gpu::MTLBuffer::get_host_ptr(), blender::gpu::MTLBuffer::get_metal_buffer(), blender::gpu::MTLBuffer::get_resource_options(), 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 103 of file mtl_memory.mm.
References allocate_aligned_with_data().
Referenced by blender::gpu::MTLUniformBuf::update(), blender::gpu::MTLTexture::update_sub(), and blender::gpu::MTLIndexBuf::upload_data().
| void blender::gpu::MTLBufferPool::begin_new_safe_list | ( | ) |
Definition at line 431 of file mtl_memory.mm.
References blender::gpu::MTLSafeFreeList::decrement_reference(), and get_current_safe_list().
Referenced by init(), and blender::gpu::MTLBackend::render_step().
| bool blender::gpu::MTLBufferPool::free_buffer | ( | gpu::MTLBuffer * | buffer | ) |
Definition at line 230 of file mtl_memory.mm.
References BLI_assert, blender::gpu::MTLBuffer::flag_in_use(), get_current_safe_list(), blender::gpu::MTLBuffer::get_in_use(), and blender::gpu::MTLSafeFreeList::insert_buffer().
Referenced by blender::gpu::MTLBuffer::free().
| MTLSafeFreeList * blender::gpu::MTLBufferPool::get_current_safe_list | ( | ) |
Definition at line 425 of file mtl_memory.mm.
Referenced by begin_new_safe_list(), free_buffer(), blender::gpu::present(), blender::gpu::MTLBackend::render_step(), and blender::gpu::MTLCommandBufferManager::submit().
| void blender::gpu::MTLBufferPool::init | ( | id< MTLDevice > | device | ) |
Definition at line 28 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 406 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 250 of file mtl_memory.mm.
References BLI_assert, blender::gpu::MTLBuffer::get_in_use(), blender::gpu::MTLBuffer::get_resource_options(), blender::gpu::MTLBufferHandle::insert_time, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::items(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::keys(), MEMORY_SIZE_1GB, MEMORY_SIZE_256MB, MEMORY_SIZE_2GB, MEMORY_SIZE_512MB, min_ii(), printf, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), and blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values().
Referenced by blender::gpu::MTLBackend::render_step().