5#include "flutter/lib/gpu/command_buffer.h"
20 std::shared_ptr<impeller::Context> context,
21 std::shared_ptr<impeller::CommandBuffer> command_buffer)
22 : context_(
std::move(context)),
23 command_buffer_(
std::move(command_buffer)) {}
28 return command_buffer_;
32 std::shared_ptr<impeller::RenderPass> render_pass) {
33 encodables_.push_back(std::move(render_pass));
37 for (
auto& encodable : encodables_) {
38 encodable->EncodeCommands();
41 return context_->GetCommandQueue()->Submit({command_buffer_}).
ok();
46 for (
auto& encodable : encodables_) {
47 encodable->EncodeCommands();
49 return context_->GetCommandQueue()
50 ->Submit({command_buffer_}, completion_callback)
64 auto res = fml::MakeRefCounted<flutter::gpu::CommandBuffer>(
66 contextWrapper->
GetContext()->CreateCommandBuffer());
67 res->AssociateWithDartWrapper(wrapper);
76 bool success = wrapper->
Submit();
84 return tonic::ToDart(
"Completion callback must be a function");
88 auto& task_runners = dart_state->GetTaskRunners();
90 auto persistent_completion_callback =
91 std::make_unique<tonic::DartPersistentValue>(dart_state,
95 [
callback = std::move(persistent_completion_callback),
101 auto dart_state =
callback->dart_state().lock();
114 task_runners.GetUITaskRunner()->PostTask(ui_completion_task);
static bool ok(int result)
static UIDartState * Current()
CommandBuffer(std::shared_ptr< impeller::Context > context, std::shared_ptr< impeller::CommandBuffer > command_buffer)
~CommandBuffer() override
std::shared_ptr< impeller::CommandBuffer > GetCommandBuffer()
void AddRenderPass(std::shared_ptr< impeller::RenderPass > render_pass)
std::shared_ptr< impeller::Context > GetContext()
std::function< void(Status)> CompletionCallback
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_Handle InternalFlutterGpu_CommandBuffer_Submit(flutter::gpu::CommandBuffer *wrapper, Dart_Handle completion_callback)
bool InternalFlutterGpu_CommandBuffer_Initialize(Dart_Handle wrapper, flutter::gpu::Context *contextWrapper)
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, CommandBuffer)
internal::CopyableLambda< T > MakeCopyable(T lambda)
Dart_Handle ToDart(const T &object)
Dart_Handle DartInvoke(Dart_Handle closure, std::initializer_list< Dart_Handle > args)