|
Blender V5.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 () |
| bool | has_completed_safe_lists () |
| MTLSafeFreeList * | get_current_safe_list () |
| MTLSafeFreeList * | acquire_current_safe_list () |
| void | begin_new_safe_list (bool only_if_should_flush=false) |
| void | push_completed_safe_list (MTLSafeFreeList *list) |
Definition at line 375 of file mtl_memory.hh.
| blender::gpu::MTLBufferPool::~MTLBufferPool | ( | ) |
Definition at line 66 of file mtl_memory.mm.
| MTLSafeFreeList * blender::gpu::MTLBufferPool::acquire_current_safe_list | ( | ) |
Definition at line 454 of file mtl_memory.mm.
References get_current_safe_list(), and lock.
Referenced by blender::gpu::present().
| gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate | ( | uint64_t | size, |
| bool | cpu_visible ) |
Definition at line 108 of file mtl_memory.mm.
References allocate_aligned().
Referenced by blender::gpu::MTLVertBuf::bind(), blender::gpu::bind_sampler_argument_buffer(), blender::gpu::MTLBottomLevelAS::build(), blender::gpu::MTLTopLevelAS::build(), blender::gpu::MTLIndexBuf::get_index_buffer(), blender::gpu::MTLStorageBuf::init(), blender::gpu::MTLStorageBuf::read(), blender::gpu::MTLVertBuf::read(), blender::gpu::MTLStorageBuf::update(), blender::gpu::MTLUniformBuf::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 124 of file mtl_memory.mm.
References blender::BLI_assert(), blender::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(), MTL_LOG_DEBUG, options, blender::result, and blender::gpu::MTLBuffer::set_usage_size().
Referenced by allocate(), allocate_aligned_with_data(), and blender::gpu::MTLStorageBuf::MTLStorageBuf().
| gpu::MTLBuffer * blender::gpu::MTLBufferPool::allocate_aligned_with_data | ( | uint64_t | size, |
| uint | alignment, | ||
| bool | cpu_visible, | ||
| const void * | data = nullptr ) |
Definition at line 225 of file mtl_memory.mm.
References allocate_aligned(), blender::BLI_assert(), blender::data, blender::gpu::MTLBuffer::flush_range(), blender::gpu::MTLBuffer::get_host_ptr(), blender::gpu::MTLBuffer::get_metal_buffer(), blender::gpu::MTLBuffer::get_resource_options(), and length().
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 115 of file mtl_memory.mm.
References allocate_aligned_with_data(), and blender::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 | ( | bool | only_if_should_flush = false | ) |
Definition at line 469 of file mtl_memory.mm.
References blender::gpu::MTLSafeFreeList::decrement_reference(), get_current_safe_list(), blender::gpu::MTLSafeFreeList::MTLSafeFreeList(), and blender::gpu::MTLSafeFreeList::should_flush().
Referenced by init(), blender::gpu::MTLBackend::render_end(), and blender::gpu::MTLBackend::render_step().
| bool blender::gpu::MTLBufferPool::free_buffer | ( | gpu::MTLBuffer * | buffer | ) |
Definition at line 242 of file mtl_memory.mm.
References blender::BLI_assert(), blender::gpu::MTLSafeFreeList::decrement_reference(), 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 448 of file mtl_memory.mm.
Referenced by acquire_current_safe_list(), begin_new_safe_list(), and free_buffer().
| bool blender::gpu::MTLBufferPool::has_completed_safe_lists | ( | ) |
Definition at line 463 of file mtl_memory.mm.
References lock.
Referenced by blender::gpu::MTLBackend::render_end().
| void blender::gpu::MTLBufferPool::init | ( | id< MTLDevice > | device | ) |
Definition at line 40 of file mtl_memory.mm.
References begin_new_safe_list(), and blender::BLI_assert().
Referenced by blender::gpu::MTLContext::MTLContext().
| void blender::gpu::MTLBufferPool::push_completed_safe_list | ( | MTLSafeFreeList * | list | ) |
Definition at line 429 of file mtl_memory.mm.
References blender::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 271 of file mtl_memory.mm.
References blender::BLI_assert(), blender::gpu::MTLBufferHandle::buffer, blender::gpu::MTLBufferHandle::buffer_size, CLOG_DEBUG, blender::gpu::MTLBuffer::get_in_use(), blender::gpu::MTLBuffer::get_resource_options(), blender::gpu::MTLBufferHandle::insert_time, blender::gpu::LOG, MEMORY_SIZE_1GB, MEMORY_SIZE_256MB, MEMORY_SIZE_2GB, MEMORY_SIZE_512MB, and blender::min_ii().
Referenced by blender::gpu::MTLBackend::render_end(), and blender::gpu::MTLBackend::render_step().