| Flutter Impeller |

runtime_stage_data.h
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 #pragma once
6
7 #include <memory>
8 #include <vector>
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/mapping.h"
12 #include "impeller/compiler/types.h"
13 #include "spirv_parser.hpp"
14
15 namespace impeller {
16 namespace compiler {
17
18 struct UniformDescription {
19 std::string name;
20 size_t location = 0u;
21 spirv_cross::SPIRType::BaseType type = spirv_cross::SPIRType::BaseType::Float;
22 size_t rows = 0u;
23 size_t columns = 0u;
24 size_t bit_width = 0u;
25 std::optional<size_t> array_elements = std::nullopt;
26 };
27
28 class RuntimeStageData {
29 public:
30 RuntimeStageData(std::string entrypoint,
31 spv::ExecutionModel stage,
32 TargetPlatform target_platform);
33
34 ~RuntimeStageData();
35
36 void AddUniformDescription(UniformDescription uniform);
37
38 void SetShaderData(std::shared_ptr<fml::Mapping> shader);
39
40 void SetSkSLData(std::shared_ptr<fml::Mapping> sksl);
41
42 std::shared_ptr<fml::Mapping> CreateMapping() const;
43
44 std::shared_ptr<fml::Mapping> CreateJsonMapping() const;
45
46 private:
47 const std::string entrypoint_;
48 const spv::ExecutionModel stage_;
49 const TargetPlatform target_platform_;
50 std::vector<UniformDescription> uniforms_;
51 std::shared_ptr<fml::Mapping> shader_;
52 std::shared_ptr<fml::Mapping> sksl_;
53
54 FML_DISALLOW_COPY_AND_ASSIGN(RuntimeStageData);
55 };
56
57 } // namespace compiler
58 } // namespace impeller
impeller::compiler::RuntimeStageData::~RuntimeStageData
~RuntimeStageData()
impeller::compiler::RuntimeStageData::CreateJsonMapping
std::shared_ptr< fml::Mapping > CreateJsonMapping() const
Definition: runtime_stage_data.cc:221
impeller::compiler::RuntimeStageData::SetSkSLData
void SetSkSLData(std::shared_ptr< fml::Mapping > sksl)
Definition: runtime_stage_data.cc:35
impeller::compiler::RuntimeStageData::SetShaderData
void SetShaderData(std::shared_ptr< fml::Mapping > shader)
Definition: runtime_stage_data.cc:31
impeller::compiler::UniformDescription::type
spirv_cross::SPIRType::BaseType type
Definition: runtime_stage_data.h:21
impeller::compiler::RuntimeStageData
Definition: runtime_stage_data.h:28
impeller::compiler::UniformDescription::array_elements
std::optional< size_t > array_elements
Definition: runtime_stage_data.h:25
impeller::compiler::RuntimeStageData::RuntimeStageData
RuntimeStageData(std::string entrypoint, spv::ExecutionModel stage, TargetPlatform target_platform)
Definition: runtime_stage_data.cc:18
impeller::compiler::UniformDescription::columns
size_t columns
Definition: runtime_stage_data.h:23
impeller::compiler::UniformDescription::location
size_t location
Definition: runtime_stage_data.h:20
impeller::compiler::TargetPlatform
TargetPlatform
Definition: types.h:28
impeller::compiler::RuntimeStageData::CreateMapping
std::shared_ptr< fml::Mapping > CreateMapping() const
Definition: runtime_stage_data.cc:295
impeller::compiler::UniformDescription::name
std::string name
Definition: runtime_stage_data.h:19
impeller::compiler::UniformDescription::rows
size_t rows
Definition: runtime_stage_data.h:22
impeller::compiler::UniformDescription::bit_width
size_t bit_width
Definition: runtime_stage_data.h:24
impeller::compiler::RuntimeStageData::AddUniformDescription
void AddUniformDescription(UniformDescription uniform)
Definition: runtime_stage_data.cc:27
impeller::compiler::UniformDescription
Definition: runtime_stage_data.h:18
impeller
Definition: aiks_context.cc:10
types.h