Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_state.mm
| Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | void MTLStateManager::issue_barrier(eGPUBarrier barrier_bits) | ||||
| * untracked resources are ever used. */ | * untracked resources are ever used. */ | ||||
| if ([ctx->device hasUnifiedMemory]) { | if ([ctx->device hasUnifiedMemory]) { | ||||
| return; | 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() | |||||
| { | |||||
| if (mtl_event_) { | |||||
| [mtl_event_ release]; | |||||
| mtl_event_ = nil; | |||||
| } | |||||
| } | |||||
| void MTLFence::signal() | |||||
| { | |||||
| if (mtl_event_ == nil) { | |||||
| MTLContext *ctx = MTLContext::get(); | |||||
| BLI_assert(ctx); | |||||
| mtl_event_ = [ctx->device newEvent]; | |||||
| } | |||||
| MTLContext *ctx = MTLContext::get(); | |||||
| BLI_assert(ctx); | |||||
| ctx->main_command_buffer.encode_signal_event(mtl_event_, ++last_signalled_value_); | |||||
| signalled_ = true; | |||||
| } | |||||
| void MTLFence::wait() | |||||
| { | |||||
| /* do not attempt to wait if event has not yet been signalled for the first time. */ | |||||
| if (mtl_event_ == nil) { | |||||
| return; | |||||
| } | |||||
| if (signalled_) { | |||||
| MTLContext *ctx = MTLContext::get(); | |||||
| BLI_assert(ctx); | |||||
| ctx->main_command_buffer.encode_wait_for_event(mtl_event_, last_signalled_value_); | |||||
| signalled_ = false; | |||||
| } | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Texture State Management | /** \name Texture State Management | ||||
| * \{ */ | * \{ */ | ||||
| void MTLStateManager::texture_unpack_row_length_set(uint len) | void MTLStateManager::texture_unpack_row_length_set(uint len) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||