Flutter Engine
 
Loading...
Searching...
No Matches
command_buffer.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
10
11namespace impeller {
12
13CommandBuffer::CommandBuffer(std::weak_ptr<const Context> context)
14 : context_(std::move(context)) {}
15
17
18bool CommandBuffer::SubmitCommands(bool block_on_schedule,
19 const CompletionCallback& callback) {
20 if (!IsValid()) {
21 // Already committed or was never valid. Either way, this is caller error.
22 if (callback) {
24 }
25 return false;
26 }
27 return OnSubmitCommands(block_on_schedule, callback);
28}
29
30bool CommandBuffer::SubmitCommands(bool block_on_schedule) {
31 return SubmitCommands(block_on_schedule, nullptr);
32}
33
37
41
42std::shared_ptr<RenderPass> CommandBuffer::CreateRenderPass(
43 const RenderTarget& render_target) {
44 auto pass = OnCreateRenderPass(render_target);
45 if (pass && pass->IsValid()) {
46 pass->SetLabel("RenderPass");
47 return pass;
48 }
49 return nullptr;
50}
51
52std::shared_ptr<BlitPass> CommandBuffer::CreateBlitPass() {
53 auto pass = OnCreateBlitPass();
54 if (pass && pass->IsValid()) {
55 pass->SetLabel("BlitPass");
56 return pass;
57 }
58 return nullptr;
59}
60
61std::shared_ptr<ComputePass> CommandBuffer::CreateComputePass() {
62 if (!IsValid()) {
63 return nullptr;
64 }
65 auto pass = OnCreateComputePass();
66 if (pass && pass->IsValid()) {
67 pass->SetLabel("ComputePass");
68 return pass;
69 }
70 return nullptr;
71}
72
73} // namespace impeller
std::shared_ptr< BlitPass > CreateBlitPass()
Create a blit pass to record blit commands into.
virtual void OnWaitUntilCompleted()=0
std::shared_ptr< ComputePass > CreateComputePass()
Create a compute pass to record compute commands into.
CommandBuffer(std::weak_ptr< const Context > context)
virtual std::shared_ptr< BlitPass > OnCreateBlitPass()=0
virtual bool OnSubmitCommands(bool block_on_schedule, CompletionCallback callback)=0
Submit the command buffer to the GPU for execution.
virtual bool IsValid() const =0
virtual std::shared_ptr< ComputePass > OnCreateComputePass()=0
void WaitUntilCompleted()
Block the current thread until the GPU has completed execution of the commands.
std::shared_ptr< RenderPass > CreateRenderPass(const RenderTarget &render_target)
Create a render pass to record render commands into.
virtual void OnWaitUntilScheduled()=0
void WaitUntilScheduled()
Block the current thread until the GPU has completed scheduling execution of the commands.
virtual std::shared_ptr< RenderPass > OnCreateRenderPass(RenderTarget render_target)=0
FlutterDesktopBinaryReply callback
Definition ref_ptr.h:261