More changes
This commit is contained in:
@@ -36,6 +36,9 @@ void RuntimeLayerController::InitializeLayerModel(std::string& runtimeShaderId)
|
||||
if (InitializeLayerModelFromRuntimeState())
|
||||
return;
|
||||
|
||||
if (!runtimeShaderId.empty())
|
||||
Log("runtime-state", "Falling back to configured runtime shader '" + runtimeShaderId + "'.");
|
||||
|
||||
std::lock_guard<std::mutex> lock(mRuntimeLayerMutex);
|
||||
std::string error;
|
||||
if (!mRuntimeLayerModel.InitializeSingleLayer(mShaderCatalog, runtimeShaderId, error))
|
||||
@@ -48,9 +51,11 @@ void RuntimeLayerController::InitializeLayerModel(std::string& runtimeShaderId)
|
||||
|
||||
bool RuntimeLayerController::InitializeLayerModelFromRuntimeState()
|
||||
{
|
||||
const std::filesystem::path runtimeStatePath = FindRepoPath("runtime/runtime_state.json");
|
||||
const std::filesystem::path runtimeStatePath = mRuntimeStatePath.empty() ? ResolveRuntimeStatePath() : mRuntimeStatePath;
|
||||
if (runtimeStatePath.empty())
|
||||
return false;
|
||||
if (!std::filesystem::exists(runtimeStatePath))
|
||||
return false;
|
||||
|
||||
std::ifstream input(runtimeStatePath, std::ios::binary);
|
||||
if (!input)
|
||||
@@ -83,6 +88,25 @@ bool RuntimeLayerController::InitializeLayerModelFromRuntimeState()
|
||||
return true;
|
||||
}
|
||||
|
||||
std::filesystem::path RuntimeLayerController::ResolveRuntimeStatePath() const
|
||||
{
|
||||
const std::filesystem::path runtimeDirectory = FindRepoPath("runtime");
|
||||
if (!runtimeDirectory.empty())
|
||||
return runtimeDirectory / "runtime_state.json";
|
||||
return std::filesystem::current_path() / "runtime" / "runtime_state.json";
|
||||
}
|
||||
|
||||
void RuntimeLayerController::RequestRuntimeStatePersistence()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mRuntimeLayerMutex);
|
||||
RequestRuntimeStatePersistenceLocked();
|
||||
}
|
||||
|
||||
void RuntimeLayerController::RequestRuntimeStatePersistenceLocked()
|
||||
{
|
||||
mPersistenceWriter.RequestSave(mRuntimeLayerModel.Snapshot());
|
||||
}
|
||||
|
||||
void RuntimeLayerController::StartLayerShaderBuild(const std::string& layerId, const std::string& shaderId)
|
||||
{
|
||||
CleanupRetiredShaderBuilds();
|
||||
|
||||
Reference in New Issue
Block a user