pull task out of render and into its own lib

This commit is contained in:
Andrew Meadows 2018-02-08 14:19:19 -08:00
parent 955af21aba
commit 8231a56b22
15 changed files with 44 additions and 40 deletions

View file

@ -204,7 +204,7 @@ endif()
# link required hifi libraries
link_hifi_libraries(
shared octree ktx gpu gl procedural graphics render
shared task octree ktx gpu gl procedural graphics render
pointers
recording fbx networking model-networking entities avatars trackers
audio audio-client animation script-engine physics

View file

@ -13,5 +13,6 @@ include_hifi_library_headers(entities-renderer)
include_hifi_library_headers(audio)
include_hifi_library_headers(entities)
include_hifi_library_headers(octree)
include_hifi_library_headers(task)
target_bullet()

View file

@ -13,6 +13,7 @@ include_hifi_library_headers(fbx)
include_hifi_library_headers(entities)
include_hifi_library_headers(avatars)
include_hifi_library_headers(controllers)
include_hifi_library_headers(task)
target_bullet()
target_polyvox()

View file

@ -3,10 +3,10 @@ AUTOSCRIBE_SHADER_LIB(gpu graphics render)
# pull in the resources.qrc file
qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc")
setup_hifi_library(Gui Network Qml Quick Script)
link_hifi_libraries(shared ktx gpu graphics model-networking render animation fbx image procedural)
link_hifi_libraries(shared task ktx gpu graphics model-networking render animation fbx image procedural)
include_hifi_library_headers(audio)
include_hifi_library_headers(networking)
include_hifi_library_headers(octree)
include_hifi_library_headers(audio)
if (NOT ANDROID)
target_nsight()

View file

@ -88,4 +88,4 @@ protected:
};
#endif
#endif

View file

@ -4,5 +4,6 @@ setup_hifi_library()
# render needs octree only for getAccuracyAngle(float, int)
link_hifi_libraries(shared ktx gpu graphics octree)
include_hifi_library_headers(task)
target_nsight()

View file

@ -14,9 +14,10 @@
#include <SettingHandle.h>
#include "Scene.h"
#include "../task/Task.h"
#include <gpu/Batch.h>
#include <task/Task.h>
#include "Scene.h"
namespace render {

View file

@ -55,4 +55,4 @@ namespace render {
};
}
#endif // hifi_render_SortTask_h;
#endif // hifi_render_SortTask_h;

View file

@ -20,7 +20,7 @@
#include "SettingHandle.h"
#include "Logging.h"
//#include "Logging.h"
namespace task {

View file

@ -1,6 +1,6 @@
//
// Task.h
// render/src/task
// task/src/task
//
// Created by Zach Pomerantz on 1/6/2016.
// Copyright 2016 High Fidelity, Inc.
@ -17,7 +17,7 @@
#include "SettingHandle.h"
#include "Logging.h"
//#include "Logging.h"
#include <Profile.h>
#include <PerfStat.h>
@ -25,8 +25,8 @@
namespace task {
class JobConcept;
template <class RC> class JobT;
template <class RC> class TaskT;
template <class JC> class JobT;
template <class JC> class TaskT;
class JobNoIO {};
class JobContext {
@ -68,23 +68,23 @@ template<class T> void jobConfigure(T&, const TaskConfig&) {
// nop, as the default TaskConfig was used, so the data does not need a configure method
}
template <class T, class RC> void jobRun(T& data, const RC& renderContext, const JobNoIO& input, JobNoIO& output) {
data.run(renderContext);
template <class T, class JC> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, JobNoIO& output) {
data.run(jobContext);
}
template <class T, class RC, class I> void jobRun(T& data, const RC& renderContext, const I& input, JobNoIO& output) {
data.run(renderContext, input);
template <class T, class JC, class I> void jobRun(T& data, const JC& jobContext, const I& input, JobNoIO& output) {
data.run(jobContext, input);
}
template <class T, class RC, class O> void jobRun(T& data, const RC& renderContext, const JobNoIO& input, O& output) {
data.run(renderContext, output);
template <class T, class JC, class O> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, O& output) {
data.run(jobContext, output);
}
template <class T, class RC, class I, class O> void jobRun(T& data, const RC& renderContext, const I& input, O& output) {
data.run(renderContext, input, output);
template <class T, class JC, class I, class O> void jobRun(T& data, const JC& jobContext, const I& input, O& output) {
data.run(jobContext, input, output);
}
template <class RC>
template <class JC>
class Job {
public:
using Context = RC;
using Context = JC;
using ContextPointer = std::shared_ptr<Context>;
using Config = JobConfig;
using None = JobNoIO;
@ -94,7 +94,7 @@ public:
Concept(QConfigPointer config) : JobConcept(config) {}
virtual ~Concept() = default;
virtual void run(const ContextPointer& renderContext) = 0;
virtual void run(const ContextPointer& jobContext) = 0;
};
using ConceptPointer = std::shared_ptr<Concept>;
@ -130,12 +130,12 @@ public:
jobConfigure(_data, *std::static_pointer_cast<C>(Concept::_config));
}
void run(const ContextPointer& renderContext) override {
renderContext->jobConfig = std::static_pointer_cast<Config>(Concept::_config);
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->isEnabled()) {
jobRun(_data, renderContext, _input.get<I>(), _output.edit<O>());
void run(const ContextPointer& jobContext) override {
jobContext->jobConfig = std::static_pointer_cast<Config>(Concept::_config);
if (jobContext->jobConfig->alwaysEnabled || jobContext->jobConfig->isEnabled()) {
jobRun(_data, jobContext, _input.get<I>(), _output.edit<O>());
}
renderContext->jobConfig.reset();
jobContext->jobConfig.reset();
}
};
template <class T, class I, class C = Config> using ModelI = Model<T, C, I, None>;
@ -161,12 +161,12 @@ public:
return concept->_data;
}
virtual void run(const ContextPointer& renderContext) {
virtual void run(const ContextPointer& jobContext) {
PerformanceTimer perfTimer(_name.c_str());
PROFILE_RANGE(render, _name.c_str());
//PROFILE_RANGE(render, _name.c_str());
auto start = usecTimestampNow();
_concept->run(renderContext);
_concept->run(jobContext);
_concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0);
}
@ -186,13 +186,13 @@ protected:
// The build method is where child Jobs can be added internally to the task
// where the input of the task can be setup to feed the child jobs
// and where the output of the task is defined
template <class RC>
class Task : public Job<RC> {
template <class JC>
class Task : public Job<JC> {
public:
using Context = RC;
using Context = JC;
using ContextPointer = std::shared_ptr<Context>;
using Config = TaskConfig;
using JobType = Job<RC>;
using JobType = Job<JC>;
using None = typename JobType::None;
using Concept = typename JobType::Concept;
using ConceptPointer = typename JobType::ConceptPointer;
@ -300,11 +300,11 @@ public:
}
}
void run(const ContextPointer& renderContext) override {
void run(const ContextPointer& jobContext) override {
auto config = std::static_pointer_cast<C>(Concept::_config);
if (config->alwaysEnabled || config->enabled) {
for (auto job : TaskConcept::_jobs) {
job.run(renderContext);
job.run(jobContext);
}
}
}

View file

@ -5,7 +5,7 @@ setup_hifi_project(Quick Gui Script)
setup_memory_debugger()
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
link_hifi_libraries(
shared networking gl
shared task networking gl
ktx gpu procedural octree image
graphics model-networking fbx animation
script-engine render render-utils

View file

@ -13,7 +13,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
# link in the shared libraries
link_hifi_libraries(
shared networking animation
shared task networking animation
ktx image octree gl gpu gpu-gl
render render-utils
graphics fbx model-networking

View file

@ -13,7 +13,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
# link in the shared libraries
link_hifi_libraries(
shared networking octree
shared task networking octree
gl gpu render ktx image animation
graphics fbx model-networking
render-utils