Flutter Engine
The Flutter Engine
runtime_stage_playground.cc
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#include "flutter/impeller/runtime_stage/runtime_stage_playground.h"
6
7#include <future>
8
9#include "flutter/fml/make_copyable.h"
10#include "flutter/testing/testing.h"
13
14namespace impeller {
15
17
19
21 std::promise<bool> registration;
22 auto future = registration.get_future();
23 const std::shared_ptr<ShaderLibrary>& library =
24 GetContext()->GetShaderLibrary();
25 GetContext()->GetShaderLibrary()->RegisterFunction(
27 stage.GetCodeMapping(),
28 fml::MakeCopyable([reg = std::move(registration)](bool result) mutable {
29 reg.set_value(result);
30 }));
31 return future.get();
32}
33
34} // namespace impeller
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:90
bool RegisterStage(const RuntimeStage &stage)
const std::string & GetEntrypoint() const
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
RuntimeShaderStage GetShaderStage() const
GAsyncResult * result
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
Definition: shader_types.h:29