Flutter Engine
The Flutter Engine
command_buffer.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_LIB_GPU_COMMAND_BUFFER_H_
6#define FLUTTER_LIB_GPU_COMMAND_BUFFER_H_
7
8#include "flutter/lib/gpu/context.h"
9#include "flutter/lib/gpu/export.h"
10#include "flutter/lib/ui/dart_wrapper.h"
12
13namespace flutter {
14namespace gpu {
15
16class CommandBuffer : public RefCountedDartWrappable<CommandBuffer> {
17 DEFINE_WRAPPERTYPEINFO();
18 FML_FRIEND_MAKE_REF_COUNTED(CommandBuffer);
19
20 public:
21 CommandBuffer(std::shared_ptr<impeller::Context> context,
22 std::shared_ptr<impeller::CommandBuffer> command_buffer);
23
24 std::shared_ptr<impeller::CommandBuffer> GetCommandBuffer();
25
26 void AddRenderPass(std::shared_ptr<impeller::RenderPass> render_pass);
27
28 bool Submit();
29 bool Submit(
30 const impeller::CommandBuffer::CompletionCallback& completion_callback);
31
32 ~CommandBuffer() override;
33
34 private:
35 std::shared_ptr<impeller::Context> context_;
36 std::shared_ptr<impeller::CommandBuffer> command_buffer_;
37 std::vector<std::shared_ptr<impeller::RenderPass>> encodables_;
38
39 FML_DISALLOW_COPY_AND_ASSIGN(CommandBuffer);
40};
41
42} // namespace gpu
43} // namespace flutter
44
45//----------------------------------------------------------------------------
46/// Exports
47///
48
49extern "C" {
50
53 Dart_Handle wrapper,
54 flutter::gpu::Context* contextWrapper);
55
59 Dart_Handle completion_callback);
60
61} // extern "C"
62
63#endif // FLUTTER_LIB_GPU_COMMAND_BUFFER_H_
CommandBuffer(std::shared_ptr< impeller::Context > context, std::shared_ptr< impeller::CommandBuffer > command_buffer)
std::shared_ptr< impeller::CommandBuffer > GetCommandBuffer()
void AddRenderPass(std::shared_ptr< impeller::RenderPass > render_pass)
std::function< void(Status)> CompletionCallback
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
#define FLUTTER_GPU_EXPORT
Definition: export.h:13
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_CommandBuffer_Initialize(Dart_Handle wrapper, flutter::gpu::Context *contextWrapper)
FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_CommandBuffer_Submit(flutter::gpu::CommandBuffer *wrapper, Dart_Handle completion_callback)