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 std::shared_ptr<ReactorGLES> 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(std::string_view label) const {
23 // Cannot support.
24}
25
26// |CommandBuffer|
27bool CommandBufferGLES::IsValid() const {
28 return is_valid_;
29}
30
31// |CommandBuffer|
32bool 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|
43void CommandBufferGLES::OnWaitUntilCompleted() {
44 reactor_->GetProcTable().Finish();
45}
46
47// |CommandBuffer|
48void CommandBufferGLES::OnWaitUntilScheduled() {
49 reactor_->GetProcTable().Flush();
50}
51
52// |CommandBuffer|
53std::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|
71std::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|
83std::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
uint32_t * target
FlutterDesktopBinaryReply callback
Definition ref_ptr.h:261