Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
types.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#ifndef FLUTTER_IMPELLER_COMPILER_TYPES_H_
6#define FLUTTER_IMPELLER_COMPILER_TYPES_H_
7
8#include <codecvt>
9#include <filesystem>
10#include <locale>
11#include <map>
12#include <optional>
13#include <string>
14
15#include "shaderc/shaderc.hpp"
16#include "spirv_cross.hpp"
17#include "spirv_msl.hpp"
18
19namespace impeller {
20namespace compiler {
21
28
42
43enum class SourceLanguage {
45 kGLSL,
46 kHLSL,
47};
48
50 std::string name;
51 size_t location = 0u;
52 size_t binding = 0u;
53 spirv_cross::SPIRType::BaseType type = spirv_cross::SPIRType::BaseType::Float;
54 size_t rows = 0u;
55 size_t columns = 0u;
56 size_t bit_width = 0u;
57 std::optional<size_t> array_elements = std::nullopt;
58 std::vector<uint8_t> struct_layout = {};
59 size_t struct_float_count = 0u;
60};
61
63 std::string name;
64 size_t location;
65 size_t set;
66 size_t binding;
67 spirv_cross::SPIRType::BaseType type =
68 spirv_cross::SPIRType::BaseType::Unknown;
69 size_t bit_width;
70 size_t vec_size;
71 size_t columns;
72 size_t offset;
73};
74
75/// A shader config parsed as part of a ShaderBundleConfig.
82
83using ShaderBundleConfig = std::unordered_map<std::string, ShaderConfig>;
84
86
88
90
91SourceType SourceTypeFromFileName(const std::filesystem::path& file_name);
92
94
96
97std::string TargetPlatformToString(TargetPlatform platform);
98
99SourceLanguage ToSourceLanguage(const std::string& source_language);
100
101std::string SourceLanguageToString(SourceLanguage source_language);
102
103std::string TargetPlatformSLExtension(TargetPlatform platform);
104
106 const std::filesystem::path& file_name,
108 SourceLanguage source_language,
109 const std::string& entry_point_name);
110
112
114
115std::string ShaderCErrorToString(shaderc_compilation_status status);
116
117shaderc_shader_kind ToShaderCShaderKind(SourceType type);
118
119spv::ExecutionModel ToExecutionModel(SourceType type);
120
121spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(
122 TargetPlatform platform);
123
124} // namespace compiler
125} // namespace impeller
126
127#endif // FLUTTER_IMPELLER_COMPILER_TYPES_H_
GLenum type
const char * name
Definition fuchsia.cc:49
std::string SourceLanguageToString(SourceLanguage source_language)
Definition types.cc:90
std::string TargetPlatformToString(TargetPlatform platform)
Definition types.cc:62
std::string TargetPlatformSLExtension(TargetPlatform platform)
Definition types.cc:237
shaderc_shader_kind ToShaderCShaderKind(SourceType type)
Definition types.cc:174
std::string SourceTypeToString(SourceType type)
Definition types.cc:223
SourceType SourceTypeFromFileName(const std::filesystem::path &file_name)
Definition types.cc:17
std::unordered_map< std::string, ShaderConfig > ShaderBundleConfig
Definition types.h:83
std::string EntryPointFunctionNameFromSourceName(const std::filesystem::path &file_name, SourceType type, SourceLanguage source_language, const std::string &entry_point_name)
Definition types.cc:101
SourceType SourceTypeFromString(std::string name)
Definition types.cc:34
bool TargetPlatformIsMetal(TargetPlatform platform)
Definition types.cc:277
bool TargetPlatformIsOpenGL(TargetPlatform platform)
Definition types.cc:258
std::string ShaderCErrorToString(shaderc_compilation_status status)
Definition types.cc:149
bool TargetPlatformIsVulkan(TargetPlatform platform)
Definition types.cc:296
bool TargetPlatformBundlesSkSL(TargetPlatform platform)
Definition types.cc:315
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(TargetPlatform platform)
Definition types.cc:202
SourceLanguage ToSourceLanguage(const std::string &source_language)
Definition types.cc:52
bool TargetPlatformNeedsReflection(TargetPlatform platform)
Definition types.cc:130
spv::ExecutionModel ToExecutionModel(SourceType type)
Definition types.cc:188
spirv_cross::SPIRType::BaseType type
Definition types.h:67
A shader config parsed as part of a ShaderBundleConfig.
Definition types.h:76
spirv_cross::SPIRType::BaseType type
Definition types.h:53
std::optional< size_t > array_elements
Definition types.h:57
std::vector< uint8_t > struct_layout
Definition types.h:58