feat: start loading some stuff async
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <destrum/FS/AssetFS.h>
|
||||
#include <destrum/Graphics/Material.h>
|
||||
#include <destrum/Serialization/MaterialSerialization.h>
|
||||
#include <destrum/Threading/JobSystem.h>
|
||||
#include <destrum/Util/ImGuiUtils.h>
|
||||
|
||||
namespace {
|
||||
@@ -219,7 +220,7 @@ void AssetBrowser::StartCook()
|
||||
return;
|
||||
}
|
||||
|
||||
m_Cook = std::async(std::launch::async, [commands = std::move(commands)] {
|
||||
m_Cook = JobSystem::GetInstance().Async([commands = std::move(commands)] {
|
||||
bool succeeded = true;
|
||||
for (const std::string& command : commands) {
|
||||
succeeded = std::system(command.c_str()) == 0 && succeeded;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <destrum/Threading/JobSystem.h>
|
||||
|
||||
namespace {
|
||||
constexpr float PollInterval = 0.5f;
|
||||
|
||||
@@ -48,7 +50,7 @@ void ShaderHotReload::StartCook()
|
||||
// cmd.exe strips the outer quotes, the inner ones keep paths with spaces intact
|
||||
const std::string command = "\"\"" + m_Cooker.string() + "\" --input \"" + m_SourceRoot.string() +
|
||||
"\" --output \"" + m_RuntimeRoot.string() + "\"\"";
|
||||
m_Cook = std::async(std::launch::async, [command] { return std::system(command.c_str()); });
|
||||
m_Cook = JobSystem::GetInstance().Async([command] { return std::system(command.c_str()); });
|
||||
spdlog::info("Shader sources changed, cooking engine assets");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user