Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
command_buffer_gles.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
13CommandBufferGLES::CommandBufferGLES(std::weak_ptr<const Context> context,
14 ReactorGLES::Ref reactor)
15 : CommandBuffer(std::move(context)),
16 reactor_(std::move(reactor)),
17 is_valid_(reactor_ && reactor_->IsValid()) {}
18
19CommandBufferGLES::~CommandBufferGLES() = default;
20
21// |CommandBuffer|
22void CommandBufferGLES::SetLabel(const std::string& label) const {
23 // Cannot support.
24}
25
26// |CommandBuffer|
27bool CommandBufferGLES::IsValid() const {
28 return is_valid_;
29}
30
31// |CommandBuffer|
32bool CommandBufferGLES::OnSubmitCommands(CompletionCallback callback) {
33 const auto result = reactor_->React();
34 if (callback) {
35 callback(result ? CommandBuffer::Status::kCompleted
36 : CommandBuffer::Status::kError);
37 }
38 return result;
39}
40
41// |CommandBuffer|
42void CommandBufferGLES::OnWaitUntilScheduled() {
43 reactor_->GetProcTable().Flush();
44}
45
46// |CommandBuffer|
47std::shared_ptr<RenderPass> CommandBufferGLES::OnCreateRenderPass(
49 if (!IsValid()) {
50 return nullptr;
51 }
52 auto context = context_.lock();
53 if (!context) {
54 return nullptr;
55 }
56 auto pass = std::shared_ptr<RenderPassGLES>(
57 new RenderPassGLES(context, target, reactor_));
58 if (!pass->IsValid()) {
59 return nullptr;
60 }
61 return pass;
62}
63
64// |CommandBuffer|
65std::shared_ptr<BlitPass> CommandBufferGLES::OnCreateBlitPass() {
66 if (!IsValid()) {
67 return nullptr;
68 }
69 auto pass = std::shared_ptr<BlitPassGLES>(new BlitPassGLES(reactor_));
70 if (!pass->IsValid()) {
71 return nullptr;
72 }
73 return pass;
74}
75
76// |CommandBuffer|
77std::shared_ptr<ComputePass> CommandBufferGLES::OnCreateComputePass() {
78 // Compute passes aren't supported until GLES 3.2, at which point Vulkan is
79 // available anyway.
80 return nullptr;
81}
82
83} // namespace impeller
std::function< void(Status)> CompletionCallback
std::shared_ptr< ReactorGLES > Ref
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
GAsyncResult * result
uint32_t * target
Definition ref_ptr.h:256