Flutter Impeller
command_queue.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 
7 
8 namespace impeller {
9 
10 CommandQueue::CommandQueue() = default;
11 
12 CommandQueue::~CommandQueue() = default;
13 
15  const std::vector<std::shared_ptr<CommandBuffer>>& buffers,
16  const CompletionCallback& completion_callback,
17  bool block_on_schedule) {
18  if (buffers.empty()) {
19  if (completion_callback) {
20  completion_callback(CommandBuffer::Status::kError);
21  }
22  return fml::Status(fml::StatusCode::kInvalidArgument,
23  "No command buffers provided.");
24  }
25  for (const std::shared_ptr<CommandBuffer>& buffer : buffers) {
26  if (!buffer->SubmitCommands(block_on_schedule, completion_callback)) {
27  return fml::Status(fml::StatusCode::kCancelled,
28  "Failed to submit command buffer.");
29  }
30  }
31  return fml::Status();
32 }
33 
34 } // namespace impeller
std::function< void(CommandBuffer::Status)> CompletionCallback
Definition: command_queue.h:19
virtual fml::Status Submit(const std::vector< std::shared_ptr< CommandBuffer >> &buffers, const CompletionCallback &completion_callback={}, bool block_on_schedule=false)
Submit one or more command buffer objects to be encoded and executed on the GPU.