| 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 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|
65 std::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|
77 std::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
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:94
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_blur_unittests.cc:20