Cleanup: spelling in comments
This commit is contained in:
parent
c0e4532331
commit
45645936e9
|
@ -278,7 +278,7 @@ struct input_t {
|
|||
*/
|
||||
struct xkb_state *xkb_state_empty = nullptr;
|
||||
/**
|
||||
* Keep a state with num-lock enabled, use to access predictable key-pad symbols.
|
||||
* Keep a state with number-lock enabled, use to access predictable key-pad symbols.
|
||||
* If number-lock is not supported by the key-map, this is set to NULL.
|
||||
*/
|
||||
struct xkb_state *xkb_state_empty_with_numlock = nullptr;
|
||||
|
|
|
@ -66,19 +66,19 @@ typedef struct GPULoadStore {
|
|||
/* Load store config array (load_store_actions) matches attachment structure of
|
||||
* GPU_framebuffer_config_array. This allows us to explicitly specify whether attachment data needs
|
||||
* to be loaded and stored on a per-attachment basis. This enables a number of bandwidth
|
||||
* optimisations:
|
||||
* optimizations:
|
||||
* - No need to load contents if subsequent work is over-writing every pixel.
|
||||
* - No need to store attachments whose contents are not used beyond this pass e.g. depth buffer.
|
||||
* - State can be customised at bind-time rather than applying to the framebuffer object as a
|
||||
* - State can be customized at bind-time rather than applying to the frame-buffer object as a
|
||||
* whole.
|
||||
*
|
||||
* Example:
|
||||
* \code{.c}
|
||||
* GPU_framebuffer_bind_loadstore(&fb, {
|
||||
* {GPU_LOADACTION_LOAD, GPU_STOREACTION_DONT_CARE} // must be depth buffer
|
||||
* {GPU_LOADACTION_LOAD, GPU_STOREACTION_STORE}, // Colour attachment 0
|
||||
* {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE}, // Colour attachment 1
|
||||
* {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE} // Colour attachment 2
|
||||
* {GPU_LOADACTION_LOAD, GPU_STOREACTION_STORE}, // Color attachment 0
|
||||
* {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE}, // Color attachment 1
|
||||
* {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE} // Color attachment 2
|
||||
* })
|
||||
* \encode
|
||||
*/
|
||||
|
|
|
@ -191,7 +191,7 @@ void FrameBuffer::recursive_downsample(int max_lvl,
|
|||
dirty_attachments_ = true;
|
||||
this->bind(true);
|
||||
|
||||
/* Optimise load-store state. */
|
||||
/* Optimize load-store state. */
|
||||
GPUAttachmentType type = GPU_FB_DEPTH_ATTACHMENT;
|
||||
for (GPUAttachment &attachment : attachments_) {
|
||||
Texture *tex = reinterpret_cast<Texture *>(attachment.tex);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace blender::gpu {
|
|||
|
||||
/* Global sync event used across MTLContext's.
|
||||
* This resolves flickering artifacts from command buffer
|
||||
* dependencies not being honoured for work submitted between
|
||||
* dependencies not being honored for work submitted between
|
||||
* different GPUContext's. */
|
||||
id<MTLEvent> MTLCommandBufferManager::sync_event = nil;
|
||||
unsigned long long MTLCommandBufferManager::event_signal_val = 0;
|
||||
|
@ -305,7 +305,7 @@ id<MTLRenderCommandEncoder> MTLCommandBufferManager::ensure_begin_render_command
|
|||
active_frame_buffer_->apply_state();
|
||||
|
||||
/* FLAG FRAMEBUFFER AS CLEARED -- A clear only lasts as long as one has been specified.
|
||||
* After this, resets to Load attachments to parallel GL behaviour. */
|
||||
* After this, resets to Load attachments to parallel GL behavior. */
|
||||
active_frame_buffer_->mark_cleared();
|
||||
|
||||
/* Reset RenderPassState to ensure resource bindings are re-applied. */
|
||||
|
@ -404,7 +404,7 @@ bool MTLCommandBufferManager::do_break_submission()
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Use optimised heuristic to split heavy command buffer submissions to better saturate the
|
||||
/* Use optimized heuristic to split heavy command buffer submissions to better saturate the
|
||||
* hardware and also reduce stalling from individual large submissions. */
|
||||
if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY) ||
|
||||
GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
|
@ -440,12 +440,12 @@ void MTLCommandBufferManager::pop_debug_group()
|
|||
}
|
||||
}
|
||||
|
||||
/* Workload Synchronisation. */
|
||||
/* Workload Synchronization. */
|
||||
bool MTLCommandBufferManager::insert_memory_barrier(eGPUBarrier barrier_bits,
|
||||
eGPUStageBarrierBits before_stages,
|
||||
eGPUStageBarrierBits after_stages)
|
||||
{
|
||||
/* Only supporting Metal on 10.14 onwards anyway - Check required for warnings. */
|
||||
/* Only supporting Metal on 10.14 onward anyway - Check required for warnings. */
|
||||
if (@available(macOS 10.14, *)) {
|
||||
|
||||
/* Resolve scope. */
|
||||
|
@ -527,7 +527,7 @@ void MTLRenderPassState::prepare(MTLCommandBufferManager *cmd, MTLContext *mtl_c
|
|||
|
||||
/* Reset binding state when a new RenderCommandEncoder is bound, to ensure
|
||||
* pipeline resources are re-applied to the new Encoder.
|
||||
* Note: In Metal, state is only persistent within an MTLCommandEncoder,
|
||||
* NOTE: In Metal, state is only persistent within an MTLCommandEncoder,
|
||||
* not globally. */
|
||||
void MTLRenderPassState::reset_state()
|
||||
{
|
||||
|
|
|
@ -508,7 +508,7 @@ class MTLCommandBufferManager {
|
|||
MTLFrameBuffer *active_frame_buffer_ = nullptr;
|
||||
MTLRenderPassDescriptor *active_pass_descriptor_ = nullptr;
|
||||
|
||||
/* Workload heuristics - We may need to split command buffers to optimise workload and balancing.
|
||||
/* Workload heuristics - We may need to split command buffers to optimize workload and balancing.
|
||||
*/
|
||||
int current_draw_call_count_ = 0;
|
||||
int encoder_count_ = 0;
|
||||
|
@ -552,7 +552,7 @@ class MTLCommandBufferManager {
|
|||
id<MTLBlitCommandEncoder> ensure_begin_blit_encoder();
|
||||
id<MTLComputeCommandEncoder> ensure_begin_compute_encoder();
|
||||
|
||||
/* Workload Synchronisation. */
|
||||
/* Workload Synchronization. */
|
||||
bool insert_memory_barrier(eGPUBarrier barrier_bits,
|
||||
eGPUStageBarrierBits before_stages,
|
||||
eGPUStageBarrierBits after_stages);
|
||||
|
@ -634,13 +634,13 @@ class MTLContext : public Context {
|
|||
|
||||
/** Metal Context Core functions. **/
|
||||
|
||||
/* Bind framebuffer to context. */
|
||||
/* Bind frame-buffer to context. */
|
||||
void framebuffer_bind(MTLFrameBuffer *framebuffer);
|
||||
|
||||
/* Restore framebuffer used by active context to default backbuffer. */
|
||||
/* Restore frame-buffer used by active context to default back-buffer. */
|
||||
void framebuffer_restore();
|
||||
|
||||
/* Ensure a render-pass using the Context framebuffer (active_fb_) is in progress. */
|
||||
/* Ensure a render-pass using the Context frame-buffer (active_fb_) is in progress. */
|
||||
id<MTLRenderCommandEncoder> ensure_begin_render_pass();
|
||||
|
||||
MTLFrameBuffer *get_current_framebuffer();
|
||||
|
|
|
@ -49,7 +49,7 @@ MTLContext::MTLContext(void *ghost_window)
|
|||
/* Init debug. */
|
||||
debug::mtl_debug_init();
|
||||
|
||||
/* Initialise command buffer state. */
|
||||
/* Initialize command buffer state. */
|
||||
this->main_command_buffer.prepare(this);
|
||||
|
||||
/* Frame management. */
|
||||
|
@ -61,14 +61,14 @@ MTLContext::MTLContext(void *ghost_window)
|
|||
this->front_left = mtl_front_left;
|
||||
this->back_left = mtl_back_left;
|
||||
this->active_fb = this->back_left;
|
||||
/* Prepare platform and capabilities. (Note: With METAL, this needs to be done after CTX
|
||||
* initialisation). */
|
||||
/* Prepare platform and capabilities. (NOTE: With METAL, this needs to be done after CTX
|
||||
* initialization). */
|
||||
MTLBackend::platform_init(this);
|
||||
MTLBackend::capabilities_init(this);
|
||||
/* Initialize Metal modules. */
|
||||
this->state_manager = new MTLStateManager(this);
|
||||
|
||||
/* Initialise texture read/update structures. */
|
||||
/* Initialize texture read/update structures. */
|
||||
this->get_texture_utils().init();
|
||||
|
||||
/* Bound Samplers struct. */
|
||||
|
@ -77,7 +77,7 @@ MTLContext::MTLContext(void *ghost_window)
|
|||
samplers_.mtl_sampler_flags[i] = DEFAULT_SAMPLER_STATE;
|
||||
}
|
||||
|
||||
/* Initialise samplers. */
|
||||
/* Initialize samplers. */
|
||||
for (uint i = 0; i < GPU_SAMPLER_MAX; i++) {
|
||||
MTLSamplerState state;
|
||||
state.state = static_cast<eGPUSamplerState>(i);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** \file
|
||||
* \ingroup gpu
|
||||
*
|
||||
* Encapsulation of Framebuffer states (attached textures, viewport, scissors).
|
||||
* Encapsulation of Frame-buffer states (attached textures, viewport, scissors).
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -64,17 +64,17 @@ class MTLFrameBuffer : public FrameBuffer {
|
|||
MTLContext *dirty_state_ctx_;
|
||||
|
||||
/* Whether a clear is pending -- Used to toggle between clear and load FB configurations
|
||||
* (without dirtying the state) - Framebuffer load config is used if no GPU_clear_* command
|
||||
* (without dirtying the state) - Frame-buffer load config is used if no `GPU_clear_*` command
|
||||
* was issued after binding the FrameBuffer. */
|
||||
bool has_pending_clear_;
|
||||
|
||||
/* Render Pass Descriptors:
|
||||
* There are 3 MTLRenderPassDescriptors for different ways in which a framebuffer
|
||||
* There are 3 MTLRenderPassDescriptors for different ways in which a frame-buffer
|
||||
* can be configured:
|
||||
* [0] = CLEAR CONFIG -- Used when a GPU_framebuffer_clear_* command has been issued.
|
||||
* [1] = LOAD CONFIG -- Used if bound, but no clear is required.
|
||||
* [2] = CUSTOM CONFIG -- When using GPU_framebuffer_bind_ex to manually specify
|
||||
* load-store configuration for optimal bandwidth utilisation.
|
||||
* load-store configuration for optimal bandwidth utilization.
|
||||
* -- We cache these different configs to avoid re-generation --
|
||||
*/
|
||||
typedef enum {
|
||||
|
@ -91,7 +91,7 @@ class MTLFrameBuffer : public FrameBuffer {
|
|||
bool descriptor_dirty_[MTL_FB_CONFIG_MAX];
|
||||
/* Whether SRGB is enabled for this framebuffer configuration. */
|
||||
bool srgb_enabled_;
|
||||
/* Whether the primary Framebuffer attachment is an SRGB target or not. */
|
||||
/* Whether the primary Frame-buffer attachment is an SRGB target or not. */
|
||||
bool is_srgb_;
|
||||
|
||||
public:
|
||||
|
|
|
@ -59,7 +59,7 @@ MTLFrameBuffer::~MTLFrameBuffer()
|
|||
/* Restore default frame-buffer if this frame-buffer was bound. */
|
||||
if (context_->active_fb == this && context_->back_left != this) {
|
||||
/* If this assert triggers it means the frame-buffer is being freed while in use by another
|
||||
* context which, by the way, is TOTALLY UNSAFE!!! (Copy from GL behaviour). */
|
||||
* context which, by the way, is TOTALLY UNSAFE!!! (Copy from GL behavior). */
|
||||
BLI_assert(context_ == static_cast<MTLContext *>(unwrap(GPU_context_active_get())));
|
||||
GPU_framebuffer_restore();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ bool MTLFrameBuffer::check(char err_out[256])
|
|||
/* Ensure local MTLAttachment data is up to date. */
|
||||
this->update_attachments(true);
|
||||
|
||||
/* Ensure there is atleast one attachment. */
|
||||
/* Ensure there is at least one attachment. */
|
||||
bool valid = (this->get_attachment_count() > 0 ||
|
||||
this->has_depth_attachment() | this->has_stencil_attachment());
|
||||
if (!valid) {
|
||||
|
@ -144,7 +144,7 @@ bool MTLFrameBuffer::check(char err_out[256])
|
|||
}
|
||||
|
||||
/* Ensure all attachments have identical dimensions. */
|
||||
/* Ensure all attachments are rendertargets. */
|
||||
/* Ensure all attachments are render-targets. */
|
||||
bool first = true;
|
||||
uint dim_x = 0;
|
||||
uint dim_y = 0;
|
||||
|
@ -160,7 +160,7 @@ bool MTLFrameBuffer::check(char err_out[256])
|
|||
else {
|
||||
if (dim_x != att.texture->width_get() || dim_y != att.texture->height_get()) {
|
||||
const char *format =
|
||||
"Framebuffer %s:Colour attachment dimensions do not match those of previous "
|
||||
"Framebuffer %s: Color attachment dimensions do not match those of previous "
|
||||
"attachment\n";
|
||||
if (err_out) {
|
||||
BLI_snprintf(err_out, 256, format, name_);
|
||||
|
@ -175,7 +175,7 @@ bool MTLFrameBuffer::check(char err_out[256])
|
|||
}
|
||||
else {
|
||||
const char *format =
|
||||
"Framebuffer %s: Colour attachment texture does not have usage flag "
|
||||
"Framebuffer %s: Color attachment texture does not have usage flag "
|
||||
"'GPU_TEXTURE_USAGE_ATTACHMENT'\n";
|
||||
if (err_out) {
|
||||
BLI_snprintf(err_out, 256, format, name_);
|
||||
|
@ -276,7 +276,7 @@ void MTLFrameBuffer::force_clear()
|
|||
MTLFrameBuffer *current_framebuffer = mtl_context->get_current_framebuffer();
|
||||
if (current_framebuffer) {
|
||||
BLI_assert(current_framebuffer == this);
|
||||
/* End current renderpass. */
|
||||
/* End current render-pass. */
|
||||
if (mtl_context->main_command_buffer.is_inside_render_pass()) {
|
||||
mtl_context->main_command_buffer.end_active_command_encoder();
|
||||
}
|
||||
|
@ -326,10 +326,10 @@ void MTLFrameBuffer::clear(eGPUFrameBufferBits buffers,
|
|||
/* Apply state before clear. */
|
||||
this->apply_state();
|
||||
|
||||
/* TODO(Metal): Optimise - Currently force-clear always used. Consider moving clear state to
|
||||
/* TODO(Metal): Optimize - Currently force-clear always used. Consider moving clear state to
|
||||
* MTLTexture instead. */
|
||||
/* Force clear if RP is not yet active -- not the most efficient, but there is no distinction
|
||||
* between clears where no draws occur. Can optimise at the high-level by using explicit
|
||||
* between clears where no draws occur. Can optimize at the high-level by using explicit
|
||||
* load-store flags. */
|
||||
this->force_clear();
|
||||
}
|
||||
|
@ -356,10 +356,10 @@ void MTLFrameBuffer::clear_multi(const float (*clear_cols)[4])
|
|||
/* Apply state before clear. */
|
||||
this->apply_state();
|
||||
|
||||
/* TODO(Metal): Optimise - Currently force-clear always used. Consider moving clear state to
|
||||
/* TODO(Metal): Optimize - Currently force-clear always used. Consider moving clear state to
|
||||
* MTLTexture instead. */
|
||||
/* Force clear if RP is not yet active -- not the most efficient, but there is no distinction
|
||||
* between clears where no draws occur. Can optimise at the high-level by using explicit
|
||||
* between clears where no draws occur. Can optimize at the high-level by using explicit
|
||||
* load-store flags. */
|
||||
this->force_clear();
|
||||
}
|
||||
|
@ -442,10 +442,10 @@ void MTLFrameBuffer::clear_attachment(GPUAttachmentType type,
|
|||
/* Apply state before clear. */
|
||||
this->apply_state();
|
||||
|
||||
/* TODO(Metal): Optimise - Currently force-clear always used. Consider moving clear state to
|
||||
/* TODO(Metal): Optimize - Currently force-clear always used. Consider moving clear state to
|
||||
* MTLTexture instead. */
|
||||
/* Force clear if RP is not yet active -- not the most efficient, but there is no distinction
|
||||
* between clears where no draws occur. Can optimise at the high-level by using explicit
|
||||
* between clears where no draws occur. Can optimize at the high-level by using explicit
|
||||
* load-store flags. */
|
||||
this->force_clear();
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ void MTLFrameBuffer::update_attachments(bool update_viewport)
|
|||
}
|
||||
}
|
||||
|
||||
/* Flag depth as added -- mirrors the behaviour in gl_framebuffer.cc to exit the for-loop
|
||||
/* Flag depth as added -- mirrors the behavior in gl_framebuffer.cc to exit the for-loop
|
||||
* after GPU_FB_DEPTH_STENCIL_ATTACHMENT has executed. */
|
||||
depth_added = true;
|
||||
|
||||
|
@ -765,7 +765,7 @@ void MTLFrameBuffer::apply_state(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ensure viewport has been set. Note: This should no longer happen, but kept for safety to
|
||||
/* Ensure viewport has been set. NOTE: This should no longer happen, but kept for safety to
|
||||
* track bugs. */
|
||||
if (viewport_[2] == 0 || viewport_[3] == 0) {
|
||||
MTL_LOG_WARNING(
|
||||
|
@ -1538,7 +1538,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c
|
|||
|
||||
#if defined(MAC_OS_X_VERSION_11_0) && __MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_11_0
|
||||
if (@available(macOS 11.00, *)) {
|
||||
/* Optimisation: Use smaller tile size on Apple Silicon if exceeding a certain bpp limit. */
|
||||
/* Optimization: Use smaller tile size on Apple Silicon if exceeding a certain bpp limit. */
|
||||
bool is_tile_based_gpu = [metal_ctx->device hasUnifiedMemory];
|
||||
if (is_tile_based_gpu) {
|
||||
uint framebuffer_bpp = this->get_bits_per_pixel();
|
||||
|
@ -1597,7 +1597,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c
|
|||
framebuffer_descriptor_[descriptor_config].renderTargetArrayLength = 0;
|
||||
}
|
||||
|
||||
/* Colour attachments. */
|
||||
/* Color attachments. */
|
||||
int colour_attachments = 0;
|
||||
for (int attachment_ind = 0; attachment_ind < GPU_FB_MAX_COLOR_ATTACHMENT; attachment_ind++) {
|
||||
|
||||
|
|
|
@ -796,7 +796,7 @@ static double ffmpeg_steps_per_frame_get(struct anim *anim)
|
|||
|
||||
/* Store backup frame.
|
||||
* With VFR movies, if PTS is not matched perfectly, scanning continues to look for next PTS.
|
||||
* It is likely to overshoot and scaning stops. Having previous frame backed up, it is possible
|
||||
* It is likely to overshoot and scanning stops. Having previous frame backed up, it is possible
|
||||
* to use it when overshoot happens.
|
||||
*/
|
||||
static void ffmpeg_double_buffer_backup_frame_store(struct anim *anim, int64_t pts_to_search)
|
||||
|
@ -1158,7 +1158,7 @@ static void ffmpeg_decode_video_frame_scan(struct anim *anim, int64_t pts_to_sea
|
|||
|
||||
/* We should not get a new GOP keyframe while scanning if seeking is working as intended.
|
||||
* If this condition triggers, there may be and error in our seeking code.
|
||||
* Note: This seems to happen if DTS value is used for seeking in ffmpeg internally. There
|
||||
* NOTE: This seems to happen if DTS value is used for seeking in ffmpeg internally. There
|
||||
* seems to be no good way to handle such case. */
|
||||
if (anim->seek_before_decode && start_gop_frame != anim->cur_key_frame_pts) {
|
||||
av_log(anim->pFormatCtx, AV_LOG_ERROR, "SCAN: Frame belongs to an unexpected GOP!\n");
|
||||
|
|
Loading…
Reference in New Issue