50 #ifndef STEAM_ENGINE_WEAVING_PATTERN_H 51 #define STEAM_ENGINE_WEAVING_PATTERN_H 94 StateClosure& parent_;
95 StateClosure& current_;
97 StateAdapter (StateClosure& callingProcess)
98 : parent_ (callingProcess),
99 current_(callingProcess.getCurrentImplementation())
102 virtual StateClosure& getCurrentImplementation () {
return current_; }
108 virtual void releaseBuffer (BuffHandle& bh) { current_.releaseBuffer (bh); }
110 virtual void is_calculated (BuffHandle
const& bh) { current_.is_calculated (bh); }
112 virtual BuffHandle fetch (FrameID
const& fID) {
return current_.fetch (fID); }
114 virtual BuffTableStorage& getBuffTableStorage() {
return current_.getBuffTableStorage(); }
139 Connectivity
const& wiring;
142 FeedManifold* feedManifold;
146 Invocation (StateClosure& callingProcess, Connectivity
const& w, uint o)
147 : StateAdapter(callingProcess),
153 uint nrO()
const {
return wiring.nrO; }
154 uint nrI()
const {
return wiring.nrI; }
155 uint buffTabSize()
const {
return nrO()+nrI(); }
158 void setBuffTab (FeedManifold* b) { this->feedManifold = b; }
161 buffTab_isConsistent ()
163 return (feedManifold)
164 && (0 < buffTabSize())
165 && (nrO()+nrI() <= buffTabSize())
166 && (feedManifold->inBuff == &feedManifold->outBuff[nrO()] )
167 && (feedManifold->inHandle == &feedManifold->outHandle[nrO()])
175 virtual FrameID
const&
178 return current_.genFrameID(wiring.nodeID, outNr);
181 virtual FrameID
const&
184 return current_.genFrameID (nID,chanNo);
191 struct AllocBufferFromParent
194 AllocBufferFromParent (StateClosure& sta, Connectivity
const& w,
const uint outCh)
201 struct AllocBufferFromCache
204 AllocBufferFromCache (StateClosure& sta, Connectivity
const& w,
const uint outCh)
227 template<
class Strategy,
class BufferProv
ider>
228 class ActualInvocationProcess
229 :
public BufferProvider
233 ActualInvocationProcess (StateClosure& callingProcess, Connectivity
const& w,
const uint outCh)
234 : BufferProvider(callingProcess, w, outCh)
243 return Strategy::step (*
this);
262 struct SimpleWeavingPattern
265 using Feed =
typename INVO::Feed;
267 static_assert (_verify_usable_as_InvocationAdapter<Feed>());
269 Several<PortRef> leadPort;
270 Several<BuffDescr> outTypes;
275 template<
typename...ARGS>
280 : INVO{forward<ARGS>(args)...}
283 , resultSlot{resultIdx}
290 return INVO::buildFeed();
296 for (uint i=0; i<leadPort.size(); ++i)
298 BuffHandle inputData = leadPort[i].get().weave (turnoutSys);
299 feed.inBuff.createAt(i, move(inputData));
304 shed (Feed& feed, OptionalBuff outBuff)
306 for (uint i=0; i<outTypes.size(); ++i)
309 i == resultSlot and outBuff? *outBuff
310 : outTypes[i].lockBuffer();
311 feed.outBuff.createAt(i, move(resultData));
313 feed.connect (leadPort.size(),outTypes.size());
325 for (uint i=0; i<leadPort.size(); ++i)
327 feed.inBuff[i].release();
329 for (uint i=0; i<outTypes.size(); ++i)
331 feed.outBuff[i].emit();
333 feed.outBuff[i].release();
335 ENSURE (resultSlot < INVO::MAX_SIZ,
"invalid result buffer configured.");
336 return feed.outBuff[resultSlot];
355 using Feed =
typename PAT::Feed;
358 template<
typename...INIT>
361 , PAT{forward<INIT> (init)...}
372 Feed feed = PAT::mount();
373 PAT::pull(feed, turnoutSys);
374 PAT::shed(feed, outBuff);
376 return PAT::fix (feed);
Basic set of definitions and includes commonly used together.
Processing structure to activate a Render Node and produce result data.
Invocation(StateClosure_OBSOLETE &callingProcess, Connectivity const &w, uint o)
creates a new invocation context state, without FeedManifold
SimpleWeavingPattern(Several< PortRef > &&pr, Several< BuffDescr > &&dr, uint resultIdx, ARGS &&...args)
forwarding-ctor to provide the detailed input/output connections
auto retrieve(void *streamType)
Entrance point for defining data flows and processing steps.
Communication hub to coordinate and activate the »Render Node Network« performance.
Steam-Layer implementation namespace root.
Abstraction interface: array-like random access by subscript.
virtual BuffHandle allocateBuffer(const lumiera::StreamType *)=0
allocate a new writable buffer with type and size according to the BuffDescr.
void setBuffTab(FeedManifold *b)
setup the link to an externally allocated buffer table
Metaprogramming tools for transforming functor types.
Abstraction: Fixed array of elements.
Interface to the processing nodes and the render nodes network.
BuffHandle weave(TurnoutSystem &turnoutSys, OptionalBuff outBuff=std::nullopt) override
Entrance point to the next recursive step of media processing.
Handle for a buffer for processing data, abstracting away the actual implementation.
virtual FrameID const & genFrameID()
specialised version filling in the additional information, i.e the concrete node id and the channel n...
THe actual state of a frame rendering evaluation parametrised for a single job.