@@ -34,6 +34,18 @@ SourceType SourceTypeFromFileName(const std::string& file_name) {
3434 return SourceType::kFragmentShader ;
3535 }
3636
37+ if (StringEndWith (file_name, " .tesc" )) {
38+ return SourceType::kTessellationControlShader ;
39+ }
40+
41+ if (StringEndWith (file_name, " .tese" )) {
42+ return SourceType::kTessellationEvaluationShader ;
43+ }
44+
45+ if (StringEndWith (file_name, " .comp" )) {
46+ return SourceType::kComputeShader ;
47+ }
48+
3749 return SourceType::kUnknown ;
3850}
3951
@@ -70,6 +82,15 @@ std::string EntryPointFunctionNameFromSourceName(const std::string& file_name,
7082 case SourceType::kFragmentShader :
7183 stream << " fragment" ;
7284 break ;
85+ case SourceType::kTessellationControlShader :
86+ stream << " tess_control" ;
87+ break ;
88+ case SourceType::kTessellationEvaluationShader :
89+ stream << " tess_eval" ;
90+ break ;
91+ case SourceType::kComputeShader :
92+ stream << " compute" ;
93+ break ;
7394 }
7495 stream << " _main" ;
7596 return stream.str ();
@@ -134,6 +155,12 @@ shaderc_shader_kind ToShaderCShaderKind(SourceType type) {
134155 return shaderc_shader_kind::shaderc_vertex_shader;
135156 case SourceType::kFragmentShader :
136157 return shaderc_shader_kind::shaderc_fragment_shader;
158+ case SourceType::kTessellationControlShader :
159+ return shaderc_shader_kind::shaderc_tess_control_shader;
160+ case SourceType::kTessellationEvaluationShader :
161+ return shaderc_shader_kind::shaderc_tess_evaluation_shader;
162+ case SourceType::kComputeShader :
163+ return shaderc_shader_kind::shaderc_compute_shader;
137164 case SourceType::kUnknown :
138165 break ;
139166 }
@@ -146,6 +173,12 @@ spv::ExecutionModel ToExecutionModel(SourceType type) {
146173 return spv::ExecutionModel::ExecutionModelVertex;
147174 case SourceType::kFragmentShader :
148175 return spv::ExecutionModel::ExecutionModelFragment;
176+ case SourceType::kTessellationControlShader :
177+ return spv::ExecutionModel::ExecutionModelTessellationControl;
178+ case SourceType::kTessellationEvaluationShader :
179+ return spv::ExecutionModel::ExecutionModelTessellationEvaluation;
180+ case SourceType::kComputeShader :
181+ return spv::ExecutionModel::ExecutionModelGLCompute;
149182 case SourceType::kUnknown :
150183 break ;
151184 }
@@ -176,6 +209,12 @@ std::string SourceTypeToString(SourceType type) {
176209 return " vert" ;
177210 case SourceType::kFragmentShader :
178211 return " frag" ;
212+ case SourceType::kTessellationControlShader :
213+ return " tesc" ;
214+ case SourceType::kTessellationEvaluationShader :
215+ return " tese" ;
216+ case SourceType::kComputeShader :
217+ return " comp" ;
179218 }
180219 FML_UNREACHABLE ();
181220}
@@ -204,5 +243,31 @@ std::string ToUtf8(const std::string& string) {
204243 return string;
205244}
206245
246+ bool TargetPlatformIsOpenGL (TargetPlatform platform) {
247+ switch (platform) {
248+ case TargetPlatform::kOpenGLES :
249+ case TargetPlatform::kOpenGLDesktop :
250+ return true ;
251+ case TargetPlatform::kMetalDesktop :
252+ case TargetPlatform::kMetalIOS :
253+ case TargetPlatform::kUnknown :
254+ case TargetPlatform::kFlutterSPIRV :
255+ return false ;
256+ }
257+ }
258+
259+ bool TargetPlatformIsMetal (TargetPlatform platform) {
260+ switch (platform) {
261+ case TargetPlatform::kMetalDesktop :
262+ case TargetPlatform::kMetalIOS :
263+ return true ;
264+ case TargetPlatform::kUnknown :
265+ case TargetPlatform::kFlutterSPIRV :
266+ case TargetPlatform::kOpenGLES :
267+ case TargetPlatform::kOpenGLDesktop :
268+ return false ;
269+ }
270+ }
271+
207272} // namespace compiler
208273} // namespace impeller
0 commit comments