22class DeferredCompletionCallback {
24 explicit DeferredCompletionCallback(
31 DeferredCompletionCallback(
const DeferredCompletionCallback&) =
delete;
32 DeferredCompletionCallback& operator=(
const DeferredCompletionCallback&) =
34 DeferredCompletionCallback(DeferredCompletionCallback&&) =
delete;
35 DeferredCompletionCallback& operator=(DeferredCompletionCallback&&) =
delete;
45 auto callback = std::exchange(callback_,
nullptr);
54CommandBufferGLES::CommandBufferGLES(std::weak_ptr<const Context>
context,
55 std::shared_ptr<ReactorGLES>
reactor)
58 is_valid_(reactor_ && reactor_->IsValid()) {}
60CommandBufferGLES::~CommandBufferGLES() =
default;
63void CommandBufferGLES::SetLabel(std::string_view label)
const {
68bool CommandBufferGLES::IsValid()
const {
73bool CommandBufferGLES::OnSubmitCommands(
bool block_on_schedule,
75 if (reactor_->CanReactOnCurrentThread()) {
76 const auto result = reactor_->React();
78 callback(result ? CommandBuffer::Status::kCompleted
79 : CommandBuffer::Status::kError);
90 auto deferred_callback =
91 std::make_shared<DeferredCompletionCallback>(std::move(
callback));
92 if (!reactor_->AddOperation(
93 [deferred_callback](
const ReactorGLES&
reactor) {
94 deferred_callback->Complete();
103void CommandBufferGLES::OnWaitUntilCompleted() {
104 reactor_->GetProcTable().Finish();
108void CommandBufferGLES::OnWaitUntilScheduled() {
109 reactor_->GetProcTable().Flush();
113std::shared_ptr<RenderPass> CommandBufferGLES::OnCreateRenderPass(
118 auto context = context_.lock();
122 auto pass = std::shared_ptr<RenderPassGLES>(
124 if (!pass->IsValid()) {
131std::shared_ptr<BlitPass> CommandBufferGLES::OnCreateBlitPass() {
135 auto pass = std::shared_ptr<BlitPassGLES>(
new BlitPassGLES(reactor_));
136 if (!pass->IsValid()) {
143std::shared_ptr<ComputePass> CommandBufferGLES::OnCreateComputePass() {
std::function< void(Status)> CompletionCallback
FlutterDesktopBinaryReply callback
std::shared_ptr< ReactorGLES > reactor
std::shared_ptr< ContextGLES > context