| 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 std::shared_ptr<ReactorGLES> 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(std::string_view 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(bool block_on_schedule,
33 CompletionCallback callback) {
34 const auto result = reactor_->React();
35 if (callback) {
36 callback(result ? CommandBuffer::Status::kCompleted
37 : CommandBuffer::Status::kError);
38 }
39 return result;
40 }
41
42 // |CommandBuffer|
43 void CommandBufferGLES::OnWaitUntilCompleted() {
44 reactor_->GetProcTable().Finish();
45 }
46
47 // |CommandBuffer|
48 void CommandBufferGLES::OnWaitUntilScheduled() {
49 reactor_->GetProcTable().Flush();
50 }
51
52 // |CommandBuffer|
53 std::shared_ptr<RenderPass> CommandBufferGLES::OnCreateRenderPass(
54 RenderTarget target) {
55 if (!IsValid()) {
56 return nullptr;
57 }
58 auto context = context_.lock();
59 if (!context) {
60 return nullptr;
61 }
62 auto pass = std::shared_ptr<RenderPassGLES>(
63 new RenderPassGLES(context, target, reactor_));
64 if (!pass->IsValid()) {
65 return nullptr;
66 }
67 return pass;
68 }
69
70 // |CommandBuffer|
71 std::shared_ptr<BlitPass> CommandBufferGLES::OnCreateBlitPass() {
72 if (!IsValid()) {
73 return nullptr;
74 }
75 auto pass = std::shared_ptr<BlitPassGLES>(new BlitPassGLES(reactor_));
76 if (!pass->IsValid()) {
77 return nullptr;
78 }
79 return pass;
80 }
81
82 // |CommandBuffer|
83 std::shared_ptr<ComputePass> CommandBufferGLES::OnCreateComputePass() {
84 // Compute passes aren't supported until GLES 3.2, at which point Vulkan is
85 // available anyway.
86 return nullptr;
87 }
88
89 } // namespace impeller
config.h
blit_pass_gles.h
command_buffer_gles.h
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95
render_pass_gles.h