Integration of Builder/NodeFactory implementation draft. Stubbed to pass compiler

This commit is contained in:
Fischlurch 2009-09-05 18:15:58 +02:00
parent 1430965798
commit 1969adaf02
26 changed files with 256 additions and 138 deletions

View file

@ -51,7 +51,7 @@ namespace lumiera {
static ulong currID;
};
ulong NodeID::currID (0);
/**

View file

@ -137,7 +137,7 @@ namespace engine {
tab_(storage.claim (siz_)),
sto_(storage)
{
const uint nrO(wd.getNrO());
const uint nrO(wd.nrO);
// Setup the public visible table locations
this->outHandle = &tab_.first[ 0 ];

View file

@ -47,10 +47,9 @@ namespace engine {
intendedWiring.resolveProcessor(effect->getProcAsset());
WiringDescriptor& wiring = wiringFac_(intendedWiring);
PNode newNode = alloc_.create<ProcNode> (wiring);
ENSURE (newNode);
ENSURE (newNode->isValid());
return newNode;
ProcNode& newNode = alloc_.create<ProcNode> (wiring);
ENSURE (newNode.isValid());
return &newNode;
}

View file

@ -88,7 +88,7 @@ namespace engine {
private: /* === proxying the State interface === */
public: /* === proxying the State interface === */
virtual void releaseBuffer (BuffHandle& bh) { current_.releaseBuffer (bh); }
@ -96,6 +96,8 @@ namespace engine {
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
};
@ -132,9 +134,10 @@ namespace engine {
buffTab(0)
{ }
const uint nrO() const { return wiring.nrO; }
const uint nrI() const { return wiring.nrI; }
const uint buffTabSize() const { return nrO()+nrI(); }
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 (BuffTable* b) { this->buffTab = b; }
@ -208,6 +211,7 @@ namespace engine {
template<class Strategy, class BufferProvider>
class ActualInvocationProcess
: public BufferProvider
, private Strategy
{
public:
ActualInvocationProcess (State& callingProcess, WiringDescriptor const& w, const uint outCh)

View file

@ -76,15 +76,37 @@ namespace config {
/**
* Base class of all concrete invocation sequences.
* Could contain a collection of functions used to build up the invocation sequence.
* Currently contains just a marker used to detect the existence of an concrete
* Provides a collection of functions used to build up the invocation sequence.
* Additionally providing a marker used to detect the existence of an concrete
* definition/specialisation for a given specific configuration.
*/
class OperationBase
struct OperationBase
{
typedef lumiera::Yes_t is_defined;
BuffHandle
getSource (Invocation& ivo, uint chanNo)
{
UNIMPLEMENTED ("retrieve source data provided by the backend/scheduler");
}
BuffHandle
pullPredecessor (Invocation& ivo, uint chanNo)
{
UNIMPLEMENTED ("invoke pull() on the denoted predecessor node");
}
void
releaseBuffers(BuffHandle* table, uint slotCnt, uint slot_to_retain) //////////////TODO this is going to be implemented rather by smart-handle, Ticket #249
{
UNIMPLEMENTED ("release all buffers with the exception of the desired output");
}
bool
validateBuffers (Invocation& ivo)
{
UNIMPLEMENTED ("Do a final, specifically tailored validation step on the buffers prior to invoking the procees function");
}
};
@ -130,8 +152,8 @@ namespace config {
for (uint i = 0; i < ivo.nrI(); ++i )
{
inBuff[i] =
*(inH[i] = this->pullPredecessor(ivo,i)); // invoke predecessor
inBuff[i] =
&*(inH[i] = this->pullPredecessor(ivo,i)); // invoke predecessor
// now Input #i is ready...
}
return NEXT::step (ivo);
@ -155,7 +177,7 @@ namespace config {
for (uint i = 0; i < ivo.nrI(); ++i )
{
inBuff[i] = outBuff[i] =
*(inH[i] = outH[i] = this->getSource(ivo,i));
&*(inH[i] = outH[i] = this->getSource(ivo,i));
// now Input #i is ready...
}
return NEXT::step (ivo);
@ -177,7 +199,7 @@ namespace config {
for (uint i = 0; i < ivo.nrO(); ++i )
{
outBuff[i] =
*(outH[i] = ivo.allocateBuffer (ivo.wiring.out[i].bufferType));
&*(outH[i] = ivo.allocateBuffer (ivo.wiring.out[i].bufferType));
// now Output buffer for channel #i is available...
}
return NEXT::step (ivo);
@ -197,7 +219,7 @@ namespace config {
// Invoke our own process() function,
// providing the array of outBuffer+inBuffer ptrs
ivo.wiring.procFunction (ivo.buffTab->outBuff);
(*ivo.wiring.procFunction) (*ivo.buffTab->outBuff);
return NEXT::step (ivo);
}
@ -254,25 +276,21 @@ namespace config {
};
template< char CACHE_Fl =NOT_SET
, char INPLACE_Fl =NOT_SET
>
struct SelectBuffProvider;
template<> struct SelectBuffProvider<CACHING> { typedef AllocBufferFromCache Type; };
template<> struct SelectBuffProvider<NOT_SET,INPLACE> { typedef AllocBufferFromParent Type; };
template<> struct SelectBuffProvider<CACHING,INPLACE> { typedef AllocBufferFromCache Type; };
template<> struct SelectBuffProvider<> { typedef AllocBufferFromParent Type; };
using lumiera::typelist::Config;
///////////////////////TODO: selecting this way isn't especially readable,
///////////////////////////: but BufferProvider selection is going to be solved differently anyway, see Ticket #249
template<class CONF>
struct SelectBuffProvider { typedef AllocBufferFromParent Type; };
template<char PROC_ign, char INPLA_ign>
struct SelectBuffProvider< Config<CACHING, PROC_ign, INPLA_ign> > { typedef AllocBufferFromCache Type; };
template<class Config>
struct Strategy ;
using lumiera::typelist::Config;
template<char INPLACE>
struct Strategy< Config<CACHING,PROCESS,INPLACE> >
template<char INPLACE_ign>
struct Strategy< Config<CACHING,PROCESS,INPLACE_ign> >
: QueryCache<
AllocBufferTable<
PullInput<
@ -283,8 +301,8 @@ namespace config {
OperationBase > > > > > > >
{ };
template<char INPLACE>
struct Strategy< Config<PROCESS,INPLACE> >
template<char INPLACE_ign>
struct Strategy< Config<PROCESS,INPLACE_ign> >
: AllocBufferTable<
PullInput<
AllocOutput<

View file

@ -63,8 +63,8 @@
namespace engine {
namespace config {
using lumiera::typelist::FlagInfo;
using util::contains;
using lumiera::typelist::FlagInfo;
using lumiera::typelist::CONFIG_FLAGS_MAX;

View file

@ -75,13 +75,32 @@ namespace engine {
long flags_;
asset::Proc::ProcFunc* function_;
protected:
RefArray<ChannelDescriptor>& makeOutDescriptor() ;
RefArray<InChanDescriptor>& makeInDescriptor() ;
WiringDescriptor::ProcFunc* resolveProcessingFunction() ;
lumiera::NodeID const& createNodeID() ;
public: /* === API for querying collected data === */
RefArray<ChannelDescriptor>&
makeOutDescriptor() const
{
UNIMPLEMENTED ("build new output descriptors for the node under construction"); //////////TODO: where to get the information about the output channels???
}
RefArray<InChanDescriptor>&
makeInDescriptor() const
{
UNIMPLEMENTED ("build new input descriptors for the node under construction");
}
WiringDescriptor::ProcFunc*
resolveProcessingFunction() const
{
REQUIRE (function_);
return function_;
}
lumiera::NodeID const&
createNodeID() const
{
UNIMPLEMENTED ("initiate generation of a new unique node-ID"); // see rendergraph.cpp
}
friend class NodeWiring;
public: /* === API for specifying the desired wiring === */

View file

@ -55,12 +55,6 @@ namespace engine {
typedef Filter<AllConfigs::List, Instantiation<Strategy>::Test> PossibleConfigs;
#define PICK_FLAG(_FLAG_) config::FlagInfo<CONF>::CODE & (_FLAG_)
template<class CONF>
struct UseBufferProvider
: config::SelectBuffProvider< PICK_FLAG (CACHING), PICK_FLAG (INPLACE) >
{ };
// internal details: setting up a factory for each required configuration
@ -76,9 +70,8 @@ namespace engine {
AllocationCluster& alloc_;
/* ==== pick actual wiring code ==== */
typedef Strategy<CONF> Strategy;
typedef typename UseBufferProvider<CONF>::Type BuffProvider;
typedef ActualInvocationProcess<Strategy, BuffProvider> InvocationStateType;
typedef typename SelectBuffProvider<CONF>::Type BuffProvider;
typedef ActualInvocationProcess<Strategy<CONF>, BuffProvider> InvocationStateType;
// the concrete implementation of the glue code...
typedef NodeWiring<InvocationStateType> ActualWiring;

View file

@ -61,17 +61,15 @@ namespace engine {
: public WiringDescriptor
{
NodeWiring(WiringSituation& setup)
public:
NodeWiring(WiringSituation const& setup)
: WiringDescriptor(setup.makeOutDescriptor(),
setup.makeInDescriptor(),
setup.resolveProcessingFunction(),
setup.createNodeID())
{ }
friend class WiringFactory;
protected:
private:
virtual BuffHandle
callDown (State& currentProcess, uint requestedOutputNr) const
{

View file

@ -113,6 +113,13 @@ namespace engine {
/**
* Key abstraction of the Render Engine: A Data processing Node
*
* @todo it's not clear as of 9/09 if ProcNode shall be an ABC/Interface
* It might be used as ABC (as was the original intention) when implementing
* several query/information functions. In that case, the ctor will become protected.
* The alternative would be to push down these information-retrieval part into a
* configurable element within WiringDescriptor, in which case we even might drop
* ProcNode as a frontent entirely.
*/
class ProcNode
{
@ -121,19 +128,15 @@ namespace engine {
const WiringDescriptor& wiringConfig_;
protected:
public:
ProcNode (WiringDescriptor const& wd)
: wiringConfig_(wd)
{ }
friend class NodeFactory;
virtual ~ProcNode() {}; /////////////////////////TODO: do we still intend to build a hierarchy below ProcNode???
public:
virtual ~ProcNode() {}; /////////////////////////TODO: do we still intend to build a hierarchy below ProcNode???
bool isValid() const;
/** output channel count */
@ -161,7 +164,7 @@ namespace engine {
};
bool
inline bool
ProcNode::isValid() const
{
UNIMPLEMENTED ("ProcNode validity self-check");

View file

@ -22,8 +22,16 @@
#include "proc/engine/rendergraph.hpp"
#include "lib/frameid.hpp"
#include "proc/state.hpp"
namespace lumiera {
/** storage for the unique node-ID counter */
ulong NodeID::currID (0);
}
namespace engine {
/** */

View file

@ -58,6 +58,13 @@ namespace mobject {
NodeCreatorTool::treat (Auto<double>& automation)
{
}
void
NodeCreatorTool::onUnknown (Buildable& target)
{
UNIMPLEMENTED ("catch-all when partitioning timeline"); ////////TODO: verify why this gets enfoced here...
}

View file

@ -21,57 +21,55 @@
*/
#ifndef MOBJECT_BUILDER_NODECREATERTOOL_H
#define MOBJECT_BUILDER_NODECREATERTOOL_H
#ifndef MOBJECT_BUILDER_NODECREATORTOOL_H
#define MOBJECT_BUILDER_NODECREATORTOOL_H
#include "proc/mobject/builder/applicablebuildertargettypes.hpp"
#include "proc/engine/rendergraph.hpp"
#include "proc/mobject/builder/toolfactory.hpp"
namespace mobject {
namespace builder {
/**
* This Tool implementation plays the central role in the build process:
* given a MObject from Session, it is able to attach ProcNodes to the
* render engine under construction such as to reflect the properties
* of the MObject in the actual render.
*/
class NodeCreatorTool
: public ApplicableBuilderTargetTypes<NodeCreatorTool>
{
ToolFactory& toolKit_;
/** holds the RenderGraph (Render Engine Element)
* to be built by the current build step */
engine::RenderGraph& proc_;
NodeCreatorTool (ToolFactory& tofa, engine::RenderGraph& proc)
: toolKit_(tofa),
proc_(proc)
{ }
friend class ToolFactory;
public:
virtual void treat (mobject::session::Clip& clip) ;
virtual void treat (mobject::session::Effect& effect) ;
virtual void treat (mobject::session::Auto<double>& automation) ; //TODO: the automation-type-problem
virtual void treat (mobject::Buildable& something) ;
};
} // namespace mobject::builder
} // namespace mobject
namespace builder {
class ToolFactory;
/**
* This Tool implementation plays the central role in the build process:
* given a MObject from Session, it is able to attach ProcNodes to the
* render engine under construction such as to reflect the properties
* of the MObject in the actual render.
*/
class NodeCreatorTool
: public ApplicableBuilderTargetTypes<NodeCreatorTool>
{
ToolFactory& toolKit_;
/** holds the RenderGraph (Render Engine Element)
* to be built by the current build step */
engine::RenderGraph& proc_;
NodeCreatorTool (ToolFactory& tofa, engine::RenderGraph& proc)
: toolKit_(tofa),
proc_(proc)
{ }
friend class ToolFactory;
public:
virtual void treat (mobject::session::Clip& clip) ;
virtual void treat (mobject::session::Effect& effect) ;
virtual void treat (mobject::session::Auto<double>& automation) ; //TODO: the automation-type-problem
virtual void treat (mobject::Buildable& something) ;
void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shaddow this??
};
}} // namespace mobject::builder
#endif

View file

@ -22,7 +22,9 @@
#include "proc/mobject/builder/operationpoint.hpp"
#include "proc/engine/procnode.hpp"
#include "proc/asset/media.hpp"
#include "proc/asset/proc.hpp"
#include "proc/engine/nodefactory.hpp"
#include "lib/streamtype.hpp"
//#include "common/util.hpp"
@ -55,18 +57,33 @@ namespace builder {
{ }
/** initiate a connection chain at a real source */
RefPoint (NodeFactory& nFactory, asset::Media srcMedia)
RefPoint (NodeFactory& nFactory, asset::Media const& srcMedia)
: alloc_(nFactory),
sources_(establishMediaChannels (srcMedia)),
sType_(0)
{
establishMediaChannels (srcMedia);
deriveSourceStreamType ();
}
private:
void
establishMediaChannels (asset::Media const& srcMedia)
{
UNIMPLEMENTED ("find out about the actual channels for this stream to connect");
}
void
deriveSourceStreamType ()
{
UNIMPLEMENTED ("calculate / decide on the effective stream type used within this pipe");
}
};
OperationPoint::OperationPoint (NodeFactory& nFact,, asset::Media const& srcMedia)
OperationPoint::OperationPoint (NodeFactory& nFact, asset::Media const& srcMedia)
: refPoint_(new RefPoint (nFact, srcMedia))
{ }
@ -77,7 +94,7 @@ namespace builder {
void
OperationPoint::attach (asset::PProc const& mediaProc)
OperationPoint::attach (asset::Proc const& mediaProc)
{
UNIMPLEMENTED ("Actually-really-finally create a node corresponding to this processing asset");
}

View file

@ -32,6 +32,10 @@
#include <string>
namespace asset { class Proc; }
namespace asset { class Media; }
namespace engine { class NodeFactory; }
namespace mobject {
namespace builder {
@ -52,11 +56,16 @@ namespace builder {
boost::scoped_ptr<RefPoint> refPoint_;
public:
OperationPoint (engine::NodeFactory&, asset::Media const& srcMedia);
OperationPoint (RefPoint const& sourcePoint);
/** create node(s) corresponding to the given Processor-Asset
* and wire them as a successor to this OperationPoint; then
* move this point to refer to the resulting new exit node(s)
*/
void attach (asset::PProc const&);
void attach (asset::Proc const&);
/** connect the output this OperationPoint refers such as to
* connect or combine with the input of the already existing

View file

@ -35,24 +35,46 @@ namespace mobject {
namespace builder {
SegmentationTool::SegmentationTool(mobject::session::Fixture&)
{
UNIMPLEMENTED ("create new SegmentationTool");
}
void
SegmentationTool::treat (Buildable& something)
{
UNIMPLEMENTED ("??? when partitioning timeline");
}
void
SegmentationTool::treat (Clip& clip)
{
UNIMPLEMENTED ("consider clip when partitioning timeline");
}
void
SegmentationTool::treat (Effect& effect)
{
UNIMPLEMENTED ("note applied effect when partitioning timeline");
}
void
SegmentationTool::onUnknown (Buildable& target)
{
UNIMPLEMENTED ("catch-all when partitioning timeline");
}
bool
SegmentationTool::empty() const
{
UNIMPLEMENTED ("detect an empty segmentation");
}
} // namespace mobject::builder

View file

@ -51,21 +51,24 @@ namespace mobject {
: public ApplicableBuilderTargetTypes<SegmentationTool>
{
public:
SegmentationTool (session::Fixture &) ;
public:
void treat (mobject::session::Clip& clip) ;
void treat (mobject::session::Effect& effect) ;
void treat (mobject::Buildable& something) ;
//////////////////////////////////////////////////////////TODO make it respond to the util::isnil test!
void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shaddow this??
bool empty() const;
private:
typedef mobject::session::Segment Segment;
/** Partitioning of the Timeline to be created by this tool. */
session::Segmentation& segments_;
//session::Segmentation& segments_;
///////////////////////////////////////////TODO: either put it inline, or use a scopend_ptr!!!!!!!!!!
};

View file

@ -40,7 +40,7 @@ namespace builder {
session::Fixture & fixedTimeline_;
auto_ptr<engine::RenderGraph> procSegment_;
scoped_ptr<SegementationTool> segmentation_;
scoped_ptr<SegmentationTool> segmentation_;
scoped_ptr<NodeCreatorTool> fabrication_;
@ -55,7 +55,7 @@ namespace builder {
: state_(new BuildProcessState (theTimeline))
{
ENSURE (state_->fixedTimeline_.isValid());
ENSURE (state_->procSegment_);
ENSURE (state_->procSegment_.get());
}
@ -63,21 +63,21 @@ namespace builder {
ToolFactory::configureSegmentation ()
{
REQUIRE (state_->fixedTimeline_.isValid());
REQUIRE (state_->procSegment_);
REQUIRE (state_->procSegment_.get());
state->segmentation_.reset (new SegmentationTool (state->fixedTimeline_));
return *(state->segmentation_);
state_->segmentation_.reset (new SegmentationTool (state_->fixedTimeline_));
return *(state_->segmentation_);
}
NodeCreatorTool &
ToolFactory::configureFabrication () //////////////////////TODO: should iterate in some way!
{
REQUIRE (state_->procSegment_);
REQUIRE (!isnil (*(state_>segmentation)));
REQUIRE (state_->procSegment_.get());
REQUIRE (!isnil (*(state_->segmentation_)));
state->fabrication_.reset (new NodeCreatorTool(*this));
return *(state->fabrication_);
state_->fabrication_.reset (new NodeCreatorTool(*this, *state_->procSegment_));
return *(state_->fabrication_);
}

View file

@ -73,6 +73,14 @@ namespace mobject
{
UNIMPLEMENTED ("serch for a given 'thing' within the EDL");
}
bool
EDL::validate()
{
UNIMPLEMENTED ("self-check");
return false;
}

View file

@ -62,7 +62,8 @@ namespace mobject {
bool isValid() { return this->validate(); }
private:
virtual bool validate() =0;
virtual bool validate();
};

View file

@ -28,7 +28,14 @@ namespace mobject
namespace session
{
/** */
/**
* @TODO: clarify asset->mobject relation and asset dependencies; Ticket #255
*/
asset::Proc const&
Effect::getProcAsset() const
{
UNIMPLEMENTED ("how to access the processing asset assotiated to a given Effect-MObject");
}

View file

@ -48,7 +48,8 @@ namespace session {
public:
/** access the underlying processing asset */
PProc getProcAsset () const;
asset::Proc const& getProcAsset () const;
//////////////////////TODO: clarify asset->mobject relation and asset dependencies; Ticket #255
};

View file

@ -48,7 +48,7 @@ namespace mobject {
{
/** segments of the engine in ordered sequence. */
list<Segement> segments_;
list<Segment> segments_;
};

View file

@ -21,8 +21,8 @@
* *****************************************************/
#include "common/test/run.hpp"
#include "common/util.hpp"
#include "lib/test/run.hpp"
#include "lib/util.hpp"
#include "lib/refarrayimpl.hpp"

View file

@ -108,12 +108,12 @@ namespace test {
return (b.outHandle == lastLevel ) // storage is allocated continuously
&& (b.outBuff <= b.inBuff ) // input slots are behind the output slots
&& (b.outHandle <= b.inHandle)
&& (b.inBuff == &b.outBuff [num.getNrO()])
&& (b.inHandle == &b.outHandle[num.getNrO()])
&& (not_within(b.outBuff, b.outHandle, &b.inHandle[num.getNrO()])) // storage doesn't overlap
&& (not_within(b.inBuff, b.outHandle, &b.inHandle[num.getNrO()]))
&& (not_within(b.outHandle, b.outBuff, &b.inBuff[num.getNrO()]))
&& (not_within(b.inHandle, b.outBuff, &b.inBuff[num.getNrO()]))
&& (b.inBuff == &b.outBuff [num.nrO])
&& (b.inHandle == &b.outHandle[num.nrO])
&& (not_within(b.outBuff, b.outHandle, &b.inHandle[num.nrO])) // storage doesn't overlap
&& (not_within(b.inBuff, b.outHandle, &b.inHandle[num.nrO]))
&& (not_within(b.outHandle, b.outBuff, &b.inBuff[num.nrO]))
&& (not_within(b.inHandle, b.outBuff, &b.inBuff[num.nrO]))
;
}
} // (End) internal defs

View file

@ -62,6 +62,12 @@ namespace test {
};
inline PEffect
createTestEffectMObject()
{
UNIMPLEMENTED ("how to create a dummy Effect for tests");
}
}
@ -82,10 +88,7 @@ namespace test {
WiringSituation setup(testSource);
setup.defineInput (4, predecessor1, 2);
setup.defineInput (2, predecessor2);
PEffect pEffect; /////////////////TODO how to get an simple Effect MObject for Tests???
PEffect pEffect = createTestEffectMObject();
ProcNode* pNode = nodeFab (pEffect, setup);
ASSERT (pNode);