mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 05:09:23 +02:00
pull task out of render and into its own lib
This commit is contained in:
parent
955af21aba
commit
8231a56b22
15 changed files with 44 additions and 40 deletions
|
@ -204,7 +204,7 @@ endif()
|
||||||
|
|
||||||
# link required hifi libraries
|
# link required hifi libraries
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
shared octree ktx gpu gl procedural graphics render
|
shared task octree ktx gpu gl procedural graphics render
|
||||||
pointers
|
pointers
|
||||||
recording fbx networking model-networking entities avatars trackers
|
recording fbx networking model-networking entities avatars trackers
|
||||||
audio audio-client animation script-engine physics
|
audio audio-client animation script-engine physics
|
||||||
|
|
|
@ -13,5 +13,6 @@ include_hifi_library_headers(entities-renderer)
|
||||||
include_hifi_library_headers(audio)
|
include_hifi_library_headers(audio)
|
||||||
include_hifi_library_headers(entities)
|
include_hifi_library_headers(entities)
|
||||||
include_hifi_library_headers(octree)
|
include_hifi_library_headers(octree)
|
||||||
|
include_hifi_library_headers(task)
|
||||||
|
|
||||||
target_bullet()
|
target_bullet()
|
||||||
|
|
|
@ -13,6 +13,7 @@ include_hifi_library_headers(fbx)
|
||||||
include_hifi_library_headers(entities)
|
include_hifi_library_headers(entities)
|
||||||
include_hifi_library_headers(avatars)
|
include_hifi_library_headers(avatars)
|
||||||
include_hifi_library_headers(controllers)
|
include_hifi_library_headers(controllers)
|
||||||
|
include_hifi_library_headers(task)
|
||||||
|
|
||||||
target_bullet()
|
target_bullet()
|
||||||
target_polyvox()
|
target_polyvox()
|
||||||
|
|
|
@ -3,10 +3,10 @@ AUTOSCRIBE_SHADER_LIB(gpu graphics render)
|
||||||
# pull in the resources.qrc file
|
# pull in the resources.qrc file
|
||||||
qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc")
|
qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc")
|
||||||
setup_hifi_library(Gui Network Qml Quick Script)
|
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(networking)
|
||||||
include_hifi_library_headers(octree)
|
include_hifi_library_headers(octree)
|
||||||
include_hifi_library_headers(audio)
|
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
target_nsight()
|
target_nsight()
|
||||||
|
|
|
@ -88,4 +88,4 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,5 +4,6 @@ setup_hifi_library()
|
||||||
|
|
||||||
# render needs octree only for getAccuracyAngle(float, int)
|
# render needs octree only for getAccuracyAngle(float, int)
|
||||||
link_hifi_libraries(shared ktx gpu graphics octree)
|
link_hifi_libraries(shared ktx gpu graphics octree)
|
||||||
|
include_hifi_library_headers(task)
|
||||||
|
|
||||||
target_nsight()
|
target_nsight()
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "Scene.h"
|
|
||||||
#include "../task/Task.h"
|
|
||||||
#include <gpu/Batch.h>
|
#include <gpu/Batch.h>
|
||||||
|
#include <task/Task.h>
|
||||||
|
|
||||||
|
#include "Scene.h"
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
|
|
|
@ -55,4 +55,4 @@ namespace render {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_render_SortTask_h;
|
#endif // hifi_render_SortTask_h;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "SettingHandle.h"
|
#include "SettingHandle.h"
|
||||||
|
|
||||||
#include "Logging.h"
|
//#include "Logging.h"
|
||||||
|
|
||||||
namespace task {
|
namespace task {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// Task.h
|
// Task.h
|
||||||
// render/src/task
|
// task/src/task
|
||||||
//
|
//
|
||||||
// Created by Zach Pomerantz on 1/6/2016.
|
// Created by Zach Pomerantz on 1/6/2016.
|
||||||
// Copyright 2016 High Fidelity, Inc.
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "SettingHandle.h"
|
#include "SettingHandle.h"
|
||||||
|
|
||||||
#include "Logging.h"
|
//#include "Logging.h"
|
||||||
|
|
||||||
#include <Profile.h>
|
#include <Profile.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
namespace task {
|
namespace task {
|
||||||
|
|
||||||
class JobConcept;
|
class JobConcept;
|
||||||
template <class RC> class JobT;
|
template <class JC> class JobT;
|
||||||
template <class RC> class TaskT;
|
template <class JC> class TaskT;
|
||||||
class JobNoIO {};
|
class JobNoIO {};
|
||||||
|
|
||||||
class JobContext {
|
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
|
// 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) {
|
template <class T, class JC> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, JobNoIO& output) {
|
||||||
data.run(renderContext);
|
data.run(jobContext);
|
||||||
}
|
}
|
||||||
template <class T, class RC, class I> void jobRun(T& data, const RC& renderContext, const I& input, JobNoIO& output) {
|
template <class T, class JC, class I> void jobRun(T& data, const JC& jobContext, const I& input, JobNoIO& output) {
|
||||||
data.run(renderContext, input);
|
data.run(jobContext, input);
|
||||||
}
|
}
|
||||||
template <class T, class RC, class O> void jobRun(T& data, const RC& renderContext, const JobNoIO& input, O& output) {
|
template <class T, class JC, class O> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, O& output) {
|
||||||
data.run(renderContext, 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) {
|
template <class T, class JC, class I, class O> void jobRun(T& data, const JC& jobContext, const I& input, O& output) {
|
||||||
data.run(renderContext, input, output);
|
data.run(jobContext, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RC>
|
template <class JC>
|
||||||
class Job {
|
class Job {
|
||||||
public:
|
public:
|
||||||
using Context = RC;
|
using Context = JC;
|
||||||
using ContextPointer = std::shared_ptr<Context>;
|
using ContextPointer = std::shared_ptr<Context>;
|
||||||
using Config = JobConfig;
|
using Config = JobConfig;
|
||||||
using None = JobNoIO;
|
using None = JobNoIO;
|
||||||
|
@ -94,7 +94,7 @@ public:
|
||||||
Concept(QConfigPointer config) : JobConcept(config) {}
|
Concept(QConfigPointer config) : JobConcept(config) {}
|
||||||
virtual ~Concept() = default;
|
virtual ~Concept() = default;
|
||||||
|
|
||||||
virtual void run(const ContextPointer& renderContext) = 0;
|
virtual void run(const ContextPointer& jobContext) = 0;
|
||||||
};
|
};
|
||||||
using ConceptPointer = std::shared_ptr<Concept>;
|
using ConceptPointer = std::shared_ptr<Concept>;
|
||||||
|
|
||||||
|
@ -130,12 +130,12 @@ public:
|
||||||
jobConfigure(_data, *std::static_pointer_cast<C>(Concept::_config));
|
jobConfigure(_data, *std::static_pointer_cast<C>(Concept::_config));
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const ContextPointer& renderContext) override {
|
void run(const ContextPointer& jobContext) override {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Config>(Concept::_config);
|
jobContext->jobConfig = std::static_pointer_cast<Config>(Concept::_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->isEnabled()) {
|
if (jobContext->jobConfig->alwaysEnabled || jobContext->jobConfig->isEnabled()) {
|
||||||
jobRun(_data, renderContext, _input.get<I>(), _output.edit<O>());
|
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>;
|
template <class T, class I, class C = Config> using ModelI = Model<T, C, I, None>;
|
||||||
|
@ -161,12 +161,12 @@ public:
|
||||||
return concept->_data;
|
return concept->_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void run(const ContextPointer& renderContext) {
|
virtual void run(const ContextPointer& jobContext) {
|
||||||
PerformanceTimer perfTimer(_name.c_str());
|
PerformanceTimer perfTimer(_name.c_str());
|
||||||
PROFILE_RANGE(render, _name.c_str());
|
//PROFILE_RANGE(render, _name.c_str());
|
||||||
auto start = usecTimestampNow();
|
auto start = usecTimestampNow();
|
||||||
|
|
||||||
_concept->run(renderContext);
|
_concept->run(jobContext);
|
||||||
|
|
||||||
_concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0);
|
_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
|
// 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
|
// where the input of the task can be setup to feed the child jobs
|
||||||
// and where the output of the task is defined
|
// and where the output of the task is defined
|
||||||
template <class RC>
|
template <class JC>
|
||||||
class Task : public Job<RC> {
|
class Task : public Job<JC> {
|
||||||
public:
|
public:
|
||||||
using Context = RC;
|
using Context = JC;
|
||||||
using ContextPointer = std::shared_ptr<Context>;
|
using ContextPointer = std::shared_ptr<Context>;
|
||||||
using Config = TaskConfig;
|
using Config = TaskConfig;
|
||||||
using JobType = Job<RC>;
|
using JobType = Job<JC>;
|
||||||
using None = typename JobType::None;
|
using None = typename JobType::None;
|
||||||
using Concept = typename JobType::Concept;
|
using Concept = typename JobType::Concept;
|
||||||
using ConceptPointer = typename JobType::ConceptPointer;
|
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);
|
auto config = std::static_pointer_cast<C>(Concept::_config);
|
||||||
if (config->alwaysEnabled || config->enabled) {
|
if (config->alwaysEnabled || config->enabled) {
|
||||||
for (auto job : TaskConcept::_jobs) {
|
for (auto job : TaskConcept::_jobs) {
|
||||||
job.run(renderContext);
|
job.run(jobContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ setup_hifi_project(Quick Gui Script)
|
||||||
setup_memory_debugger()
|
setup_memory_debugger()
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
shared networking gl
|
shared task networking gl
|
||||||
ktx gpu procedural octree image
|
ktx gpu procedural octree image
|
||||||
graphics model-networking fbx animation
|
graphics model-networking fbx animation
|
||||||
script-engine render render-utils
|
script-engine render render-utils
|
||||||
|
|
|
@ -13,7 +13,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||||
|
|
||||||
# link in the shared libraries
|
# link in the shared libraries
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
shared networking animation
|
shared task networking animation
|
||||||
ktx image octree gl gpu gpu-gl
|
ktx image octree gl gpu gpu-gl
|
||||||
render render-utils
|
render render-utils
|
||||||
graphics fbx model-networking
|
graphics fbx model-networking
|
||||||
|
|
|
@ -13,7 +13,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||||
|
|
||||||
# link in the shared libraries
|
# link in the shared libraries
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
shared networking octree
|
shared task networking octree
|
||||||
gl gpu render ktx image animation
|
gl gpu render ktx image animation
|
||||||
graphics fbx model-networking
|
graphics fbx model-networking
|
||||||
render-utils
|
render-utils
|
||||||
|
|
Loading…
Reference in a new issue