| 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
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"
11 #include "impeller/core/shader_types.h"
12 #include "impeller/renderer/shader_library.h"
13
14 namespace impeller {
15
16 RuntimeStagePlayground::RuntimeStagePlayground() = default;
17
18 RuntimeStagePlayground::~RuntimeStagePlayground() = default;
19
20 bool RuntimeStagePlayground::RegisterStage(const RuntimeStage& stage) {
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
impeller::Playground::GetContext
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:91
impeller::RuntimeStage
Definition: runtime_stage.h:21
impeller::RuntimeStage::GetEntrypoint
const std::string & GetEntrypoint() const
Definition: runtime_stage.cc:224
impeller::RuntimeStage::GetCodeMapping
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
Definition: runtime_stage.cc:205
impeller::RuntimeStage::GetShaderStage
RuntimeShaderStage GetShaderStage() const
Definition: runtime_stage.cc:228
impeller::RuntimeStagePlayground::~RuntimeStagePlayground
~RuntimeStagePlayground()
impeller::RuntimeStagePlayground::RuntimeStagePlayground
RuntimeStagePlayground()
impeller::RuntimeStagePlayground::RegisterStage
bool RegisterStage(const RuntimeStage &stage)
Definition: runtime_stage_playground.cc:20
impeller
Definition: allocation.cc:12
impeller::ToShaderStage
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
Definition: shader_types.h:29
runtime_stage_playground.h
shader_library.h
shader_types.h