diff --git a/src/proc/engine/dispatcher.cpp b/src/proc/engine/dispatcher.cpp index 12c51d981..07a22728c 100644 --- a/src/proc/engine/dispatcher.cpp +++ b/src/proc/engine/dispatcher.cpp @@ -34,7 +34,7 @@ namespace engine { /** */ - Dispatcher::CoordBuilder + Dispatcher::JobBuilder Dispatcher::onCalcStream (ModelPort modelPort, uint channel) { UNIMPLEMENTED ("build coordinates of frame to render"); @@ -43,12 +43,32 @@ namespace engine { /** */ FrameCoord - Dispatcher::CoordBuilder::relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset) + Dispatcher::JobBuilder::relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset) { UNIMPLEMENTED ("build coordinates of frame to render"); } + /** */ + Dispatcher::JobBuilder& + Dispatcher::JobBuilder::establishNextJobs (TimeAnchor refPoint) + { + UNIMPLEMENTED ("job planning and generation"); + return *this; + } + + + /** */ + Dispatcher::JobBuilder& + Dispatcher::JobBuilder::prepareContinuation (function delayedAction) + { + UNIMPLEMENTED ("wrap already planned jobs, appending a continuation to pick up later"); + return *this; + } + + + + /** */ JobTicket& Dispatcher::accessJobTicket (FrameCoord const& frameID) diff --git a/src/proc/engine/dispatcher.hpp b/src/proc/engine/dispatcher.hpp index babefd615..e7409be4a 100644 --- a/src/proc/engine/dispatcher.hpp +++ b/src/proc/engine/dispatcher.hpp @@ -33,12 +33,13 @@ #include "lib/time/timevalue.hpp" #include - +#include namespace proc { namespace engine { + using std::tr1::function; using mobject::ModelPort; using lib::time::TimeSpan; using lib::time::FSecs; @@ -52,19 +53,32 @@ namespace engine { class Dispatcher : boost::noncopyable { - struct CoordBuilder + struct JobBuilder { Dispatcher& dispatcher_; ModelPort modelPort_; uint channel_; - FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset); + FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset); + + JobBuilder& establishNextJobs (TimeAnchor refPoint); + + JobBuilder& prepareContinuation (function delayedAction); + + operator JobTicket::JobsPlanning() + { + UNIMPLEMENTED ("how to represent the closure for defining and scheduling jobs"); + + ////////TODO: use a closure based on the JobTicket (which can be accessed through the dispatcher backlink) + //////////// Because this closure is what backs the IterSource, it needs to have a reliable storage though. + } + }; public: virtual ~Dispatcher(); ///< this is an interface - CoordBuilder onCalcStream (ModelPort modelPort, uint channel); + JobBuilder onCalcStream (ModelPort modelPort, uint channel); JobTicket& accessJobTicket (FrameCoord const&); diff --git a/src/proc/engine/job-ticket.hpp b/src/proc/engine/job-ticket.hpp index 8fb4034ff..ef54308a9 100644 --- a/src/proc/engine/job-ticket.hpp +++ b/src/proc/engine/job-ticket.hpp @@ -99,8 +99,8 @@ namespace engine { } - JobsPlanning - createJobsFor (FrameCoord coordinates) + Job + createJobFor (FrameCoord coordinates) { UNIMPLEMENTED ("job planning and generation"); } diff --git a/src/proc/engine/job.hpp b/src/proc/engine/job.hpp index c184b77e4..b8349bb98 100644 --- a/src/proc/engine/job.hpp +++ b/src/proc/engine/job.hpp @@ -42,6 +42,13 @@ enum JobState ABORTED ///< got aborted }; +enum JobKind + { + CALC_JOB, ///< calculating frame data, CPU bound + LOAD_JOB, ///< accessing prerequisites, IO bound + META_JOB ///< render process self organisation + }; + /** * closure representing the execution context of a job. @@ -109,7 +116,8 @@ typedef lumiera_jobDescriptor* LumieraJobDescriptor; #ifdef __cplusplus /* ============== C++ Interface ================= */ -#include "proc/common.hpp" +//#include "proc/common.hpp" +#include "lib/error.hpp" //#include "proc/state.hpp" #include "lib/time/timevalue.hpp" //#include "lib/time/timequant.hpp" @@ -172,9 +180,16 @@ using lib::time::Time; return this->parameter.invoKey; } + JobKind getKind() const; bool isValid() const; }; + + inline JobKind + Job::getKind() const + { + UNIMPLEMENTED ("need a better C-representation of the job"); + } }} // namespace proc::engine diff --git a/tests/components/proc/engine/dispatcher-interface-test.cpp b/tests/components/proc/engine/dispatcher-interface-test.cpp index ffab7088c..ab721989d 100644 --- a/tests/components/proc/engine/dispatcher-interface-test.cpp +++ b/tests/components/proc/engine/dispatcher-interface-test.cpp @@ -156,10 +156,10 @@ namespace test { JobTicket& executionPlan = dispatcher.accessJobTicket (coordinates); CHECK (executionPlan.isValid()); -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 Job frameJob = executionPlan.createJobFor (coordinates); CHECK (frameJob.getNominalTime() == coordinates.absoluteNominalTime); CHECK (0 < frameJob.getInvocationInstanceID()); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 } @@ -179,7 +179,6 @@ namespace test { TimeAnchor refPoint = TimeAnchor::build (timings, startFrame); -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 JobTicket::JobsPlanning jobs = dispatcher.onCalcStream(modelPort,channel) .establishNextJobs(refPoint); @@ -192,7 +191,8 @@ namespace test { uint chunksize = plannedChunk.size(); CHECK (chunksize == timings.getPlanningChunkSize()); - TimeVar nextFrameStart = refPoint; + TimeVar nextFrameStart (refPoint); + InvocationInstanceID prevInvocationID(0); Offset expectedTimeIncrement (1, FrameRate::PAL); for (uint i=0; i < chunksize; ++i ) { @@ -203,6 +203,7 @@ namespace test { prevInvocationID = thisJob.getInvocationInstanceID(); nextFrameStart += expectedTimeIncrement; } +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 } @@ -228,14 +229,13 @@ namespace test { function testFunc = verify_invocation_of_Continuation; TimeAnchor refPoint = TimeAnchor::build (timings, startFrame); -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 JobTicket::JobsPlanning jobs = dispatcher.onCalcStream(modelPort,channel) .establishNextJobs(refPoint) .prepareContinuation(testFunc); // an additional "continuation" Job has been prepared.... Job continuation = lib::pull_last(jobs); - CHECK (META_JOB = continuation.getKind()); + CHECK (META_JOB == continuation.getKind()); uint nrJobs = timings.getPlanningChunkSize(); Duration frameDuration (1, FrameRate::PAL); @@ -247,6 +247,7 @@ namespace test { // Since we passed testFunc as action for the continuation, we expect the invocation // of the function verify_invocation_of_Continuation() continuation.triggerJob(); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880 }