Render changes
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m59s
CI / Windows Release Package (push) Has been skipped

This commit is contained in:
Aiden
2026-05-12 14:36:36 +10:00
parent 1ddcf5d621
commit d07ea1f63a
7 changed files with 248 additions and 20 deletions

View File

@@ -237,7 +237,7 @@ private:
Log("runtime-shader", "Starting background Slang build for shader '" + mConfig.runtimeShaderId + "'.");
const std::string layerId = FirstRuntimeLayerId();
if (!layerId.empty())
StartLayerShaderBuild(layerId, mConfig.runtimeShaderId, true);
StartLayerShaderBuild(layerId, mConfig.runtimeShaderId);
}
void LoadSupportedShaderCatalog()
@@ -279,12 +279,16 @@ private:
mRuntimeLayerModel.MarkBuildStarted(layerId, message, error);
}
void MarkRuntimeBuildReady(const RuntimeShaderArtifact& artifact)
bool MarkRuntimeBuildReady(const RuntimeShaderArtifact& artifact)
{
std::lock_guard<std::mutex> lock(mRuntimeLayerMutex);
std::string error;
if (!mRuntimeLayerModel.MarkBuildReady(artifact, error))
{
LogWarning("runtime-shader", error);
return false;
}
return true;
}
void MarkRuntimeBuildFailed(const std::string& message)
@@ -308,7 +312,7 @@ private:
return mRuntimeLayerModel.FirstLayerId();
}
void StartLayerShaderBuild(const std::string& layerId, const std::string& shaderId, bool submitToRender)
void StartLayerShaderBuild(const std::string& layerId, const std::string& shaderId)
{
{
std::lock_guard<std::mutex> lock(mRuntimeLayerMutex);
@@ -329,10 +333,9 @@ private:
bridgePtr->Start(
layerId,
shaderId,
[this, submitToRender](const RuntimeShaderArtifact& artifact) {
MarkRuntimeBuildReady(artifact);
if (submitToRender)
mRenderThread.SubmitRuntimeShaderArtifact(artifact);
[this](const RuntimeShaderArtifact& artifact) {
if (MarkRuntimeBuildReady(artifact))
PublishRuntimeRenderLayers();
},
[this, layerId](const std::string& message) {
MarkRuntimeBuildFailedForLayer(layerId, message);
@@ -379,7 +382,8 @@ private:
return { false, error };
}
StartLayerShaderBuild(layerId, shaderId, false);
Log("runtime-shader", "Layer added: " + layerId + " shader=" + shaderId);
StartLayerShaderBuild(layerId, shaderId);
return { true, std::string() };
}
@@ -396,10 +400,22 @@ private:
return { false, error };
}
Log("runtime-shader", "Layer removed: " + layerId);
StopLayerShaderBuild(layerId);
PublishRuntimeRenderLayers();
return { true, std::string() };
}
void PublishRuntimeRenderLayers()
{
std::vector<RuntimeRenderLayerModel> renderLayers;
{
std::lock_guard<std::mutex> lock(mRuntimeLayerMutex);
renderLayers = mRuntimeLayerModel.Snapshot().renderLayers;
}
mRenderThread.SubmitRuntimeRenderLayers(renderLayers);
}
static bool ExtractStringField(const std::string& body, const char* fieldName, std::string& value, std::string& error)
{
JsonValue root;