| Flutter Impeller |

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
5 #include "impeller/renderer/backend/gles/command_buffer_gles.h"
6
7 #include "impeller/base/config.h"
8 #include "impeller/renderer/backend/gles/blit_pass_gles.h"
9 #include "impeller/renderer/backend/gles/render_pass_gles.h"
10
11 namespace impeller {
12
13 CommandBufferGLES::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
19 CommandBufferGLES::~CommandBufferGLES() = default;
20
21 // |CommandBuffer|
22 void CommandBufferGLES::SetLabel(const std::string& label) const {
23 // Cannot support.
24 }
25
26 // |CommandBuffer|
27 bool CommandBufferGLES::IsValid() const {
28 return is_valid_;
29 }
30
31 // |CommandBuffer|
32 bool 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|
42 void CommandBufferGLES::OnWaitUntilScheduled() {
43 reactor_->GetProcTable().Flush();
44 }
45
46 // |CommandBuffer|
47 std::shared_ptr<RenderPass> CommandBufferGLES::OnCreateRenderPass(
48 RenderTarget target) {
49 if (!IsValid()) {
50 return nullptr;
51 }
52 auto pass = std::shared_ptr<RenderPassGLES>(
53 new RenderPassGLES(context_, target, reactor_));
54 if (!pass->IsValid()) {
55 return nullptr;
56 }
57 return pass;
58 }
59
60 // |CommandBuffer|
61 std::shared_ptr<BlitPass> CommandBufferGLES::OnCreateBlitPass() {
62 if (!IsValid()) {
63 return nullptr;
64 }
65 auto pass = std::shared_ptr<BlitPassGLES>(new BlitPassGLES(reactor_));
66 if (!pass->IsValid()) {
67 return nullptr;
68 }
69 return pass;
70 }
71
72 // |CommandBuffer|
73 std::shared_ptr<ComputePass> CommandBufferGLES::OnCreateComputePass() {
74 // Compute passes aren't supported until GLES 3.2, at which point Vulkan is
75 // available anyway.
76 return nullptr;
77 }
78
79 } // namespace impeller
impeller::CommandBuffer::Status::kError
@ kError
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:87
render_pass_gles.h
impeller::CommandBuffer::context_
std::weak_ptr< const Context > context_
Definition: command_buffer.h:130
blit_pass_gles.h
std
Definition: comparable.h:95
impeller::CommandBuffer::Status::kCompleted
@ kCompleted
impeller::CommandBufferGLES::~CommandBufferGLES
~CommandBufferGLES() override
command_buffer_gles.h
config.h
impeller
Definition: aiks_context.cc:10