|
Blender V4.5
|
#include <mtl_storage_buffer.hh>
Inherits blender::gpu::StorageBuf.
Public Member Functions | |
| void | sync_as_indirect_buffer () override |
| const char * | get_name () |
Creation & Deletion | |
| MTLStorageBuf (size_t size, GPUUsageType usage, const char *name) | |
| ~MTLStorageBuf () override | |
| MTLStorageBuf (MTLUniformBuf *uniform_buf, size_t size) | |
| MTLStorageBuf (MTLVertBuf *vert_buf, size_t size) | |
| MTLStorageBuf (MTLIndexBuf *index_buf, size_t size) | |
| MTLStorageBuf (MTLTexture *texture, size_t size) | |
| MTLStorageBuf (size_t size) | |
Data upload / update | |
| void | update (const void *data) override |
| void | init () |
Usage | |
| void | bind (int slot) override |
| void | unbind () override |
| void | clear (uint32_t clear_value) override |
| void | copy_sub (VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override |
| void | read (void *data) override |
| void | async_flush_to_host () override |
| id< MTLBuffer > | get_metal_buffer () |
| size_t | get_size () |
| Public Member Functions inherited from blender::gpu::StorageBuf | |
| StorageBuf (size_t size, const char *name) | |
| virtual | ~StorageBuf () |
Additional Inherited Members | |
| Protected Attributes inherited from blender::gpu::StorageBuf | |
| size_t | size_in_bytes_ |
| void * | data_ = nullptr |
| char | name_ [DEBUG_NAME_LEN] |
Implementation of Storage Buffers using Metal.
Definition at line 26 of file mtl_storage_buffer.hh.
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | size_t | size, |
| GPUUsageType | usage, | ||
| const char * | name ) |
Definition at line 39 of file mtl_storage_buffer.mm.
References blender::gpu::StorageBuf::StorageBuf().
Referenced by blender::gpu::MTLIndexBuf::bind_as_ssbo(), blender::gpu::MTLUniformBuf::bind_as_ssbo(), blender::gpu::MTLVertBuf::bind_as_ssbo(), copy_sub(), blender::gpu::MTLTexture::get_storagebuf(), and blender::gpu::MTLBackend::storagebuf_alloc().
|
override |
Definition at line 84 of file mtl_storage_buffer.mm.
References blender::gpu::MTLStorageBufferBinding::bound, blender::gpu::MTLContext::get(), i, MTL_MAX_BUFFER_BINDINGS, blender::gpu::MTLContext::pipeline_state, blender::gpu::MTLStorageBufferBinding::ssbo, and blender::gpu::MTLContextGlobalShaderPipelineState::ssbo_bindings.
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | MTLUniformBuf * | uniform_buf, |
| size_t | size ) |
Definition at line 48 of file mtl_storage_buffer.mm.
References BLI_assert, GPU_USAGE_DYNAMIC, and blender::gpu::StorageBuf::StorageBuf().
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | MTLVertBuf * | vert_buf, |
| size_t | size ) |
Definition at line 57 of file mtl_storage_buffer.mm.
References BLI_assert, GPU_USAGE_DYNAMIC, and blender::gpu::StorageBuf::StorageBuf().
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | MTLIndexBuf * | index_buf, |
| size_t | size ) |
Definition at line 66 of file mtl_storage_buffer.mm.
References BLI_assert, GPU_USAGE_DYNAMIC, and blender::gpu::StorageBuf::StorageBuf().
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | MTLTexture * | texture, |
| size_t | size ) |
Definition at line 75 of file mtl_storage_buffer.mm.
References BLI_assert, GPU_USAGE_DYNAMIC, blender::gpu::StorageBuf::StorageBuf(), and texture().
| blender::gpu::MTLStorageBuf::MTLStorageBuf | ( | size_t | size | ) |
Definition at line 32 of file mtl_storage_buffer.mm.
References blender::gpu::MTLBufferPool::allocate_aligned(), blender::gpu::MTLContext::get_global_memory_manager(), GPU_USAGE_STREAM, and blender::gpu::StorageBuf::StorageBuf().
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 353 of file mtl_storage_buffer.mm.
References BLI_assert, BLI_assert_msg, blender::gpu::MTLContext::device, blender::gpu::MTLCommandBufferManager::encode_signal_event(), blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLContext::get(), GPU_flush(), GPU_USAGE_DEVICE_ONLY, init(), and blender::gpu::MTLContext::main_command_buffer.
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 221 of file mtl_storage_buffer.mm.
References BLI_assert, blender::gpu::MTLStorageBufferBinding::bound, blender::gpu::StorageBuf::data_, blender::gpu::MTLContext::get(), init(), MEM_SAFE_FREE, MTL_MAX_BUFFER_BINDINGS, blender::gpu::StorageBuf::name_, blender::gpu::MTLContext::pipeline_state, blender::gpu::MTLStorageBufferBinding::ssbo, blender::gpu::MTLContextGlobalShaderPipelineState::ssbo_bindings, and update().
Referenced by blender::gpu::MTLScratchBufferManager::bind_as_ssbo(), blender::gpu::MTLContext::ensure_texture_bindings(), and blender::gpu::MTLContext::ensure_texture_bindings().
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 281 of file mtl_storage_buffer.mm.
References blender::gpu::MTLComputeState::bind_compute_buffer(), blender::gpu::MTLComputeState::bind_compute_bytes(), blender::gpu::MTLComputeState::bind_pso(), BLI_assert_msg, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLCommandBufferManager::ensure_begin_compute_encoder(), blender::gpu::MTLContext::get(), blender::gpu::MTLContextComputeUtils::get_buffer_clear_pso(), blender::gpu::MTLCommandBufferManager::get_compute_state(), blender::gpu::MTLContext::get_compute_utils(), init(), blender::gpu::MTLContext::main_command_buffer, and blender::gpu::StorageBuf::size_in_bytes_.
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 320 of file mtl_storage_buffer.mm.
References blender::gpu::MTLVertBuf::bind(), BLI_assert, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLContext::get(), blender::gpu::MTLBuffer::get_metal_buffer(), get_metal_buffer(), init(), blender::gpu::MTLContext::main_command_buffer, and MTLStorageBuf().
| id< MTLBuffer > blender::gpu::MTLStorageBuf::get_metal_buffer | ( | ) |
Definition at line 471 of file mtl_storage_buffer.mm.
References BLI_assert, BLI_assert_msg, blender::gpu::StorageBuf::data_, blender::gpu::MTLBuffer::debug_ensure_used(), blender::gpu::MTLBuffer::get_metal_buffer(), and UNUSED_VARS_NDEBUG.
Referenced by blender::gpu::MTLContext::compute_dispatch_indirect(), copy_sub(), blender::gpu::MTLContext::ensure_buffer_bindings(), and blender::gpu::MTLContext::ensure_buffer_bindings().
|
inline |
Definition at line 90 of file mtl_storage_buffer.hh.
References blender::gpu::StorageBuf::name_.
| size_t blender::gpu::MTLStorageBuf::get_size | ( | ) |
Definition at line 520 of file mtl_storage_buffer.mm.
References BLI_assert, and blender::gpu::StorageBuf::size_in_bytes_.
Referenced by blender::gpu::MTLContext::ensure_buffer_bindings(), blender::gpu::MTLContext::ensure_buffer_bindings(), and update().
| void blender::gpu::MTLStorageBuf::init | ( | ) |
Definition at line 120 of file mtl_storage_buffer.mm.
References blender::gpu::MTLBufferPool::allocate(), BLI_assert, blender::gpu::MTLContext::device, blender::gpu::MTLContext::get(), blender::gpu::MTLContext::get_global_memory_manager(), GPU_USAGE_DEVICE_ONLY, blender::gpu::StorageBuf::name_, blender::gpu::MTLBuffer::set_label(), blender::gpu::StorageBuf::size_in_bytes_, and UNUSED_VARS_NDEBUG.
Referenced by async_flush_to_host(), bind(), clear(), copy_sub(), read(), and update().
|
overridevirtual |
Read storage buffer contents via staging buffer.
Direct storage buffer read.
Implements blender::gpu::StorageBuf.
Definition at line 387 of file mtl_storage_buffer.mm.
References blender::gpu::MTLBufferPool::allocate(), BLI_assert, BLI_time_sleep_ms(), data, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLBuffer::free(), blender::gpu::MTLContext::get(), blender::gpu::MTLContext::get_global_memory_manager(), blender::gpu::MTLBuffer::get_host_ptr(), blender::gpu::MTLBuffer::get_metal_buffer(), GPU_finish(), GPU_USAGE_DEVICE_ONLY, init(), blender::gpu::MTLContext::main_command_buffer, MTL_LOG_WARNING, and blender::gpu::StorageBuf::size_in_bytes_.
|
inlineoverridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 84 of file mtl_storage_buffer.hh.
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 255 of file mtl_storage_buffer.mm.
References blender::gpu::MTLStorageBufferBinding::bound, G, G_DEBUG_GPU, and blender::gpu::MTLStorageBufferBinding::ssbo.
Referenced by blender::gpu::MTLScratchBufferManager::unbind_as_ssbo(), and blender::gpu::MTLContext::~MTLContext().
|
overridevirtual |
Implements blender::gpu::StorageBuf.
Definition at line 147 of file mtl_storage_buffer.mm.
References blender::gpu::MTLBufferPool::allocate(), BLI_assert, data, blender::gpu::MTLCommandBufferManager::ensure_begin_blit_encoder(), blender::gpu::MTLBuffer::flush_range(), blender::gpu::MTLBuffer::free(), blender::gpu::MTLContext::get(), blender::gpu::MTLContext::get_global_memory_manager(), blender::gpu::MTLBuffer::get_host_ptr(), blender::gpu::MTLBuffer::get_metal_buffer(), get_size(), GPU_USAGE_DEVICE_ONLY, init(), length(), blender::gpu::MTLContext::main_command_buffer, and blender::gpu::StorageBuf::size_in_bytes_.
Referenced by bind().