Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
impeller::CommandBufferMTL Class Referencefinal

#include <command_buffer_mtl.h>

Inheritance diagram for impeller::CommandBufferMTL:
impeller::CommandBuffer

Public Member Functions

 ~CommandBufferMTL () override
 
- Public Member Functions inherited from impeller::CommandBuffer
virtual ~CommandBuffer ()
 
void WaitUntilScheduled ()
 Force execution of pending GPU commands.
 
std::shared_ptr< RenderPassCreateRenderPass (const RenderTarget &render_target)
 Create a render pass to record render commands into.
 
std::shared_ptr< BlitPassCreateBlitPass ()
 Create a blit pass to record blit commands into.
 
std::shared_ptr< ComputePassCreateComputePass ()
 Create a compute pass to record compute commands into.
 

Private Member Functions

void SetLabel (const std::string &label) const override
 
bool IsValid () const override
 
bool OnSubmitCommands (CompletionCallback callback) override
 
void OnWaitUntilScheduled () override
 
std::shared_ptr< RenderPassOnCreateRenderPass (RenderTarget target) override
 
std::shared_ptr< BlitPassOnCreateBlitPass () override
 
std::shared_ptr< ComputePassOnCreateComputePass () override
 

Friends

class ContextMTL
 

Additional Inherited Members

- Public Types inherited from impeller::CommandBuffer
enum class  Status { kPending , kError , kCompleted }
 
using CompletionCallback = std::function< void(Status)>
 
- Protected Member Functions inherited from impeller::CommandBuffer
 CommandBuffer (std::weak_ptr< const Context > context)
 
- Protected Attributes inherited from impeller::CommandBuffer
std::weak_ptr< const Contextcontext_
 

Detailed Description

Definition at line 16 of file command_buffer_mtl.h.

Constructor & Destructor Documentation

◆ ~CommandBufferMTL()

impeller::CommandBufferMTL::~CommandBufferMTL ( )
overridedefault

Member Function Documentation

◆ IsValid()

bool impeller::CommandBufferMTL::IsValid ( ) const
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 136 of file command_buffer_mtl.mm.

136 {
137 return buffer_ != nil;
138}

◆ OnCreateBlitPass()

std::shared_ptr< BlitPass > impeller::CommandBufferMTL::OnCreateBlitPass ( )
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 206 of file command_buffer_mtl.mm.

206 {
207 if (!buffer_) {
208 return nullptr;
209 }
210
211 auto pass = std::shared_ptr<BlitPassMTL>(new BlitPassMTL(buffer_));
212 if (!pass->IsValid()) {
213 return nullptr;
214 }
215
216 return pass;
217}

◆ OnCreateComputePass()

std::shared_ptr< ComputePass > impeller::CommandBufferMTL::OnCreateComputePass ( )
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 219 of file command_buffer_mtl.mm.

219 {
220 if (!buffer_) {
221 return nullptr;
222 }
223 auto context = context_.lock();
224 if (!context) {
225 return nullptr;
226 }
227
228 auto pass =
229 std::shared_ptr<ComputePassMTL>(new ComputePassMTL(context, buffer_));
230 if (!pass->IsValid()) {
231 return nullptr;
232 }
233
234 return pass;
235}
std::weak_ptr< const Context > context_

◆ OnCreateRenderPass()

std::shared_ptr< RenderPass > impeller::CommandBufferMTL::OnCreateRenderPass ( RenderTarget  target)
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 187 of file command_buffer_mtl.mm.

188 {
189 if (!buffer_) {
190 return nullptr;
191 }
192
193 auto context = context_.lock();
194 if (!context) {
195 return nullptr;
196 }
197 auto pass = std::shared_ptr<RenderPassMTL>(
198 new RenderPassMTL(context, target, buffer_));
199 if (!pass->IsValid()) {
200 return nullptr;
201 }
202
203 return pass;
204}
uint32_t * target

◆ OnSubmitCommands()

bool impeller::CommandBufferMTL::OnSubmitCommands ( CompletionCallback  callback)
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 160 of file command_buffer_mtl.mm.

160 {
161 auto context = context_.lock();
162 if (!context) {
163 return false;
164 }
165#ifdef IMPELLER_DEBUG
166 ContextMTL::Cast(*context).GetGPUTracer()->RecordCmdBuffer(buffer_);
167#endif // IMPELLER_DEBUG
168 if (callback) {
169 [buffer_
170 addCompletedHandler:^(id<MTLCommandBuffer> buffer) {
171 [[maybe_unused]] auto result =
174 << "Must not have errors during command buffer submission.";
176 }];
177 }
178
179 [buffer_ commit];
180
181 buffer_ = nil;
182 return true;
183}
static ContextMTL & Cast(Context &base)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static const uint8_t buffer[]
GAsyncResult * result
#define FML_DCHECK(condition)
Definition logging.h:103
static bool LogMTLCommandBufferErrorIfPresent(id< MTLCommandBuffer > buffer)
static CommandBuffer::Status ToCommitResult(MTLCommandBufferStatus status)

◆ OnWaitUntilScheduled()

void impeller::CommandBufferMTL::OnWaitUntilScheduled ( )
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 185 of file command_buffer_mtl.mm.

185{}

◆ SetLabel()

void impeller::CommandBufferMTL::SetLabel ( const std::string &  label) const
overrideprivatevirtual

Implements impeller::CommandBuffer.

Definition at line 140 of file command_buffer_mtl.mm.

140 {
141 if (label.empty()) {
142 return;
143 }
144
145 [buffer_ setLabel:@(label.data())];
146}

Friends And Related Symbol Documentation

◆ ContextMTL

friend class ContextMTL
friend

Definition at line 22 of file command_buffer_mtl.h.


The documentation for this class was generated from the following files: