18 std::string extension = file_name.extension().string();
19 if (extension ==
".vert") {
23 if (extension ==
".frag") {
27 if (extension ==
".comp") {
37 if (
name ==
"vertex") {
41 if (
name ==
"fragment") {
45 if (
name ==
"compute") {
53 if (source_language ==
"glsl") {
56 if (source_language ==
"hlsl") {
67 return "MetalDesktop";
73 return "OpenGLDesktop";
77 return "RuntimeStageMetal";
79 return "RuntimeStageGLES";
81 return "RuntimeStageGLES3";
83 return "RuntimeStageVulkan";
91 switch (source_language) {
102 const std::filesystem::path& file_name,
105 const std::string& entry_point_name) {
107 return entry_point_name;
110 std::stringstream stream;
120 stream <<
"fragment";
150 using Status = shaderc_compilation_status;
152 case Status::shaderc_compilation_status_success:
154 case Status::shaderc_compilation_status_invalid_stage:
155 return "Invalid shader stage specified";
156 case Status::shaderc_compilation_status_compilation_error:
157 return "Compilation error";
158 case Status::shaderc_compilation_status_internal_error:
159 return "Internal error";
160 case Status::shaderc_compilation_status_null_result_object:
161 return "Internal error. Null result object";
162 case Status::shaderc_compilation_status_invalid_assembly:
163 return "Invalid assembly";
164 case Status::shaderc_compilation_status_validation_error:
165 return "Validation error";
166 case Status::shaderc_compilation_status_transformation_error:
167 return "Transform error";
168 case Status::shaderc_compilation_status_configuration_error:
169 return "Configuration error";
171 return "Unknown internal error";
177 return shaderc_shader_kind::shaderc_vertex_shader;
179 return shaderc_shader_kind::shaderc_fragment_shader;
181 return shaderc_shader_kind::shaderc_compute_shader;
185 return shaderc_shader_kind::shaderc_glsl_infer_from_source;
191 return spv::ExecutionModel::ExecutionModelVertex;
193 return spv::ExecutionModel::ExecutionModelFragment;
195 return spv::ExecutionModel::ExecutionModelGLCompute;
199 return spv::ExecutionModel::ExecutionModelMax;
207 return spirv_cross::CompilerMSL::Options::Platform::iOS;
209 return spirv_cross::CompilerMSL::Options::Platform::macOS;
218 return spirv_cross::CompilerMSL::Options::Platform::macOS;
#define FML_UNREACHABLE()
std::string ConvertToEntrypointName(std::string_view string)
Ensure that the entrypoint name is a valid identifier in the target language.
std::string ToLowerCase(std::string_view string)
std::string SourceLanguageToString(SourceLanguage source_language)
std::string TargetPlatformToString(TargetPlatform platform)
std::string TargetPlatformSLExtension(TargetPlatform platform)
shaderc_shader_kind ToShaderCShaderKind(SourceType type)
std::string SourceTypeToString(SourceType type)
SourceType SourceTypeFromFileName(const std::filesystem::path &file_name)
std::string EntryPointFunctionNameFromSourceName(const std::filesystem::path &file_name, SourceType type, SourceLanguage source_language, const std::string &entry_point_name)
SourceType SourceTypeFromString(std::string name)
bool TargetPlatformIsMetal(TargetPlatform platform)
bool TargetPlatformIsOpenGL(TargetPlatform platform)
std::string ShaderCErrorToString(shaderc_compilation_status status)
bool TargetPlatformIsVulkan(TargetPlatform platform)
std::string Utf8FromPath(const std::filesystem::path &path)
Converts a native format path to a utf8 string.
bool TargetPlatformBundlesSkSL(TargetPlatform platform)
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(TargetPlatform platform)
SourceLanguage ToSourceLanguage(const std::string &source_language)
bool TargetPlatformNeedsReflection(TargetPlatform platform)
spv::ExecutionModel ToExecutionModel(SourceType type)