Flutter Impeller
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 
6 
7 #include <future>
8 
9 #include "flutter/fml/make_copyable.h"
10 #include "flutter/testing/testing.h"
13 
14 namespace 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(
26  stage.GetEntrypoint(), ToShaderStage(stage.GetShaderStage()),
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:91
const std::string & GetEntrypoint() const
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
RuntimeShaderStage GetShaderStage() const
bool RegisterStage(const RuntimeStage &stage)
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
Definition: shader_types.h:29