Seperation

This commit is contained in:
Aiden
2026-05-12 14:57:18 +10:00
parent d07ea1f63a
commit 95b4a54326
6 changed files with 334 additions and 251 deletions

View File

@@ -0,0 +1,59 @@
#pragma once
#include "../control/ControlActionResult.h"
#include "../runtime/RuntimeLayerModel.h"
#include "../runtime/RuntimeShaderBridge.h"
#include "../runtime/SupportedShaderCatalog.h"
#include "../telemetry/CadenceTelemetry.h"
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
namespace RenderCadenceCompositor
{
class RuntimeLayerController
{
public:
using RenderLayerPublisher = std::function<void(const std::vector<RuntimeRenderLayerModel>&)>;
explicit RuntimeLayerController(RenderLayerPublisher publisher = RenderLayerPublisher());
RuntimeLayerController(const RuntimeLayerController&) = delete;
RuntimeLayerController& operator=(const RuntimeLayerController&) = delete;
~RuntimeLayerController();
void SetPublisher(RenderLayerPublisher publisher);
void Initialize(const std::string& shaderLibrary, unsigned maxTemporalHistoryFrames, std::string& runtimeShaderId);
void StartStartupBuild(const std::string& runtimeShaderId);
void Stop();
ControlActionResult HandleAddLayer(const std::string& body);
ControlActionResult HandleRemoveLayer(const std::string& body);
RuntimeLayerModelSnapshot Snapshot(const CadenceTelemetrySnapshot& telemetry) const;
const SupportedShaderCatalog& ShaderCatalog() const { return mShaderCatalog; }
private:
void LoadSupportedShaderCatalog(const std::string& shaderLibrary, unsigned maxTemporalHistoryFrames);
void InitializeLayerModel(std::string& runtimeShaderId);
void StartLayerShaderBuild(const std::string& layerId, const std::string& shaderId);
void StopLayerShaderBuild(const std::string& layerId);
void StopAllRuntimeShaderBuilds();
void PublishRuntimeRenderLayers();
bool MarkRuntimeBuildReady(const RuntimeShaderArtifact& artifact);
void MarkRuntimeBuildFailedForLayer(const std::string& layerId, const std::string& message);
std::string FirstRuntimeLayerId() const;
static bool ExtractStringField(const std::string& body, const char* fieldName, std::string& value, std::string& error);
RenderLayerPublisher mPublisher;
SupportedShaderCatalog mShaderCatalog;
mutable std::mutex mRuntimeLayerMutex;
RuntimeLayerModel mRuntimeLayerModel;
std::mutex mShaderBuildMutex;
std::map<std::string, std::unique_ptr<RuntimeShaderBridge>> mShaderBuilds;
};
}