| 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 auto library = GetContext()->GetShaderLibrary();
24 GetContext()->GetShaderLibrary()->RegisterFunction(
25 stage.GetEntrypoint(), ToShaderStage(stage.GetShaderStage()),
26 stage.GetCodeMapping(),
27 fml::MakeCopyable([reg = std::move(registration)](bool result) mutable {
28 reg.set_value(result);
29 }));
30 return future.get();
31 }
32
33 } // namespace impeller
impeller::RuntimeStage::GetShaderStage
RuntimeShaderStage GetShaderStage() const
Definition: runtime_stage.cc:157
shader_library.h
impeller::RuntimeStage
Definition: runtime_stage.h:20
impeller::ToShaderStage
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
Definition: shader_types.h:29
impeller::RuntimeStagePlayground::RegisterStage
bool RegisterStage(const RuntimeStage &stage)
Definition: runtime_stage_playground.cc:20
impeller::RuntimeStagePlayground::RuntimeStagePlayground
RuntimeStagePlayground()
runtime_stage_playground.h
impeller::RuntimeStage::GetEntrypoint
const std::string & GetEntrypoint() const
Definition: runtime_stage.cc:153
impeller::Playground::GetContext
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:86
shader_types.h
impeller
Definition: aiks_context.cc:10
impeller::RuntimeStagePlayground::~RuntimeStagePlayground
~RuntimeStagePlayground()
impeller::RuntimeStage::GetCodeMapping
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
Definition: runtime_stage.cc:134