diff --git a/src/steam/engine/channel-descriptor.hpp b/src/steam/engine/channel-descriptor-obsolete.hpp similarity index 86% rename from src/steam/engine/channel-descriptor.hpp rename to src/steam/engine/channel-descriptor-obsolete.hpp index 88dc10180..ab0c4ee6e 100644 --- a/src/steam/engine/channel-descriptor.hpp +++ b/src/steam/engine/channel-descriptor-obsolete.hpp @@ -11,13 +11,15 @@ */ -/** @file channel-descriptor.hpp +/** @file channel-descriptor-obsolete.hpp ** Representation of the Media type of a data channel used within the engine. ** ** @todo as it stands (11/2011) this file is obsoleted and needs to be refactored, ** alongside with adapting the node invocation to the new BufferProvider interface. ** @todo as of 5/2024, this will be retained as part of the `FeedManifold`, ** which in turn takes on some aspects of the old buffer table draft. + ** @deprecated 12/2024 it is now clear that the low-level-Model will be really low-level, + ** implying that any connection to the usage domain will be completely resolved in the builder ** ** @see nodewiring-def.hpp ** @see nodeoperation.hpp @@ -46,8 +48,8 @@ namespace engine { - class ProcNode; - typedef ProcNode* PNode; + class ProcNode_Obsolete; + typedef ProcNode_Obsolete* PNode; struct ChannelDescriptor ///////TODO really need to define that here? it is needed for node wiring only diff --git a/src/steam/engine/connectivity-obsolete.hpp b/src/steam/engine/connectivity-obsolete.hpp index dbac4afdc..8885bdeae 100644 --- a/src/steam/engine/connectivity-obsolete.hpp +++ b/src/steam/engine/connectivity-obsolete.hpp @@ -42,7 +42,7 @@ #include "steam/asset/proc.hpp" #include "steam/mobject/parameter.hpp" #include "steam/engine/state-closure-obsolete.hpp" /////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation -#include "steam/engine/channel-descriptor.hpp" +#include "steam/engine/channel-descriptor-obsolete.hpp" #include "lib/frameid.hpp" #include "lib/ref-array.hpp" @@ -57,8 +57,8 @@ namespace engine { using lumiera::NodeID; /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation - class ProcNode; - typedef ProcNode* PNode; + class ProcNode_Obsolete; + typedef ProcNode_Obsolete* PNode; /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation @@ -112,7 +112,7 @@ namespace engine { /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation /* ==== strategy API for configuring the node operation ==== */ - friend class ProcNode; /////////////////////////////////TODO 1/12 : wouldn't it be better to extract that API into a distinct strategy? + friend class ProcNode_Obsolete; /////////////////////////////////TODO 1/12 : wouldn't it be better to extract that API into a distinct strategy? /** the wiring-dependent part of the node operation. * Includes the creation of a one-way state object on the stack @@ -139,7 +139,7 @@ namespace engine { * ProcNode as a frontend entirely. * @todo WIP-WIP-WIP 2024 Node-Invocation is reworked from ground up for the »Playback Vertical Slice« */ - class ProcNode + class ProcNode_Obsolete : util::NonCopyable { typedef mobject::Parameter Param; //////TODO: just a placeholder for automation as of 6/2008 @@ -149,11 +149,11 @@ namespace engine { public: /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation - ProcNode (Connectivity const& wd) + ProcNode_Obsolete (Connectivity const& wd) : wiringConfig_(wd) { } - virtual ~ProcNode() {}; /////////////////////////TODO: do we still intend to build a hierarchy below ProcNode??? + virtual ~ProcNode_Obsolete() {}; /////////////////////////TODO: do we still intend to build a hierarchy below ProcNode??? /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation @@ -190,7 +190,7 @@ namespace engine { /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation inline bool - ProcNode::isValid() const + ProcNode_Obsolete::isValid() const { UNIMPLEMENTED ("ProcNode validity self-check"); return false; //////////////////////////TODO diff --git a/src/steam/engine/feed-manifold-obsolete.hpp b/src/steam/engine/feed-manifold-obsolete.hpp index ad7fa2df7..376880253 100644 --- a/src/steam/engine/feed-manifold-obsolete.hpp +++ b/src/steam/engine/feed-manifold-obsolete.hpp @@ -26,7 +26,7 @@ #include "lib/error.hpp" #include "lib/nocopy.hpp" -#include "steam/engine/channel-descriptor.hpp" +#include "steam/engine/channel-descriptor-obsolete.hpp" //#include "steam/engine/proc-node.hpp" ///////////////////////////////TODO this is a dead end #include "steam/engine/connectivity-obsolete.hpp" diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp index ecbb051e6..112b92f4d 100644 --- a/src/steam/engine/node-builder.hpp +++ b/src/steam/engine/node-builder.hpp @@ -215,7 +215,7 @@ namespace engine { patternData_.collectEntries(ports); return Connectivity{ports.build() ,leads_.build() - ,NodeID{}}; //////////////////////////////////////OOO what's the purpose of the NodeID?? + }; } }; diff --git a/src/steam/engine/node-factory.cpp b/src/steam/engine/node-factory.cpp index 46db19a94..7a1e0e07d 100644 --- a/src/steam/engine/node-factory.cpp +++ b/src/steam/engine/node-factory.cpp @@ -50,19 +50,19 @@ namespace engine { * @todo as of 2016 this is the only (placeholder) implementation * to indicate how building and wiring of nodes was meant to happen */ +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation PNode NodeFactory::operator() (Placement const& effect, WiringSituation& intendedWiring) { -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation intendedWiring.resolveProcessor(effect->getProcAsset()); Connectivity& wiring = wiringFac_(intendedWiring); ProcNode& newNode = alloc_.create (wiring); ENSURE (newNode.isValid()); return &newNode; -#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation - UNIMPLEMENTED ("Node Factory for reworked Render Node Connectivity"); } + UNIMPLEMENTED ("Node Factory for reworked Render Node Connectivity"); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation }} // namespace engine diff --git a/src/steam/engine/node-factory.hpp b/src/steam/engine/node-factory.hpp index fee4738f9..2b96c0e6f 100644 --- a/src/steam/engine/node-factory.hpp +++ b/src/steam/engine/node-factory.hpp @@ -50,11 +50,7 @@ namespace engine { using std::vector; using lib::AllocationCluster; - ///////////////////////////// TODO: as of 9/09, it seems no longer necessary to use any subclasses of ProcNode - class Trafo; - typedef Trafo* PTrafo; ///< @note ProcNode is handled by pointer and bulk allocated/deallocated - - class WiringSituation; +// class WiringSituation; /** @@ -76,7 +72,10 @@ namespace engine { { } +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation PNode operator() (mobject::session::PEffect const&, WiringSituation&); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation + }; diff --git a/src/steam/engine/nodeinvocation.hpp b/src/steam/engine/nodeinvocation-obsolete.hpp similarity index 97% rename from src/steam/engine/nodeinvocation.hpp rename to src/steam/engine/nodeinvocation-obsolete.hpp index 3c62dc11e..7c389fffe 100644 --- a/src/steam/engine/nodeinvocation.hpp +++ b/src/steam/engine/nodeinvocation-obsolete.hpp @@ -11,7 +11,7 @@ */ -/** @file nodeinvocation.hpp +/** @file nodeinvocation-obsolete.hpp ** Organise the state related to the invocation of s single ProcNode::pull() call ** This header defines part of the "glue" which holds together the render node network ** and enables to pull result frames from the nodes. Doing so requires some invocation @@ -34,6 +34,8 @@ ** in the actual StateAdapter type known to the NodeWiring (WiringAdapter) instance. All of these actual ** StateAdapter types are built as implementing the engine::StateClosure interface. ** + ** @deprecated 12/2024 the internal systematic within the Render Engine has been re-arranged altogether + ** ** @todo relies still on an [obsoleted implementation draft](\ref bufftable-obsolete.hpp) ** @see engine::ProcNode ** @see engine::StateProxy @@ -49,7 +51,7 @@ //#include "steam/engine/proc-node.hpp" ///////////////////////////////TODO clarify if required further on #include "steam/engine/connectivity-obsolete.hpp" #include "steam/engine/state-closure-obsolete.hpp" -#include "steam/engine/channel-descriptor.hpp" +#include "steam/engine/channel-descriptor-obsolete.hpp" #include "steam/engine/feed-manifold-obsolete.hpp" diff --git a/src/steam/engine/nodeoperation.hpp b/src/steam/engine/nodeoperation-obsolete.hpp similarity index 96% rename from src/steam/engine/nodeoperation.hpp rename to src/steam/engine/nodeoperation-obsolete.hpp index 24f96cdff..f182de758 100644 --- a/src/steam/engine/nodeoperation.hpp +++ b/src/steam/engine/nodeoperation-obsolete.hpp @@ -11,7 +11,7 @@ */ -/** @file nodeoperation.hpp +/** @file nodeoperation-obsolete.hpp ** Chunks of operation for invoking the rendernodes. ** This header defines part of the "glue" which holds together the render node network ** and enables to pull a result frames from the nodes. Especially, the aspect of @@ -35,6 +35,11 @@ ** nodewiring-config.hpp). which is actually instantiated and used in nodewiring.cpp, which is the object ** file holding all those instantiations. ** + ** + ** @deprecated 12/2024 the internal systematic within the Render Engine has been re-arranged altogether. + ** The general operation scheme is now conceptualised as a weaving-pattern + ** + ** ** @see engine::ProcNode ** @see engine::Invocation ** @see engine::StateClosure @@ -51,8 +56,8 @@ //#include "steam/engine/proc-node.hpp" ///////////////////////////////TODO clarify if required further on #include "steam/engine/connectivity-obsolete.hpp" #include "steam/engine/state-closure-obsolete.hpp" -#include "steam/engine/channel-descriptor.hpp" -#include "steam/engine/nodeinvocation.hpp" +#include "steam/engine/channel-descriptor-obsolete.hpp" +#include "steam/engine/nodeinvocation-obsolete.hpp" #include "steam/engine/feed-manifold-obsolete.hpp" #include "lib/meta/util.hpp" diff --git a/src/steam/engine/nodewiring.cpp b/src/steam/engine/nodewiring-obsolete.cpp similarity index 92% rename from src/steam/engine/nodewiring.cpp rename to src/steam/engine/nodewiring-obsolete.cpp index c071565a5..fe4051dd1 100644 --- a/src/steam/engine/nodewiring.cpp +++ b/src/steam/engine/nodewiring-obsolete.cpp @@ -12,16 +12,20 @@ * *****************************************************************/ -/** @file nodewiring.cpp +/** @file nodewiring-obsolete.cpp ** Implementation of node wiring to build a render node network ** @todo unfinished draft from 2009 regarding the render process + ** + ** @deprecated 12/2024 the internal systematic within the Render Engine has been re-arranged altogether; + ** instead of orchestrating generic invocation building-blocks, a collection of generic + ** _weaving-patterns_ will be instantiated directly in the library-adapter plug-ins */ //#include "steam/engine/proc-node.hpp" ///////////////////////////////TODO clarify if required further on #include "steam/engine/connectivity-obsolete.hpp" #include "steam/engine/nodewiring-obsolete.hpp" -#include "steam/engine/nodeoperation.hpp" +#include "steam/engine/nodeoperation-obsolete.hpp" #include "steam/engine/nodewiring-config.hpp" #include "lib/meta/typelist-manip.hpp" diff --git a/src/steam/engine/proc-node.hpp b/src/steam/engine/proc-node.hpp index c17202778..d50cd8c0f 100644 --- a/src/steam/engine/proc-node.hpp +++ b/src/steam/engine/proc-node.hpp @@ -36,13 +36,10 @@ #include "lib/error.hpp" #include "lib/nocopy.hpp" #include "lib/hash-value.h" -#include "steam/asset/proc.hpp" -#include "steam/mobject/parameter.hpp" -//#include "steam/engine/state-closure-obsolete.hpp" ///////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation -#include "steam/engine/state-closure.hpp" /////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation -#include "steam/engine/channel-descriptor.hpp" +//#include "steam/asset/proc.hpp" +//#include "steam/mobject/parameter.hpp" +#include "steam/engine/buffhandle.hpp" #include "steam/engine/turnout-system.hpp" -#include "lib/frameid.hpp" #include "lib/ref-array.hpp" /////////////////////OOO phase out #include "lib/format-string.hpp" #include "lib/several.hpp" @@ -59,20 +56,16 @@ namespace engine { using std::move; using std::string; - using std::vector; //////////////TODO; using lib::HashVal; - using lumiera::NodeID; ///////////////////////TODO likely to be removed using util::_Fmt; -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation class ProcID; class ProcNode; class ProcNodeDiagnostic; -// typedef ProcNode* PNode; using ProcNodeRef = std::reference_wrapper; using OptionalBuff = std::optional; -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation + class Port // : util::MoveOnly //////////////////////////////////////////////////OOO not clear if necessary here, and requires us to declare the ctors!!! See Turnout @@ -115,16 +108,13 @@ namespace engine { Ports ports; Leads leads; - NodeID const& nodeID; /////////////////////////////////OOO seems to belong rather into the ProcNode - /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation // protected: /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation - Connectivity (Ports&& pr, Leads&& lr, NodeID const& nID) + Connectivity (Ports&& pr, Leads&& lr) : ports(move(pr)) , leads(move(lr)) - , nodeID(nID) { } /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation diff --git a/src/steam/engine/state-closure.hpp b/src/steam/engine/state-closure.hpp deleted file mode 100644 index 607c3fb25..000000000 --- a/src/steam/engine/state-closure.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - STATE-CLOSURE.hpp - Key Interface representing a render process and encapsulating state - - Copyright (C) - 2008, Hermann Vosseler - -  **Lumiera** is free software; you can redistribute it and/or modify it -  under the terms of the GNU General Public License as published by the -  Free Software Foundation; either version 2 of the License, or (at your -  option) any later version. See the file COPYING for further details. - -*/ - - -/** @file state-closure.hpp - ** Access point to an ongoing render's processing state. - ** - ** @todo WIP-WIP-WIP 2024 Node-Invocation is reworked from ground up for the »Playback Vertical Slice« - ** - */ - - -#ifndef STEAM_ENGINE_STATE_CLOSURE_H -#define STEAM_ENGINE_STATE_CLOSURE_H - - -#include "lib/error.hpp" -#include "lib/frameid.hpp" -#include "steam/engine/buffhandle.hpp" - -#include - - -namespace steam { -namespace engine { - - using lumiera::FrameID; - using lumiera::NodeID; - - class StateAdapter; - class BuffTableStorage; - - - /** - * Abstraction to access the state of a currently ongoing render/calculation process, - * as it is tied to the supporting facilities of the vault layer. An StateClosure (subclass) instance - * is the sole connection for the render node to invoke services of the vault needed - * to carry out the calculations. - * - * @see engine::RenderInvocation top-level entrance point - * @see nodeinvocation.hpp impl. used from \em within the nodes - */ - class StateClosure - { -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : to be Reworked for »Playback Vertical Slice« - public: - /** allocate a new writable buffer with type and size according to - * the BuffDescr. The actual provider of this buffer depends - * on the StateClosure implementation; it could be a temporary, located in - * the cache, used for feeding calculated frames over a network, etc. - * @return a BuffHandle encapsulating the information necessary to get - * at the actual buffer address and for releasing the buffer. - */ - virtual BuffHandle allocateBuffer (const lumiera::StreamType*) =0; - - /** resign control of the buffer denoted by the handle */ - virtual void releaseBuffer (BuffHandle&) =0; - - /** declare the data contained in the Buffer to be ready. - * The caller is required to restrain itself from modifying the data - * afterwards, as this buffer now can be used (readonly) by other - * calculation processes in parallel. - */ - virtual void is_calculated (BuffHandle const&) =0; - - /** generate (or calculate) an ID denoting a media data frame - * appearing at the given position in the render network, - * for the time point this rendering process is currently - * calculating data for. - * @param NodeID the unique identification of a specific node - * @param chanNo the number of the output channel of this node - * @return a complete FrameID which unambiguously denotes this - * specific frame and can be used for caching - */ - virtual FrameID const& genFrameID (NodeID const&, uint chanNo) =0; - - /** try to fetch an existing buffer containing the denoted frame - * from a cache or similar backing system (e.g. network peer). - * @return either a handle to a readonly buffer, or a null handle - * @note the client is responsible for not modifying the provided data - */ - virtual BuffHandle fetch (FrameID const&) =0; - - /** necessary for creating a local BuffTableChunk */ - virtual BuffTableStorage& getBuffTableStorage() =0; - - - protected: - virtual ~StateClosure() {}; - - /** resolves to the StateClosure object currently "in charge". - * Intended as a performance shortcut to avoid calling - * up through a chain of virtual functions when deep down - * in chained ProcNode::pull() calls. This allows derived - * classes to proxy the state interface. - */ - virtual StateClosure& getCurrentImplementation () =0; - - friend class engine::StateAdapter; - }; - -}} // namespace steam::engine -#endif /*STEAM_ENGINE_STATE_CLOSURE_H*/ diff --git a/src/steam/engine/turnout-system.hpp b/src/steam/engine/turnout-system.hpp index f878b0472..1cf19653e 100644 --- a/src/steam/engine/turnout-system.hpp +++ b/src/steam/engine/turnout-system.hpp @@ -2,7 +2,7 @@ TURNOUT-SYSTEM.hpp - Encapsulation of the state corresponding to a render calculation Copyright (C) - 2008, Hermann Vosseler + 2024, Hermann Vosseler   **Lumiera** is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by the @@ -37,8 +37,6 @@ #define STEAM_ENGINE_TURNOUT_SYSTEM_H -#include "steam/engine/state-closure.hpp" /////////////////////OOO will take on a different role (if any) -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation #include "lib/nocopy.hpp" #include "lib/time/timevalue.hpp" #include "lib/hetero-data.hpp" diff --git a/src/steam/engine/turnout.hpp b/src/steam/engine/turnout.hpp index f57c21702..0a5102846 100644 --- a/src/steam/engine/turnout.hpp +++ b/src/steam/engine/turnout.hpp @@ -1,5 +1,5 @@ /* - TURNOUT.hpp - Organise the invocation state within a single pull() call + TURNOUT.hpp - Fixed standard scheme to generate data within a Render Node Copyright (C) 2008, Hermann Vosseler @@ -14,6 +14,7 @@ /** @file turnout.hpp + ** Fixed standard setup used in each Port of the Render Node to generate data. ** Organise the state related to the invocation of s single ProcNode::pull() call ** This header defines part of the "glue" which holds together the render node network ** and enables to pull result frames from the nodes. Doing so requires some invocation @@ -54,9 +55,7 @@ #include "steam/engine/proc-node.hpp" #include "steam/engine/turnout-system.hpp" #include "steam/engine/feed-manifold.hpp" -#include "steam/engine/state-closure.hpp" /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation -#include "steam/engine/channel-descriptor.hpp" //#include "vault/gear/job.h" //#include "steam/engine/exit-node.hpp" //#include "lib/time/timevalue.hpp" @@ -79,206 +78,38 @@ namespace engine { using std::forward; using lib::Several; -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation + /** - * Adapter to shield the ProcNode from the actual buffer management, - * allowing the processing function within ProcNode to use logical - * buffer IDs. StateAdapter is created on the stack for each pull() - * call, using setup/wiring data preconfigured by the builder. - * Its job is to provide the actual implementation of the Cache - * push / fetch and recursive downcall to render the source frames. + * Definition to emulate a _Concept_ for the *Invocation Adapter*. + * For each Proc-Asset, the corresponding Library Adapter must provide + * such adapters to access the input and result buffers and finally to + * invoke the processing functions from this library. + * - `connect(fanIn,fanOut)` access the _Feed Manifold_ and link the buffers + * - `invoke()` invoke the processing function, passing the connected buffers */ - class StateAdapter - : public StateClosure - { - protected: - StateClosure& parent_; - StateClosure& current_; - - StateAdapter (StateClosure& callingProcess) - : parent_ (callingProcess), - current_(callingProcess.getCurrentImplementation()) - { } - - virtual StateClosure& getCurrentImplementation () { return current_; } - - - - public: /* === proxying the StateClosure interface === */ - - virtual void releaseBuffer (BuffHandle& bh) { current_.releaseBuffer (bh); } - - virtual void is_calculated (BuffHandle const& bh) { current_.is_calculated (bh); } - - virtual BuffHandle fetch (FrameID const& fID) { return current_.fetch (fID); } - - virtual BuffTableStorage& getBuffTableStorage() { return current_.getBuffTableStorage(); } - - // note: allocateBuffer() is chosen specifically based on the actual node wiring - - }; - - + template + constexpr bool + _verify_usable_as_InvocationAdapter() + { + ASSERT_MEMBER_FUNCTOR (&ADA::connect, void(uint, uint)); + ASSERT_MEMBER_FUNCTOR (&ADA::invoke, void()); + return sizeof(ADA); + } /** - * Invocation context state. - * A ref to this type is carried through the chain of NEXT::step() functions - * which form the actual invocation sequence. The various operations in this sequence - * access the context via the references in this struct, while also using the inherited - * public State interface. The object instance actually used as Invocation is created - * on the stack and parametrised according to the necessities of the invocation sequence - * actually configured. Initially, this real instance is configured without FeedManifold, - * because the invocation may be short-circuited due to Cache hit. Otherwise, when - * the invocation sequence actually prepares to call the process function of this - * ProcNode, a buffer table chunk is allocated by the StateProxy and wired in. + * Standard implementation for a _Weaving Pattern_ to connect + * the input and output data feeds (buffers) into a processing function. + * @tparam INVO a configuration / policy base class to _adapt for invocation_ + * @note assumptions made regarding the overall structure + * - `INVO::Feed` defines an _invocation adapter_ for the processing function + * - `INVO::buildFeed()` is a functor to (repeatedly) build `Feed` instances + * - the _invocation adapter_ in turn embeds a `FeedManifold` to hold + * + an array of input buffer pointers + * + an array of output buffer pointers + * + `INVO::MAX_SIZ` limits both arrays */ -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation - struct Invocation - : StateAdapter - { - Connectivity const& wiring; - const uint outNr; - - FeedManifold* feedManifold; - - protected: - /** creates a new invocation context state, without FeedManifold */ - Invocation (StateClosure& callingProcess, Connectivity const& w, uint o) - : StateAdapter(callingProcess), - wiring(w), outNr(o), - feedManifold(0) - { } - - public: - uint nrO() const { return wiring.nrO; } - uint nrI() const { return wiring.nrI; } - uint buffTabSize() const { return nrO()+nrI(); } - - /** setup the link to an externally allocated buffer table */ - void setBuffTab (FeedManifold* b) { this->feedManifold = b; } - - bool - buffTab_isConsistent () - { - return (feedManifold) - && (0 < buffTabSize()) - && (nrO()+nrI() <= buffTabSize()) - && (feedManifold->inBuff == &feedManifold->outBuff[nrO()] ) - && (feedManifold->inHandle == &feedManifold->outHandle[nrO()]) - ; - } - - - public: - /** specialised version filling in the additional information, i.e - * the concrete node id and the channel number in question */ - virtual FrameID const& - genFrameID () - { - return current_.genFrameID(wiring.nodeID, outNr); - } - - virtual FrameID const& - genFrameID (NodeID const& nID, uint chanNo) - { - return current_.genFrameID (nID,chanNo); - } - - }; - - - ////////////TICKET #249 this strategy should better be hidden within the BuffHandle ctor (and type-erased after creation) - struct AllocBufferFromParent ///< using the parent StateAdapter for buffer allocations - : Invocation - { - AllocBufferFromParent (StateClosure& sta, Connectivity const& w, const uint outCh) - : Invocation(sta, w, outCh) {} - - virtual BuffHandle - allocateBuffer (const lumiera::StreamType* ty) { return parent_.allocateBuffer(ty); } ////////////TODO: actually implement the "allocate from parent" logic! - }; - - struct AllocBufferFromCache ///< using the global current StateClosure, which will delegate to Cache - : Invocation - { - AllocBufferFromCache (StateClosure& sta, Connectivity const& w, const uint outCh) - : Invocation(sta, w, outCh) {} - - virtual BuffHandle - allocateBuffer (const lumiera::StreamType* ty) { return current_.allocateBuffer(ty); } - }; - - - /** - * The real invocation context state implementation. It is created - * by the NodeWiring (Connectivity) of the processing node which - * is pulled by this invocation, hereby using the internal configuration - * information to guide the selection of the real call sequence - * - * \par assembling the call sequence implementation - * Each ProcNode#pull() call creates such a StateAdapter subclass on the stack, - * with a concrete type according to the Connectivity of the node to pull. - * This concrete type encodes a calculation Strategy, which is assembled - * as a chain of policy templates on top of OperationBase. For each of the - * possible configurations we define such a chain (see bottom of nodeoperation.hpp). - * The WiringFactory defined in nodewiring.cpp actually drives the instantiation - * of all those possible combinations. - */ - template - class ActualInvocationProcess - : public BufferProvider - , private Strategy - { - public: - ActualInvocationProcess (StateClosure& callingProcess, Connectivity const& w, const uint outCh) - : BufferProvider(callingProcess, w, outCh) - { } - - /** contains the details of Cache query and recursive calls - * to the predecessor node(s), eventually followed by the - * ProcNode::process() callback - */ - BuffHandle retrieve () - { - return Strategy::step (*this); - } - }; -#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation - - /** - * Definition to emulate a _Concept_ for the *Invocation Adapter*. - * For each Proc-Asset, the corresponding Library Adapter must provide - * such adapters to access the input and result buffers and finally to - * invoke the processing functions from this library. - * - `connect(fanIn,fanOut)` access the _Feed Manifold_ and link the buffers - * - `invoke()` invoke the processing function, passing the connected buffers - */ - template - constexpr bool - _verify_usable_as_InvocationAdapter() - { - ASSERT_MEMBER_FUNCTOR (&ADA::connect, void(uint, uint)); - ASSERT_MEMBER_FUNCTOR (&ADA::invoke, void()); - return sizeof(ADA); - } - - - - /** - * Standard implementation for a _Weaving Pattern_ to connect - * the input and output data feeds (buffers) into a processing function. - * @tparam INVO a configuration / policy base class to _adapt for invocation_ - * @note assumptions made regarding the overall structure - * - `INVO::Feed` defines an _invocation adapter_ for the processing function - * - `INVO::buildFeed()` is a functor to (repeatedly) build `Feed` instances - * - the _invocation adapter_ in turn embeds a `FeedManifold` to hold - * + an array of input buffer pointers - * + an array of output buffer pointers - * + `INVO::MAX_SIZ` limits both arrays - */ template struct SimpleWeavingPattern : INVO @@ -381,10 +212,6 @@ namespace engine { : Port{id} , PAT{forward (init)...} { } -// Turnout(Turnout&& rr) ////////////////////////////////////////////OOO investigation of MoveOnly and problems with the builder logic -// : Port(static_cast(rr)) -// , PAT(static_cast(rr)) -// { } /** * Entrance point to the next recursive step of media processing. diff --git a/src/steam/engine/weaving-pattern.hpp b/src/steam/engine/weaving-pattern.hpp new file mode 100644 index 000000000..a715fe739 --- /dev/null +++ b/src/steam/engine/weaving-pattern.hpp @@ -0,0 +1,384 @@ +/* + WEAVING-PATTERN.hpp - Base patterns to organise data connections and render processing invocation + + Copyright (C) + 2008, Hermann Vosseler + 2024, Hermann Vosseler + +  **Lumiera** is free software; you can redistribute it and/or modify it +  under the terms of the GNU General Public License as published by the +  Free Software Foundation; either version 2 of the License, or (at your +  option) any later version. See the file COPYING for further details. + +*/ + + +/** @file weaving-pattern.hpp + ** Construction set to assemble and operate a data processing scheme within a Render Node. + ** This header defines part of the "glue" which holds together the render node network + ** and enables to pull result frames from the nodes. Doing so requires some invocation + ** local state to be maintained, especially a table of buffers used to carry out the + ** calculations. Further, getting the input buffers filled requires to issue recursive + ** \c pull() calls, which on the whole creates a stack-like assembly of local invocation + ** state. + ** The actual steps to be carried out for a \c pull() call are dependent on the configuration + ** of the node to pull. Each node has been preconfigured by the builder with a Connectivity + ** descriptor and a concrete type of a StateAdapter. The actual sequence of steps is defined + ** in the header nodeoperation.hpp out of a set of basic operation steps. These steps all use + ** the passed in Invocation object (a sub-interface of StateAdapter) to access the various + ** aspects of the invocation state. + ** + ** # composition of the Invocation State + ** + ** For each individual ProcNode#pull() call, the WiringAdapter#callDown() builds an StateAdapter + ** instance directly on the stack, managing the actual buffer pointers and state references. Using this + ** StateAdapter, the predecessor nodes are pulled. The way these operations are carried out is encoded + ** in the actual StateAdapter type known to the NodeWiring (WiringAdapter) instance. All of these actual + ** StateAdapter types are built as implementing the engine::StateClosure interface. + ** + ** @todo relies still on an [obsoleted implementation draft](\ref bufftable-obsolete.hpp) + ** @see engine::ProcNode + ** @see engine::StateProxy + ** @see engine::FeedManifold + ** @see nodewiring.hpp interface for building/wiring the nodes + ** + ** @warning as of 12/2024 first complete integration round of the Render engine ////////////////////////////TICKET #1367 + ** + */ + + +#ifndef STEAM_ENGINE_WEAVING_PATTERN_H +#define STEAM_ENGINE_WEAVING_PATTERN_H + +#include "steam/common.hpp" +#include "steam/engine/proc-node.hpp" +#include "steam/engine/turnout-system.hpp" +#include "steam/engine/feed-manifold.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation +//#include "vault/gear/job.h" +//#include "steam/engine/exit-node.hpp" +//#include "lib/time/timevalue.hpp" +//#include "lib/linked-elements.hpp" +#include "lib/several.hpp" +//#include "lib/util-foreach.hpp" +//#include "lib/iter-adapter.hpp" +#include "lib/meta/function.hpp" +//#include "lib/itertools.hpp" +//#include "lib/util.hpp" ////////OOO wegen manifoldSiz() + +#include +#include +//#include + + +namespace steam { +namespace engine { + + using std::forward; + using lib::Several; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation + /** + * Adapter to shield the ProcNode from the actual buffer management, + * allowing the processing function within ProcNode to use logical + * buffer IDs. StateAdapter is created on the stack for each pull() + * call, using setup/wiring data preconfigured by the builder. + * Its job is to provide the actual implementation of the Cache + * push / fetch and recursive downcall to render the source frames. + */ + class StateAdapter + : public StateClosure + { + protected: + StateClosure& parent_; + StateClosure& current_; + + StateAdapter (StateClosure& callingProcess) + : parent_ (callingProcess), + current_(callingProcess.getCurrentImplementation()) + { } + + virtual StateClosure& getCurrentImplementation () { return current_; } + + + + public: /* === proxying the StateClosure interface === */ + + virtual void releaseBuffer (BuffHandle& bh) { current_.releaseBuffer (bh); } + + virtual void is_calculated (BuffHandle const& bh) { current_.is_calculated (bh); } + + virtual BuffHandle fetch (FrameID const& fID) { return current_.fetch (fID); } + + virtual BuffTableStorage& getBuffTableStorage() { return current_.getBuffTableStorage(); } + + // note: allocateBuffer() is chosen specifically based on the actual node wiring + + }; + + + + + + /** + * Invocation context state. + * A ref to this type is carried through the chain of NEXT::step() functions + * which form the actual invocation sequence. The various operations in this sequence + * access the context via the references in this struct, while also using the inherited + * public State interface. The object instance actually used as Invocation is created + * on the stack and parametrised according to the necessities of the invocation sequence + * actually configured. Initially, this real instance is configured without FeedManifold, + * because the invocation may be short-circuited due to Cache hit. Otherwise, when + * the invocation sequence actually prepares to call the process function of this + * ProcNode, a buffer table chunk is allocated by the StateProxy and wired in. + */ + struct Invocation + : StateAdapter + { + Connectivity const& wiring; + const uint outNr; + + FeedManifold* feedManifold; + + protected: + /** creates a new invocation context state, without FeedManifold */ + Invocation (StateClosure& callingProcess, Connectivity const& w, uint o) + : StateAdapter(callingProcess), + wiring(w), outNr(o), + feedManifold(0) + { } + + public: + uint nrO() const { return wiring.nrO; } + uint nrI() const { return wiring.nrI; } + uint buffTabSize() const { return nrO()+nrI(); } + + /** setup the link to an externally allocated buffer table */ + void setBuffTab (FeedManifold* b) { this->feedManifold = b; } + + bool + buffTab_isConsistent () + { + return (feedManifold) + && (0 < buffTabSize()) + && (nrO()+nrI() <= buffTabSize()) + && (feedManifold->inBuff == &feedManifold->outBuff[nrO()] ) + && (feedManifold->inHandle == &feedManifold->outHandle[nrO()]) + ; + } + + + public: + /** specialised version filling in the additional information, i.e + * the concrete node id and the channel number in question */ + virtual FrameID const& + genFrameID () + { + return current_.genFrameID(wiring.nodeID, outNr); + } + + virtual FrameID const& + genFrameID (NodeID const& nID, uint chanNo) + { + return current_.genFrameID (nID,chanNo); + } + + }; + + + ////////////TICKET #249 this strategy should better be hidden within the BuffHandle ctor (and type-erased after creation) + struct AllocBufferFromParent ///< using the parent StateAdapter for buffer allocations + : Invocation + { + AllocBufferFromParent (StateClosure& sta, Connectivity const& w, const uint outCh) + : Invocation(sta, w, outCh) {} + + virtual BuffHandle + allocateBuffer (const lumiera::StreamType* ty) { return parent_.allocateBuffer(ty); } ////////////TODO: actually implement the "allocate from parent" logic! + }; + + struct AllocBufferFromCache ///< using the global current StateClosure, which will delegate to Cache + : Invocation + { + AllocBufferFromCache (StateClosure& sta, Connectivity const& w, const uint outCh) + : Invocation(sta, w, outCh) {} + + virtual BuffHandle + allocateBuffer (const lumiera::StreamType* ty) { return current_.allocateBuffer(ty); } + }; + + + /** + * The real invocation context state implementation. It is created + * by the NodeWiring (Connectivity) of the processing node which + * is pulled by this invocation, hereby using the internal configuration + * information to guide the selection of the real call sequence + * + * \par assembling the call sequence implementation + * Each ProcNode#pull() call creates such a StateAdapter subclass on the stack, + * with a concrete type according to the Connectivity of the node to pull. + * This concrete type encodes a calculation Strategy, which is assembled + * as a chain of policy templates on top of OperationBase. For each of the + * possible configurations we define such a chain (see bottom of nodeoperation.hpp). + * The WiringFactory defined in nodewiring.cpp actually drives the instantiation + * of all those possible combinations. + */ + template + class ActualInvocationProcess + : public BufferProvider + , private Strategy + { + public: + ActualInvocationProcess (StateClosure& callingProcess, Connectivity const& w, const uint outCh) + : BufferProvider(callingProcess, w, outCh) + { } + + /** contains the details of Cache query and recursive calls + * to the predecessor node(s), eventually followed by the + * ProcNode::process() callback + */ + BuffHandle retrieve () + { + return Strategy::step (*this); + } + }; +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation + + /** + * Standard implementation for a _Weaving Pattern_ to connect + * the input and output data feeds (buffers) into a processing function. + * @tparam INVO a configuration / policy base class to _adapt for invocation_ + * @note assumptions made regarding the overall structure + * - `INVO::Feed` defines an _invocation adapter_ for the processing function + * - `INVO::buildFeed()` is a functor to (repeatedly) build `Feed` instances + * - the _invocation adapter_ in turn embeds a `FeedManifold` to hold + * + an array of input buffer pointers + * + an array of output buffer pointers + * + `INVO::MAX_SIZ` limits both arrays + */ + template + struct SimpleWeavingPattern + : INVO + { + using Feed = typename INVO::Feed; + + static_assert (_verify_usable_as_InvocationAdapter()); + + Several leadPort; + Several outTypes; + + uint resultSlot{0}; + + /** forwarding-ctor to provide the detailed input/output connections */ + template + SimpleWeavingPattern (Several&& pr + ,Several&& dr + ,uint resultIdx + ,ARGS&& ...args) + : INVO{forward(args)...} + , leadPort{move(pr)} + , outTypes{move(dr)} + , resultSlot{resultIdx} + { } + + + Feed + mount() + { + return INVO::buildFeed(); + } + + void + pull (Feed& feed, TurnoutSystem& turnoutSys) + { + for (uint i=0; i + class Turnout + : public Port + , public PAT +// , util::MoveOnly + { + using Feed = typename PAT::Feed; + + public: + template + Turnout (ProcID& id, INIT&& ...init) + : Port{id} + , PAT{forward (init)...} + { } + + /** + * Entrance point to the next recursive step of media processing. + * @param turnoutSys anchor context with parameters and services + * @return a BuffHandle exposing the generated result data + */ + BuffHandle + weave (TurnoutSystem& turnoutSys, OptionalBuff outBuff =std::nullopt) override + { + Feed feed = PAT::mount(); + PAT::pull(feed, turnoutSys); + PAT::shed(feed, outBuff); + PAT::weft(feed); + return PAT::fix (feed); + } + }; + + + + +}}// namespace steam::engine +#endif /*STEAM_ENGINE_WEAVING_PATTERN_H*/ diff --git a/src/steam/mobject/builder/operationpoint.cpp b/src/steam/mobject/builder/operationpoint.cpp index b18ba2ea1..9be3c4695 100644 --- a/src/steam/mobject/builder/operationpoint.cpp +++ b/src/steam/mobject/builder/operationpoint.cpp @@ -15,11 +15,13 @@ /** @file operationpoint.cpp ** Implementation of primitive builder operations on at the _current point of operation_. ** @todo stalled design draft from 2008 -- basically still considered relevant as of 2016 + ** @todo confirmed 12/2024 : the ideas drafted here are considered relevant, + ** yet it is clear meanwhile that the Build will work on meta-descriptors, + ** and not the actual Render Nodes */ #include "steam/mobject/builder/operationpoint.hpp" -#include "steam/engine/proc-node.hpp" #include "steam/asset/media.hpp" #include "steam/asset/proc.hpp" #include "steam/engine/node-factory.hpp" @@ -35,7 +37,11 @@ namespace builder { // using util::isnil; using engine::NodeFactory; - using engine::PNode; + /** @todo placeholder introduced 12/2024 to abstract from the actual Render Nodes */ + struct PNode + { + ; + }; struct RefPoint diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 68c78bb5b..fcee81483 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -82040,8 +82040,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -87158,6 +87158,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -87532,6 +87533,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -88552,7 +88554,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -88652,8 +88654,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -88797,7 +88799,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- +
@@ -91322,6 +91324,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + @@ -91359,7 +91372,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -94196,6 +94209,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + @@ -95046,7 +95064,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -95054,6 +95072,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + +
@@ -96831,7 +96858,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- +