phase 1 runtime complete
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m46s
CI / Windows Release Package (push) Successful in 2m59s

This commit is contained in:
Aiden
2026-05-11 02:23:01 +10:00
parent cbf1b541dc
commit 9cbb5d8004
20 changed files with 265 additions and 1288 deletions

View File

@@ -3,8 +3,6 @@
#include "RuntimeStateJson.h"
#include "RuntimeStore.h"
#include <mutex>
std::string RuntimeStatePresenter::BuildRuntimeStateJson(const RuntimeStore& runtimeStore)
{
return SerializeJson(BuildRuntimeStateValue(runtimeStore), true);
@@ -12,30 +10,30 @@ std::string RuntimeStatePresenter::BuildRuntimeStateJson(const RuntimeStore& run
JsonValue RuntimeStatePresenter::BuildRuntimeStateValue(const RuntimeStore& runtimeStore)
{
const HealthTelemetry::Snapshot telemetrySnapshot = runtimeStore.mHealthTelemetry.GetSnapshot();
std::lock_guard<std::mutex> lock(runtimeStore.mMutex);
const RuntimeStatePresentationReadModel model = runtimeStore.BuildRuntimeStatePresentationReadModel();
const HealthTelemetry::Snapshot& telemetrySnapshot = model.telemetry;
JsonValue root = JsonValue::MakeObject();
JsonValue app = JsonValue::MakeObject();
app.set("serverPort", JsonValue(static_cast<double>(runtimeStore.mServerPort)));
app.set("oscPort", JsonValue(static_cast<double>(runtimeStore.mConfigStore.GetConfig().oscPort)));
app.set("oscBindAddress", JsonValue(runtimeStore.mConfigStore.GetConfig().oscBindAddress));
app.set("oscSmoothing", JsonValue(runtimeStore.mConfigStore.GetConfig().oscSmoothing));
app.set("autoReload", JsonValue(runtimeStore.mAutoReloadEnabled));
app.set("maxTemporalHistoryFrames", JsonValue(static_cast<double>(runtimeStore.mConfigStore.GetConfig().maxTemporalHistoryFrames)));
app.set("previewFps", JsonValue(static_cast<double>(runtimeStore.mConfigStore.GetConfig().previewFps)));
app.set("enableExternalKeying", JsonValue(runtimeStore.mConfigStore.GetConfig().enableExternalKeying));
app.set("inputVideoFormat", JsonValue(runtimeStore.mConfigStore.GetConfig().inputVideoFormat));
app.set("inputFrameRate", JsonValue(runtimeStore.mConfigStore.GetConfig().inputFrameRate));
app.set("outputVideoFormat", JsonValue(runtimeStore.mConfigStore.GetConfig().outputVideoFormat));
app.set("outputFrameRate", JsonValue(runtimeStore.mConfigStore.GetConfig().outputFrameRate));
app.set("serverPort", JsonValue(static_cast<double>(model.serverPort)));
app.set("oscPort", JsonValue(static_cast<double>(model.config.oscPort)));
app.set("oscBindAddress", JsonValue(model.config.oscBindAddress));
app.set("oscSmoothing", JsonValue(model.config.oscSmoothing));
app.set("autoReload", JsonValue(model.autoReloadEnabled));
app.set("maxTemporalHistoryFrames", JsonValue(static_cast<double>(model.config.maxTemporalHistoryFrames)));
app.set("previewFps", JsonValue(static_cast<double>(model.config.previewFps)));
app.set("enableExternalKeying", JsonValue(model.config.enableExternalKeying));
app.set("inputVideoFormat", JsonValue(model.config.inputVideoFormat));
app.set("inputFrameRate", JsonValue(model.config.inputFrameRate));
app.set("outputVideoFormat", JsonValue(model.config.outputVideoFormat));
app.set("outputFrameRate", JsonValue(model.config.outputFrameRate));
root.set("app", app);
JsonValue runtime = JsonValue::MakeObject();
runtime.set("layerCount", JsonValue(static_cast<double>(runtimeStore.mLayerStack.LayerCount())));
runtime.set("compileSucceeded", JsonValue(runtimeStore.mCompileSucceeded));
runtime.set("compileMessage", JsonValue(runtimeStore.mCompileMessage));
runtime.set("layerCount", JsonValue(static_cast<double>(model.layerStack.LayerCount())));
runtime.set("compileSucceeded", JsonValue(model.compileSucceeded));
runtime.set("compileMessage", JsonValue(model.compileMessage));
root.set("runtime", runtime);
JsonValue video = JsonValue::MakeObject();
@@ -83,7 +81,7 @@ JsonValue RuntimeStatePresenter::BuildRuntimeStateValue(const RuntimeStore& runt
root.set("performance", performance);
JsonValue shaderLibrary = JsonValue::MakeArray();
for (const ShaderPackageStatus& status : runtimeStore.mShaderCatalog.PackageStatuses())
for (const ShaderPackageStatus& status : model.packageStatuses)
{
JsonValue shader = JsonValue::MakeObject();
shader.set("id", JsonValue(status.id));
@@ -94,21 +92,23 @@ JsonValue RuntimeStatePresenter::BuildRuntimeStateValue(const RuntimeStore& runt
if (!status.available)
shader.set("error", JsonValue(status.error));
const ShaderPackage* shaderPackage = runtimeStore.mShaderCatalog.FindPackage(status.id);
if (status.available && shaderPackage && shaderPackage->temporal.enabled)
auto shaderIt = model.shaderCatalog.packagesById.find(status.id);
if (status.available && shaderIt != model.shaderCatalog.packagesById.end() && shaderIt->second.temporal.enabled)
{
const ShaderPackage& shaderPackage = shaderIt->second;
JsonValue temporal = JsonValue::MakeObject();
temporal.set("enabled", JsonValue(true));
temporal.set("historySource", JsonValue(RuntimeStateJson::TemporalHistorySourceToString(shaderPackage->temporal.historySource)));
temporal.set("requestedHistoryLength", JsonValue(static_cast<double>(shaderPackage->temporal.requestedHistoryLength)));
temporal.set("effectiveHistoryLength", JsonValue(static_cast<double>(shaderPackage->temporal.effectiveHistoryLength)));
temporal.set("historySource", JsonValue(RuntimeStateJson::TemporalHistorySourceToString(shaderPackage.temporal.historySource)));
temporal.set("requestedHistoryLength", JsonValue(static_cast<double>(shaderPackage.temporal.requestedHistoryLength)));
temporal.set("effectiveHistoryLength", JsonValue(static_cast<double>(shaderPackage.temporal.effectiveHistoryLength)));
shader.set("temporal", temporal);
}
if (status.available && shaderPackage && shaderPackage->feedback.enabled)
if (status.available && shaderIt != model.shaderCatalog.packagesById.end() && shaderIt->second.feedback.enabled)
{
const ShaderPackage& shaderPackage = shaderIt->second;
JsonValue feedback = JsonValue::MakeObject();
feedback.set("enabled", JsonValue(true));
feedback.set("writePass", JsonValue(shaderPackage->feedback.writePassId));
feedback.set("writePass", JsonValue(shaderPackage.feedback.writePassId));
shader.set("feedback", feedback);
}
shaderLibrary.pushBack(shader);
@@ -116,10 +116,10 @@ JsonValue RuntimeStatePresenter::BuildRuntimeStateValue(const RuntimeStore& runt
root.set("shaders", shaderLibrary);
JsonValue stackPresets = JsonValue::MakeArray();
for (const std::string& presetName : runtimeStore.GetStackPresetNamesLocked())
for (const std::string& presetName : model.stackPresetNames)
stackPresets.pushBack(JsonValue(presetName));
root.set("stackPresets", stackPresets);
root.set("layers", RuntimeStateJson::SerializeLayerStack(runtimeStore.mLayerStack, runtimeStore.mShaderCatalog));
root.set("layers", RuntimeStateJson::SerializeLayerStack(model.layerStack.Layers(), model.shaderCatalog.packagesById));
return root;
}