Flutter Engine
The Flutter Engine
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(const CompletionCallback& callback) {
19 if (!IsValid()) {
20 // Already committed or was never valid. Either way, this is caller error.
21 if (callback) {
23 }
24 return false;
25 }
27}
28
29bool CommandBuffer::SubmitCommands() {
30 return SubmitCommands(nullptr);
31}
32
34 return OnWaitUntilScheduled();
35}
36
37std::shared_ptr<RenderPass> CommandBuffer::CreateRenderPass(
38 const RenderTarget& render_target) {
39 auto pass = OnCreateRenderPass(render_target);
40 if (pass && pass->IsValid()) {
41 pass->SetLabel("RenderPass");
42 return pass;
43 }
44 return nullptr;
45}
46
47std::shared_ptr<BlitPass> CommandBuffer::CreateBlitPass() {
48 auto pass = OnCreateBlitPass();
49 if (pass && pass->IsValid()) {
50 pass->SetLabel("BlitPass");
51 return pass;
52 }
53 return nullptr;
54}
55
56std::shared_ptr<ComputePass> CommandBuffer::CreateComputePass() {
57 if (!IsValid()) {
58 return nullptr;
59 }
60 auto pass = OnCreateComputePass();
61 if (pass && pass->IsValid()) {
62 pass->SetLabel("ComputePass");
63 return pass;
64 }
65 return nullptr;
66}
67
68} // namespace impeller
std::shared_ptr< BlitPass > CreateBlitPass()
Create a blit pass to record blit commands into.
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 IsValid() const =0
virtual std::shared_ptr< ComputePass > OnCreateComputePass()=0
virtual bool OnSubmitCommands(CompletionCallback callback)=0
std::shared_ptr< RenderPass > CreateRenderPass(const RenderTarget &render_target)
Create a render pass to record render commands into.
virtual void OnWaitUntilScheduled()=0
void WaitUntilScheduled()
Force execution of pending GPU commands.
virtual std::shared_ptr< RenderPass > OnCreateRenderPass(RenderTarget render_target)=0
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: ref_ptr.h:256