move job planning implementation to separate compilation unit

This commit is contained in:
Fischlurch 2013-09-01 02:26:46 +02:00
parent 3932a820a3
commit bb0b4578ec
2 changed files with 79 additions and 53 deletions

View file

@ -22,16 +22,86 @@
#include "proc/engine/calc-plan-continuation.hpp"
#include "proc/engine/frame-coord.hpp"
#include "proc/engine/job-ticket.hpp"
#include "lib/time/timevalue.hpp"
//#include "lib/frameid.hpp"
//#include "proc/state.hpp"
#include <boost/functional/hash.hpp>
namespace proc {
namespace engine {
/** */
/** entry point (interface JobClosure): invoke the concrete job operation.
* In this case, the job operation is responsible for planning a chunk of actual render jobs.
*/
void
CalcPlanContinuation::invokeJobOperation (JobParameter parameter)
{
ASSERT (parameter.nominalTime == timings_.getFrameStartAt (parameter.invoKey.frameNumber));
this->performJobPlanningChunk (parameter.invoKey.frameNumber);
}
void
CalcPlanContinuation::signalFailure (JobParameter parameter, JobFailureReason reason)
{
UNIMPLEMENTED ("what needs to be done when a planning continuation cant be invoked?");
}
bool
CalcPlanContinuation::verify (Time nominalJobTime) const
{
UNIMPLEMENTED ("verify the planning coordinates");
return false;
}
size_t
CalcPlanContinuation::hashOfInstance (InvocationInstanceID invoKey) const
{
return boost::hash_value (invoKey.frameNumber);
}
Job
CalcPlanContinuation::prepareRenderPlanningFrom (int64_t startFrame)
{
InvocationInstanceID invoKey;
invoKey.frameNumber = startFrame;
Time nominalPlanningStartTime = timings_.getFrameStartAt (startFrame);
return Job(*this, invoKey, nominalPlanningStartTime);
}
void
CalcPlanContinuation::performJobPlanningChunk(int64_t nextStartFrame)
{
TimeAnchor refPoint(timings_, nextStartFrame);
JobPlanningSequence jobs = dispatcher_.onCalcStream(modelPort_, channel_)
.establishNextJobs(refPoint);
Job nextChunkOfPlanning = buildFollowUpJobFrom (refPoint);
UNIMPLEMENTED ("the actual meat: access the scheduler and fed those jobs");
}
Job
CalcPlanContinuation::buildFollowUpJobFrom (TimeAnchor const& refPoint)
{
return this->prepareRenderPlanningFrom(
refPoint.getNextAnchorPoint());
}

View file

@ -27,15 +27,11 @@
#include "proc/common.hpp"
#include "proc/mobject/model-port.hpp"
#include "proc/engine/time-anchor.hpp"
#include "proc/engine/frame-coord.hpp"
#include "proc/engine/job-ticket.hpp"
#include "proc/engine/dispatcher.hpp"
#include "proc/play/timings.hpp"
#include "backend/engine/job.h"
#include "lib/time/timevalue.hpp"
#include <boost/noncopyable.hpp>
//#include <tr1/functional>
namespace proc {
@ -79,28 +75,13 @@ namespace engine {
return META_JOB;
}
bool
verify (Time nominalJobTime) const
{
UNIMPLEMENTED ("verify the planning coordinates");
return false;
}
bool verify (Time nominalJobTime) const;
size_t hashOfInstance (InvocationInstanceID) const;
void
invokeJobOperation (JobParameter parameter)
{
ASSERT (parameter.nominalTime == timings_.getFrameStartAt (parameter.invoKey.frameNumber));
this->performJobPlanningChunk (parameter.invoKey.frameNumber);
}
void invokeJobOperation (JobParameter);
void signalFailure (JobParameter, JobFailureReason);
void
signalFailure (JobParameter parameter, JobFailureReason reason)
{
UNIMPLEMENTED ("what needs to be done when a planning continuation cant be invoked?");
}
public:
@ -126,37 +107,12 @@ namespace engine {
* @param startFrame where to begin rendering, relative to the nominal
* time grid implicitly related to the ModelPort to be pulled
*/
Job
prepareRenderPlanningFrom (int64_t startFrame)
{
InvocationInstanceID invoKey;
invoKey.frameNumber = startFrame;
Time nominalPlanningStartTime = timings_.getFrameStartAt (startFrame);
return Job(*this, invoKey, nominalPlanningStartTime);
}
Job prepareRenderPlanningFrom (int64_t startFrame);
private:
void
performJobPlanningChunk(int64_t nextStartFrame)
{
TimeAnchor refPoint(timings_, nextStartFrame);
JobPlanningSequence jobs = dispatcher_.onCalcStream(modelPort_, channel_)
.establishNextJobs(refPoint);
Job nextChunkOfPlanning = buildFollowUpJobFrom (refPoint);
UNIMPLEMENTED ("the actual meat: access the scheduler and fed those jobs");
}
Job
buildFollowUpJobFrom (TimeAnchor const& refPoint)
{
return this->prepareRenderPlanningFrom(
refPoint.getNextAnchorPoint());
}
void performJobPlanningChunk(int64_t nextStartFrame);
Job buildFollowUpJobFrom (TimeAnchor const& refPoint);
};