Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
command_queue.h
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#ifndef FLUTTER_IMPELLER_RENDERER_COMMAND_QUEUE_H_
6#define FLUTTER_IMPELLER_RENDERER_COMMAND_QUEUE_H_
7
8#include <functional>
9
10#include "fml/status.h"
12
13namespace impeller {
14
15/// @brief An interface for submitting command buffers to the GPU for
16/// encoding and execution.
18 public:
19 using CompletionCallback = std::function<void(CommandBuffer::Status)>;
20
22
23 virtual ~CommandQueue();
24
25 /// @brief Submit one or more command buffer objects to be encoded and
26 /// executed on the GPU.
27 ///
28 /// The order of the provided buffers determines the ordering in which
29 /// they are submitted.
30 ///
31 /// The returned status only indicates if the command buffer was
32 /// successfully submitted. Successful completion of the command buffer
33 /// can only be checked in the optional completion callback.
34 ///
35 /// Only the Metal and Vulkan backends can give a status beyond
36 /// successful encoding. This callback may be called more than once and
37 /// potentially on a different thread.
38 virtual fml::Status Submit(
39 const std::vector<std::shared_ptr<CommandBuffer>>& buffers,
40 const CompletionCallback& completion_callback = {});
41
42 private:
43 CommandQueue(const CommandQueue&) = delete;
44
45 CommandQueue& operator=(const CommandQueue&) = delete;
46};
47
48} // namespace impeller
49
50#endif // FLUTTER_IMPELLER_RENDERER_COMMAND_QUEUE_H_
An interface for submitting command buffers to the GPU for encoding and execution.
std::function< void(CommandBuffer::Status)> CompletionCallback
virtual fml::Status Submit(const std::vector< std::shared_ptr< CommandBuffer > > &buffers, const CompletionCallback &completion_callback={})
Submit one or more command buffer objects to be encoded and executed on the GPU.