check if shaders compiled successfully

This commit is contained in:
Samuliak 2025-01-15 19:30:46 +01:00
parent 371c089923
commit f5eb184969
No known key found for this signature in database
2 changed files with 11 additions and 4 deletions

View file

@ -103,11 +103,16 @@ inline bool FormatIsRenderable(Latte::E_GX2SURFFMT format)
}
template <typename... T>
inline void executeCommand(fmt::format_string<T...> fmt, T&&... args) {
inline bool executeCommand(fmt::format_string<T...> fmt, T&&... args) {
std::string command = fmt::format(fmt, std::forward<T>(args)...);
int res = system(command.c_str());
if (res != 0)
{
cemuLog_log(LogType::Force, "command \"{}\" failed with exit code {}", command, res);
return false;
}
return true;
}
class MemoryMappedFile

View file

@ -29,7 +29,7 @@ public:
if (m_threadsActive.exchange(true))
return;
// create thread pool
const uint32 threadCount = 8;
const uint32 threadCount = 2;
for (uint32 i = 0; i < threadCount; ++i)
s_threads.emplace_back(&ShaderMtlThreadPool::CompilerThreadFunc, this);
}
@ -295,8 +295,10 @@ void RendererShaderMtl::CompileInternal()
mslFile.close();
// Compile
executeCommand("xcrun -sdk macosx metal -o {}.ir -c {}.metal -w", baseFilename, baseFilename);
executeCommand("xcrun -sdk macosx metallib -o {}.metallib {}.ir", baseFilename, baseFilename);
if (!executeCommand("xcrun -sdk macosx metal -o {}.ir -c {}.metal -w", baseFilename, baseFilename))
return;
if (!executeCommand("xcrun -sdk macosx metallib -o {}.metallib {}.ir", baseFilename, baseFilename))
return;
// Clean up
executeCommand("rm {}.metal", baseFilename);