| Flutter Impeller |

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"
11 #include "impeller/renderer/command_buffer.h"
12
13 namespace impeller {
14
15 /// @brief An interface for submitting command buffers to the GPU for
16 /// encoding and execution.
17 class CommandQueue {
18 public:
19 using CompletionCallback = std::function<void(CommandBuffer::Status)>;
20
21 CommandQueue();
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 ///
39 /// If [block_on_schedule] is true, this function will not return until
40 /// the command buffer has been scheduled. This only impacts the Metal
41 /// backend.
42 virtual fml::Status Submit(
43 const std::vector<std::shared_ptr<CommandBuffer>>& buffers,
44 const CompletionCallback& completion_callback = {},
45 bool block_on_schedule = false);
46
47 private:
48 CommandQueue(const CommandQueue&) = delete;
49
50 CommandQueue& operator=(const CommandQueue&) = delete;
51 };
52
53 } // namespace impeller
54
55 #endif // FLUTTER_IMPELLER_RENDERER_COMMAND_QUEUE_H_
impeller::CommandBuffer::Status
Status
Definition: command_buffer.h:49
impeller::CommandQueue
An interface for submitting command buffers to the GPU for encoding and execution.
Definition: command_queue.h:17
impeller::CommandQueue::CompletionCallback
std::function< void(CommandBuffer::Status)> CompletionCallback
Definition: command_queue.h:19
impeller::CommandQueue::CommandQueue
CommandQueue()
impeller::CommandQueue::Submit
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.
Definition: command_queue.cc:14
impeller::CommandQueue::~CommandQueue
virtual ~CommandQueue()
command_buffer.h
impeller
Definition: allocation.cc:12