Use the to_language parameter instead of choosing by platform
This commit is contained in:
parent
6db47e272f
commit
f50852abeb
1 changed files with 21 additions and 16 deletions
|
@ -97,21 +97,26 @@ std::optional<ShaderSource> ShaderCompiler::compile(const ShaderLanguage from_la
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_MACOS
|
switch(to_language) {
|
||||||
spirv_cross::CompilerMSL msl(std::move(spirv));
|
case ShaderLanguage::MSL:
|
||||||
|
{
|
||||||
spirv_cross::CompilerMSL::Options opts;
|
spirv_cross::CompilerMSL msl(std::move(spirv));
|
||||||
if(options.is_apple_mobile) {
|
|
||||||
opts.platform = spirv_cross::CompilerMSL::Options::Platform::macOS;
|
spirv_cross::CompilerMSL::Options opts;
|
||||||
} else {
|
if(options.is_apple_mobile) {
|
||||||
opts.platform = spirv_cross::CompilerMSL::Options::Platform::iOS;
|
opts.platform = spirv_cross::CompilerMSL::Options::Platform::macOS;
|
||||||
|
} else {
|
||||||
|
opts.platform = spirv_cross::CompilerMSL::Options::Platform::iOS;
|
||||||
|
}
|
||||||
|
opts.enable_decoration_binding = true;
|
||||||
|
|
||||||
|
msl.set_msl_options(opts);
|
||||||
|
|
||||||
|
return msl.compile();
|
||||||
|
}
|
||||||
|
case ShaderLanguage::SPIRV:
|
||||||
|
return spirv;
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
opts.enable_decoration_binding = true;
|
|
||||||
|
|
||||||
msl.set_msl_options(opts);
|
|
||||||
|
|
||||||
return msl.compile();
|
|
||||||
#else
|
|
||||||
return spirv;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue