From 71ea10bf212e40b15070531af6fd5724b10f19c0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 3 Jun 2023 18:38:37 +0200 Subject: [PATCH] Dispatcher-Pipeline: implement the frame-tick core splitting into a sequence of builder types seems to have done the trick --- src/steam/engine/dispatcher.hpp | 102 +++++- .../steam/engine/job-planning-setup-test.cpp | 4 +- .../core/steam/play/dummy-builder-context.hpp | 246 +++++-------- .../core/steam/play/dummy-play-connection.hpp | 128 +------ wiki/renderengine.html | 26 +- wiki/thinkPad.ichthyo.mm | 322 +++++++++++++----- 6 files changed, 442 insertions(+), 386 deletions(-) diff --git a/src/steam/engine/dispatcher.hpp b/src/steam/engine/dispatcher.hpp index b2083afba..9ad16dfb1 100644 --- a/src/steam/engine/dispatcher.hpp +++ b/src/steam/engine/dispatcher.hpp @@ -48,11 +48,14 @@ //#include "lib/nocopy.hpp" #include +#include namespace steam { namespace engine { + using std::move; + using std::declval; using std::function; using mobject::ModelPort; using play::Timings; @@ -107,7 +110,13 @@ namespace engine { } }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete + public: //////////////////////////////////////////////////////////////////OOO TODO not public; need a way to pick up the result type + struct PipeFrameTick; + struct PipeSelector; + struct PipeExpander; + struct PipePlanner; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete using FrameNrIter = lib::NumIter; struct PipelineBuilder @@ -132,6 +141,7 @@ namespace engine { }); } }; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete public: @@ -139,12 +149,13 @@ namespace engine { /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete JobBuilder onCalcStream (ModelPort modelPort, uint channel); -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete PipelineBuilder forCalcStream(Timings timings, ModelPort port, DataSink sink) { return PipelineBuilder{FrameNrIter(), this, timings, port, sink}; } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1301 : obsolete + PipeFrameTick forCalcStream (Timings timings); protected: @@ -180,5 +191,94 @@ namespace engine { + + /* ======== Steps of the Job-planning Pipeline ======== */ + + /** + * Job-planning Step-1: establish a sequence of frame start times + */ + struct Dispatcher::PipeFrameTick + { + Dispatcher * const dispatcher; + const Timings timings; + + TimeVar currPoint{Time::NEVER}; + TimeVar stopPoint{Time::NEVER}; + FrameCnt frameNr{0}; + + + /* === state protocol API for IterStateWrapper === */ + bool + checkPoint() const + { + return currPoint < stopPoint; + } + + TimeVar const& + yield() const + { + return currPoint; + } + + void + iterNext() + { + ++frameNr; + currPoint = timings.getFrameStartAt (frameNr); + } + + + /** Builder Function: start frame sequence */ + auto + timeRange (Time start, Time after) + { + stopPoint = after; + frameNr = timings.getBreakPointAfter(start); + currPoint = timings.getFrameStartAt (frameNr); + + // start iterator pipeline based on this as »state core« + return lib::treeExplore (move(*this)); + } + + }; + + + inline Dispatcher::PipeFrameTick + Dispatcher::forCalcStream(Timings timings) + { + return PipeFrameTick{this, timings}; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////OOO need better solution for type rebinding + using Builder = decltype( declval().timeRange (declval