From 148dcb395401b6b11a5a56b03c449e9852e5e876 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jul 2022 15:16:24 +1000 Subject: Cleanup: spelling in comments --- source/blender/gpu/metal/mtl_backend.mm | 2 +- source/blender/gpu/metal/mtl_common.hh | 2 +- source/blender/gpu/metal/mtl_context.mm | 4 ++-- source/blender/gpu/metal/mtl_memory.hh | 19 ++++++++++--------- source/blender/gpu/metal/mtl_memory.mm | 6 +++--- 5 files changed, 17 insertions(+), 16 deletions(-) (limited to 'source/blender/gpu/metal') diff --git a/source/blender/gpu/metal/mtl_backend.mm b/source/blender/gpu/metal/mtl_backend.mm index 117b8352a0a..d2524cc16e3 100644 --- a/source/blender/gpu/metal/mtl_backend.mm +++ b/source/blender/gpu/metal/mtl_backend.mm @@ -127,7 +127,7 @@ void MTLBackend::render_end() void MTLBackend::render_step() { - /* NOTE(Metal): Primarily called from main thread, but below datastructures + /* NOTE(Metal): Primarily called from main thread, but below data-structures * and operations are thread-safe, and GPUContext rendering coordination * is also thread-safe. */ diff --git a/source/blender/gpu/metal/mtl_common.hh b/source/blender/gpu/metal/mtl_common.hh index 28404d91b4b..44ba786f90f 100644 --- a/source/blender/gpu/metal/mtl_common.hh +++ b/source/blender/gpu/metal/mtl_common.hh @@ -10,7 +10,7 @@ #define MTL_MAX_COMMAND_BUFFERS 64 /* Number of frames for which we retain in-flight resources such as scratch buffers. - * Set as number of GPU frames in flight, plus an additioanl value for extra possible CPU frame. */ + * Set as number of GPU frames in flight, plus an additional value for extra possible CPU frame. */ #define MTL_NUM_SAFE_FRAMES (MTL_MAX_DRAWABLES + 1) #endif diff --git a/source/blender/gpu/metal/mtl_context.mm b/source/blender/gpu/metal/mtl_context.mm index 2cf70718b76..2ab2e20158a 100644 --- a/source/blender/gpu/metal/mtl_context.mm +++ b/source/blender/gpu/metal/mtl_context.mm @@ -16,7 +16,7 @@ using namespace blender::gpu; namespace blender::gpu { -/* Global memory mamnager */ +/* Global memory manager. */ MTLBufferPool MTLContext::global_memory_manager; /* -------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ MTLContext::MTLContext(void *ghost_window) : memory_manager(*this), main_command this->memory_manager.init(); this->state_manager = new MTLStateManager(this); - /* Ensure global memory manager is initialied */ + /* Ensure global memory manager is initialized. */ MTLContext::global_memory_manager.init(this->device); /* Initialize texture read/update structures. */ diff --git a/source/blender/gpu/metal/mtl_memory.hh b/source/blender/gpu/metal/mtl_memory.hh index 81793b0647c..4dbc1b29c6b 100644 --- a/source/blender/gpu/metal/mtl_memory.hh +++ b/source/blender/gpu/metal/mtl_memory.hh @@ -23,7 +23,7 @@ * The Metal Backend Memory manager is designed to provide an interface * for all other MTL_* modules where memory allocation is required. * - * Different allocation strategies and datastructures are used depending + * Different allocation strategies and data-structures are used depending * on how the data is used by the backend. These aim to optimally handle * system memory and abstract away any complexity from the MTL_* modules * themselves. @@ -107,8 +107,8 @@ class MTLBuffer { /* Metal resource. */ id metal_buffer_; - /* Host-visible mapped-memory pointer. Behaviour depends on buffer type: - * - Shared buffers: pointer represents base address of MTLBuffer whose data + /* Host-visible mapped-memory pointer. Behavior depends on buffer type: + * - Shared buffers: pointer represents base address of #MTLBuffer whose data * access has shared access by both the CPU and GPU on * Unified Memory Architectures (UMA). * - Managed buffer: Host-side mapped buffer region for CPU (Host) access. Managed buffers @@ -350,14 +350,14 @@ class MTLBufferPool { bool ensure_initialised_ = false; id device_ = nil; - /* The buffer selection aims to pick a buffer which meets the minimum size requierments. + /* The buffer selection aims to pick a buffer which meets the minimum size requirements. * To do this, we keep an ordered set of all available buffers. If the buffer is larger than the - * desired allocation size, we check it aginst `mtl_buffer_size_threshold_factor_`, which defines - * what % larger than the original allocation the buffer can be. + * desired allocation size, we check it against `mtl_buffer_size_threshold_factor_`, + * which defines what % larger than the original allocation the buffer can be. * - A higher value results in greater re-use of previously allocated buffers of similar sizes. - * - A lower value may result in more dynamic allocations, but minimised memory usage for a given + * - A lower value may result in more dynamic allocations, but minimized memory usage for a given * scenario. - * The current value of 1.26 is calibrated for optimal performance and memory utilisation. */ + * The current value of 1.26 is calibrated for optimal performance and memory utilization. */ static constexpr float mtl_buffer_size_threshold_factor_ = 1.26; /* Buffer pools using MTLResourceOptions as key for allocation type. @@ -453,7 +453,8 @@ class MTLScratchBufferManager { MTLScratchBufferManager(MTLContext &context) : context_(context){}; ~MTLScratchBufferManager(); - /* Explicit initialisation and freeing of resources. Init must occur after device creation. */ + /* Explicit initialization and freeing of resources. + * Initialization must occur after device creation. */ void init(); void free(); diff --git a/source/blender/gpu/metal/mtl_memory.mm b/source/blender/gpu/metal/mtl_memory.mm index 5c5938997e6..6316a49407d 100644 --- a/source/blender/gpu/metal/mtl_memory.mm +++ b/source/blender/gpu/metal/mtl_memory.mm @@ -58,7 +58,7 @@ void MTLBufferPool::free() gpu::MTLBuffer *MTLBufferPool::allocate_buffer(uint64_t size, bool cpu_visible, const void *bytes) { - /* Allocate buffer with default HW-compatible alignemnt of 256 bytes. + /* Allocate buffer with default HW-compatible alignment of 256 bytes. * See https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf for more. */ return this->allocate_buffer_aligned(size, 256, cpu_visible, bytes); } @@ -342,7 +342,7 @@ void MTLBufferPool::insert_buffer_into_pool(MTLResourceOptions options, gpu::MTL /* Ensure pool exists. */ this->ensure_buffer_pool(options); - /* TODO(Metal): Support purgability - Allow buffer in pool to have its memory taken back by the + /* TODO(Metal): Support purgeability - Allow buffer in pool to have its memory taken back by the * OS if needed. As we keep allocations around, they may not actually be in use, but we can * ensure they do not block other apps from using memory. Upon a buffer being needed again, we * can reset this state. @@ -615,7 +615,7 @@ void MTLScratchBufferManager::init() if (!this->initialised_) { BLI_assert(context_.device); - /* Initialise Scratch buffers */ + /* Initialize Scratch buffers. */ for (int sb = 0; sb < mtl_max_scratch_buffers_; sb++) { scratch_buffers_[sb] = new MTLCircularBuffer( context_, mtl_scratch_buffer_initial_size_, true); -- cgit v1.2.3