Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_state.mm
| Show First 20 Lines • Show All 569 Lines • ▼ Show 20 Lines | void MTLStateManager::issue_barrier(eGPUBarrier barrier_bits) | ||||
| * resolve these dependencies automatically. | * resolve these dependencies automatically. | ||||
| * For untracked resources, such as MTLHeap's, explicit barriers are necessary. */ | * For untracked resources, such as MTLHeap's, explicit barriers are necessary. */ | ||||
| eGPUStageBarrierBits before_stages = GPU_BARRIER_STAGE_ANY; | eGPUStageBarrierBits before_stages = GPU_BARRIER_STAGE_ANY; | ||||
| eGPUStageBarrierBits after_stages = GPU_BARRIER_STAGE_ANY; | eGPUStageBarrierBits after_stages = GPU_BARRIER_STAGE_ANY; | ||||
| MTLContext *ctx = reinterpret_cast<MTLContext *>(GPU_context_active_get()); | MTLContext *ctx = reinterpret_cast<MTLContext *>(GPU_context_active_get()); | ||||
| BLI_assert(ctx); | BLI_assert(ctx); | ||||
| /* Apple Silicon does not support memory barriers. | |||||
| * We do not currently need these due to implicit API guarantees. | |||||
| * NOTE(Metal): MTLFence/MTLEvent may be required to synchronize work if | |||||
| * untracked resources are ever used. */ | |||||
| if ([ctx->device hasUnifiedMemory]) { | |||||
| return; | |||||
| } | |||||
| ctx->main_command_buffer.insert_memory_barrier(barrier_bits, before_stages, after_stages); | ctx->main_command_buffer.insert_memory_barrier(barrier_bits, before_stages, after_stages); | ||||
| } | } | ||||
| MTLFence::~MTLFence() | MTLFence::~MTLFence() | ||||
| { | { | ||||
| if (mtl_event_) { | if (mtl_event_) { | ||||
| [mtl_event_ release]; | [mtl_event_ release]; | ||||
| mtl_event_ = nil; | mtl_event_ = nil; | ||||
| ▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines | |||||