RuntimeStateBroadcastRequested
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include "RuntimeUpdateController.h"
|
#include "RuntimeUpdateController.h"
|
||||||
|
|
||||||
#include "RenderEngine.h"
|
#include "RenderEngine.h"
|
||||||
|
#include "RuntimeEventDispatcher.h"
|
||||||
#include "RuntimeServices.h"
|
#include "RuntimeServices.h"
|
||||||
#include "RuntimeStore.h"
|
#include "RuntimeStore.h"
|
||||||
#include "ShaderBuildQueue.h"
|
#include "ShaderBuildQueue.h"
|
||||||
@@ -24,6 +25,9 @@ RuntimeUpdateController::RuntimeUpdateController(
|
|||||||
mShaderBuildQueue(shaderBuildQueue),
|
mShaderBuildQueue(shaderBuildQueue),
|
||||||
mVideoBackend(videoBackend)
|
mVideoBackend(videoBackend)
|
||||||
{
|
{
|
||||||
|
mRuntimeEventDispatcher.Subscribe(
|
||||||
|
RuntimeEventType::RuntimeStateBroadcastRequested,
|
||||||
|
[this](const RuntimeEvent& event) { HandleRuntimeStateBroadcastRequested(event); });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResult& result, std::string* error)
|
bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResult& result, std::string* error)
|
||||||
@@ -62,6 +66,8 @@ bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordin
|
|||||||
|
|
||||||
bool RuntimeUpdateController::ProcessRuntimeWork()
|
bool RuntimeUpdateController::ProcessRuntimeWork()
|
||||||
{
|
{
|
||||||
|
mRuntimeEventDispatcher.DispatchPending();
|
||||||
|
|
||||||
bool shaderBuildRequested = false;
|
bool shaderBuildRequested = false;
|
||||||
std::vector<RuntimeCoordinatorServiceResult> serviceResults;
|
std::vector<RuntimeCoordinatorServiceResult> serviceResults;
|
||||||
mRuntimeServices.ConsumeRuntimeCoordinatorResults(serviceResults);
|
mRuntimeServices.ConsumeRuntimeCoordinatorResults(serviceResults);
|
||||||
@@ -101,5 +107,19 @@ void RuntimeUpdateController::RequestShaderBuild()
|
|||||||
|
|
||||||
void RuntimeUpdateController::BroadcastRuntimeState()
|
void RuntimeUpdateController::BroadcastRuntimeState()
|
||||||
{
|
{
|
||||||
|
RuntimeStateBroadcastRequestedEvent event;
|
||||||
|
event.reason = "runtime-state-changed";
|
||||||
|
if (!mRuntimeEventDispatcher.PublishPayload(event, "RuntimeUpdateController"))
|
||||||
|
{
|
||||||
|
mRuntimeServices.BroadcastState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mRuntimeEventDispatcher.DispatchPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RuntimeUpdateController::HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event)
|
||||||
|
{
|
||||||
|
(void)event;
|
||||||
mRuntimeServices.BroadcastState();
|
mRuntimeServices.BroadcastState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class RenderEngine;
|
class RenderEngine;
|
||||||
|
struct RuntimeEvent;
|
||||||
class RuntimeEventDispatcher;
|
class RuntimeEventDispatcher;
|
||||||
class RuntimeServices;
|
class RuntimeServices;
|
||||||
class RuntimeStore;
|
class RuntimeStore;
|
||||||
@@ -29,6 +30,8 @@ public:
|
|||||||
void BroadcastRuntimeState();
|
void BroadcastRuntimeState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event);
|
||||||
|
|
||||||
RuntimeStore& mRuntimeStore;
|
RuntimeStore& mRuntimeStore;
|
||||||
RuntimeCoordinator& mRuntimeCoordinator;
|
RuntimeCoordinator& mRuntimeCoordinator;
|
||||||
RuntimeEventDispatcher& mRuntimeEventDispatcher;
|
RuntimeEventDispatcher& mRuntimeEventDispatcher;
|
||||||
|
|||||||
Reference in New Issue
Block a user