Flutter Impeller
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 #pragma once
6 
7 #include <codecvt>
8 #include <locale>
9 #include <string>
10 
11 #include "flutter/fml/macros.h"
12 #include "shaderc/shaderc.hpp"
13 #include "spirv_cross.hpp"
14 #include "spirv_msl.hpp"
15 
16 namespace impeller {
17 namespace compiler {
18 
19 enum class SourceType {
20  kUnknown,
26 };
27 
28 enum class TargetPlatform {
29  kUnknown,
31  kMetalIOS,
32  kOpenGLES,
34  kVulkan,
38  kSkSL,
39 };
40 
41 enum class SourceLanguage {
42  kUnknown,
43  kGLSL,
44  kHLSL,
45 };
46 
48 
50 
52 
53 SourceType SourceTypeFromFileName(const std::string& file_name);
54 
55 std::string SourceTypeToString(SourceType type);
56 
57 std::string TargetPlatformToString(TargetPlatform platform);
58 
59 std::string SourceLanguageToString(SourceLanguage source_language);
60 
61 std::string TargetPlatformSLExtension(TargetPlatform platform);
62 
64  const std::string& file_name,
65  SourceType type,
66  SourceLanguage source_language,
67  const std::string& entry_point_name);
68 
70 
72 
73 std::string ShaderCErrorToString(shaderc_compilation_status status);
74 
75 shaderc_shader_kind ToShaderCShaderKind(SourceType type);
76 
77 spv::ExecutionModel ToExecutionModel(SourceType type);
78 
79 spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(
80  TargetPlatform platform);
81 
82 } // namespace compiler
83 } // namespace impeller
impeller::compiler::SourceType::kUnknown
@ kUnknown
impeller::compiler::TargetPlatformSLExtension
std::string TargetPlatformSLExtension(TargetPlatform platform)
Definition: types.cc:243
impeller::compiler::TargetPlatform::kMetalDesktop
@ kMetalDesktop
impeller::compiler::TargetPlatformToMSLPlatform
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(TargetPlatform platform)
Definition: types.cc:205
impeller::compiler::SourceLanguageToString
std::string SourceLanguageToString(SourceLanguage source_language)
Definition: types.cc:79
impeller::compiler::TargetPlatformNeedsReflection
bool TargetPlatformNeedsReflection(TargetPlatform platform)
Definition: types.cc:126
impeller::compiler::TargetPlatform::kMetalIOS
@ kMetalIOS
impeller::compiler::SourceType::kTessellationControlShader
@ kTessellationControlShader
impeller::compiler::TargetPlatform
TargetPlatform
Definition: types.h:28
impeller::compiler::SourceLanguage::kGLSL
@ kGLSL
impeller::compiler::SourceLanguage::kHLSL
@ kHLSL
impeller::compiler::TargetPlatform::kVulkan
@ kVulkan
impeller::compiler::SourceType::kFragmentShader
@ kFragmentShader
impeller::compiler::TargetPlatform::kRuntimeStageVulkan
@ kRuntimeStageVulkan
impeller::compiler::SourceType::kComputeShader
@ kComputeShader
impeller::compiler::TargetPlatformIsOpenGL
bool TargetPlatformIsOpenGL(TargetPlatform platform)
Definition: types.cc:263
impeller::compiler::EntryPointFunctionNameFromSourceName
std::string EntryPointFunctionNameFromSourceName(const std::string &file_name, SourceType type, SourceLanguage source_language, const std::string &entry_point_name)
Definition: types.cc:90
impeller::compiler::TargetPlatformIsMetal
bool TargetPlatformIsMetal(TargetPlatform platform)
Definition: types.cc:281
impeller::compiler::TargetPlatformIsVulkan
bool TargetPlatformIsVulkan(TargetPlatform platform)
Definition: types.cc:299
impeller::compiler::SourceType
SourceType
Definition: types.h:19
impeller::compiler::SourceLanguage::kUnknown
@ kUnknown
impeller::compiler::ToExecutionModel
spv::ExecutionModel ToExecutionModel(SourceType type)
Definition: types.cc:187
impeller::compiler::SourceTypeFromFileName
SourceType SourceTypeFromFileName(const std::string &file_name)
Definition: types.cc:29
impeller::compiler::SourceLanguage
SourceLanguage
Definition: types.h:41
impeller::compiler::TargetPlatform::kOpenGLDesktop
@ kOpenGLDesktop
impeller::compiler::TargetPlatformToString
std::string TargetPlatformToString(TargetPlatform platform)
Definition: types.cc:53
impeller::compiler::TargetPlatform::kUnknown
@ kUnknown
impeller::compiler::SourceTypeToString
std::string SourceTypeToString(SourceType type)
Definition: types.cc:225
impeller::compiler::TargetPlatform::kOpenGLES
@ kOpenGLES
impeller::compiler::TargetPlatform::kRuntimeStageMetal
@ kRuntimeStageMetal
impeller::compiler::SourceType::kVertexShader
@ kVertexShader
impeller::compiler::ToShaderCShaderKind
shaderc_shader_kind ToShaderCShaderKind(SourceType type)
Definition: types.cc:169
impeller::compiler::TargetPlatformBundlesSkSL
bool TargetPlatformBundlesSkSL(TargetPlatform platform)
Definition: types.cc:317
impeller
Definition: aiks_context.cc:10
impeller::compiler::SourceType::kTessellationEvaluationShader
@ kTessellationEvaluationShader
impeller::compiler::ShaderCErrorToString
std::string ShaderCErrorToString(shaderc_compilation_status status)
Definition: types.cc:144
impeller::compiler::TargetPlatform::kSkSL
@ kSkSL
impeller::compiler::TargetPlatform::kRuntimeStageGLES
@ kRuntimeStageGLES