Pass JobConfig to jobs

This commit is contained in:
Zach Pomerantz 2016-01-22 14:31:58 -08:00
parent 5698be5435
commit c903fc4739
2 changed files with 15 additions and 8 deletions

View file

@ -28,6 +28,8 @@ using SceneContextPointer = std::shared_ptr<SceneContext>;
const int showDisplayStatusFlag = 1;
const int showNetworkStatusFlag = 2;
class JobConfig;
class RenderContext {
public:
class ItemsConfig {
@ -107,6 +109,7 @@ public:
int _deferredDebugMode;
glm::vec4 _deferredDebugSize;
std::shared_ptr<JobConfig> jobConfig{ nullptr };
protected:
RenderArgs* _args;

View file

@ -128,10 +128,11 @@ public:
}
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
std::shared_ptr<Job::Config>& config = std::static_pointer_cast<Job::Config>(_config);
if (config->alwaysEnabled || config->enabled) {
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
jobRun(_data, sceneContext, renderContext);
}
renderContext->jobConfig.reset();
}
};
@ -154,10 +155,11 @@ public:
}
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
std::shared_ptr<Job::Config>& config = std::static_pointer_cast<Job::Config>(_config);
if (config->alwaysEnabled || config->enabled) {
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
jobRunI(_data, sceneContext, renderContext, _input.get<I>());
}
renderContext->jobConfig.reset();
}
};
@ -180,10 +182,11 @@ public:
}
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
std::shared_ptr<Job::Config>& config = std::static_pointer_cast<Job::Config>(_config);
if (config->alwaysEnabled || config->enabled) {
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
}
renderContext->jobConfig.reset();
}
};
@ -209,10 +212,11 @@ public:
}
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
std::shared_ptr<Job::Config>& config = std::static_pointer_cast<Job::Config>(_config);
if (config->alwaysEnabled || config->enabled) {
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
jobRunIO(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>());
}
renderContext->jobConfig.reset();
}
};