GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Protected Member Functions | List of all members
Glip::CorePipeline::Pipeline Class Reference

Pipeline object. More...

#include <Pipeline.hpp>

Inheritance diagram for Glip::CorePipeline::Pipeline:
Inheritance graph

Public Types

enum  ActionType {
  Process,
  Reset
}
 Actions enumeration. More...
 
- Public Types inherited from Glip::CorePipeline::AbstractPipelineLayout
enum  ComponentKind {
  THIS_PIPELINE = -1,
  FILTER = 0,
  PIPELINE = 1
}
 Flags describing the component kind. More...
 

Public Member Functions

 Pipeline (const AbstractPipelineLayout &p, const std::string &name)
 Pipeline constructor. More...
 
int getNumActions (void) const
 Get the number of filters applied during processing. More...
 
int getSize (bool askDriver=false)
 Get the size in bytes of the elements on the GPU for this pipeline. More...
 
Pipelineoperator<< (HdlTexture &texture)
 Add a data as input to the pipeline. The user must maintain the texture in memory while this Pipeline hasn't received a Pipeline::Process or Pipeline::Reset signal. More...
 
Pipelineoperator<< (Pipeline &pipeline)
 Add all the output of variable pipeline as input of this pipeline. The user must maintain the texture(s) in memory while this Pipeline hasn't received a Pipeline::Process or Pipeline::Reset signal. More...
 
Pipelineoperator<< (ActionType a)
 Apply operation on previously input data. More...
 
HdlTextureout (int id=0, int cellID=0)
 Return the output of the pipeline. More...
 
HdlTextureout (const std::string &portName, int cellID=0)
 Return the output of the pipeline. More...
 
Filteroperator[] (int filterID)
 Access to the filter of described index. More...
 
bool wentThroughFirstRun (void) const
 Check if the pipeline was already computed, at least once. More...
 
bool isBroken (void) const
 Check if the pipeline is broken (its initialization failed, or an error occured during its first run). More...
 
int createBuffersCell (void)
 Create a new buffers cell for this pipeline. More...
 
int getNumBuffersCells (void) const
 Get the number of buffers cells. More...
 
bool isBuffersCellValid (int cellID) const
 Test if a cell ID is valid. More...
 
int getCurrentCellID (void) const
 Get the ID of the buffers cell currently in use for rendering. More...
 
std::vector< int > getCellIDs (void) const
 Get all the IDs of the available cells. More...
 
void changeTargetBuffersCell (int cellID)
 Change the rendering target to another buffers cell. More...
 
void removeBuffersCell (int cellID)
 Remove a buffers cell. If the cell is in use, it is necessary that the user change the rendering target afterward. More...
 
void enablePerfsMonitoring (void)
 Enable performances monitoring. More...
 
void disablePerfsMonitoring (void)
 Disable performances monitoring. More...
 
double getTiming (int filterID)
 Get last result of performance monitoring IF it is still enabled. More...
 
double getTiming (int action, std::string &filterName)
 Get last result of performance monitoring IF it is still enabled. More...
 
double getTotalTiming (void)
 Get total time elapsed for last run. More...
 
- Public Member Functions inherited from Glip::CorePipeline::AbstractPipelineLayout
 AbstractPipelineLayout (const AbstractPipelineLayout &c)
 AbstractPipelineLayout constructor. More...
 
void checkElement (int i) const
 Check if element exists and raise an exception if any errors occur. More...
 
int getNumElements (void) const
 Get the number of elements. More...
 
int getNumConnections (void) const
 Get the number of connections. More...
 
void getInfoElements (int &numFilters, int &numPipelines, int &numUniformVariables)
 Get the total number of Filters and Pipelines contained by this pipeline. More...
 
int getElementIndex (const std::string &name) const
 Get the ID of an element knowing its name. More...
 
bool doesElementExist (const std::string &name) const
 Check if an element exists knowing its name. More...
 
ComponentKind getElementKind (int i) const
 Get the kind of an element. More...
 
const std::string & getElementName (int i) const
 Get the name of an element. More...
 
int getElementID (int i) const
 Get element ID in global structure. More...
 
int getElementID (const std::string &name) const
 Get element ID in global structure. More...
 
AbstractComponentLayoutcomponentLayout (int i) const
 Get the component layout by its index. More...
 
AbstractComponentLayoutcomponentLayout (const std::string &name) const
 Get the component layout by its name. More...
 
AbstractFilterLayoutfilterLayout (int i) const
 Get the filter layout by its index. More...
 
AbstractFilterLayoutfilterLayout (const std::string &name) const
 Get the filter layout by its name. More...
 
AbstractPipelineLayoutpipelineLayout (int i) const
 Get the pipeline layout by its index. More...
 
AbstractPipelineLayoutpipelineLayout (const std::string &name) const
 Get the pipeline layout by its name. More...
 
Connection getConnection (int i) const
 Get the connection by its ID. More...
 
bool check (bool exception=true)
 Check the validity of the pipeline layout. More...
 
- Public Member Functions inherited from Glip::CorePipeline::AbstractComponentLayout
 AbstractComponentLayout (const AbstractComponentLayout &)
 AbstractComponentLayout constructor. More...
 
void checkInputPort (int i) const
 Check the validity of an input port. Raise an exception if any errors occur. More...
 
void checkOutputPort (int i) const
 Check the validity of an output port. Raise an exception if any errors occur. More...
 
const std::string & getLayoutName (void) const
 Returns the layout name of this component. More...
 
int getNumInputPort (void) const
 Get the number of input ports. More...
 
const std::string & getInputPortName (int i) const
 Return the name of an input port. Raise an exception if any errors occur. More...
 
int getInputPortID (const std::string &name) const
 Get the index of an input port knowing its name. Raise an exception if any errors occur. More...
 
bool doesInputPortExist (const std::string &name) const
 Check if an input port exists, knowing its name. More...
 
int getNumOutputPort (void) const
 Get the number of output ports. More...
 
const std::string & getOutputPortName (int i) const
 Return the name of an output port. Raise an exception if any errors occur. More...
 
int getOutputPortID (const std::string &name) const
 Get the index of an output port knowing its name. Raise an exception if any errors occur. More...
 
bool doesOutputPortExist (const std::string &name) const
 Check if an output port exists, knowing its name. More...
 
- Public Member Functions inherited from Glip::CorePipeline::Component
std::string getFullName (void) const
 Returns the full name of this component (might be overloaded). More...
 
const std::string & getName (void) const
 Returns the name of this component. More...
 

Protected Member Functions

void process (void)
 Apply the pipeline.
 
- Protected Member Functions inherited from Glip::CorePipeline::AbstractPipelineLayout
 AbstractPipelineLayout (const std::string &type)
 AbstractPipelineLayout constructor. More...
 
void setElementID (int i, int ID)
 Set element ID in global structure or raise an exception if any errors occur. More...
 
std::vector< ConnectiongetConnectionDestinations (int id, int p)
 Get all destinations of an output port. More...
 
Connection getConnectionSource (int id, int p)
 Get the source of an input port. More...
 
- Protected Member Functions inherited from Glip::CorePipeline::AbstractComponentLayout
 AbstractComponentLayout (const std::string &_layoutName)
 AbstractComponentLayout constructor. More...
 
 AbstractComponentLayout (const std::string &_layoutName, const std::vector< std::string > &_inputPorts, const std::vector< std::string > &_outputPorts)
 AbstractComponentLayout constructor. More...
 
- Protected Member Functions inherited from Glip::CorePipeline::Component
 Component (const std::string &_layoutName, const std::vector< std::string > &_inputPorts, const std::vector< std::string > &_outputPorts, const std::string &_instanceName)
 Component constructor. More...
 
 Component (const AbstractComponentLayout &, const std::string &_instanceName)
 Component constructor. More...
 

Detailed Description

Pipeline object.

How to process the inputs :

HdlPipeline myPipeline(myPipelineLayout, "InstanceName");
HdlTexture input1(...), input2(...), ...;
myPipeline << input1 << input2 << ... << Pipeline::Process;
outputDevice << myPipeline.out(0);

How to access and modify a uniform variable in a filter :

// Find the global ID of the targeted filter :
int id = myPipeline.pipelineLayout("SubPipeline1").pipelineLayout("SubPipeline2").getElementID("Filter");
// Access the filter and modify the variable :
myPipeline[id].prgm().modifyVar("variable", GL_FLOAT, 3.1415);

Buffers Cell : in order to save rendering results (for a ping-pong between the same pipeline, its outputs being used as its future inputs), you can use the buffers cell which represents the needed buffers for one full computation. A simple example of a pipeline applied in a loop :

// Get the ID of the cell created by default :
int cellA = myPipeline.getCurrentCellID();
// Create another cell :
int cellB = myPipeline.createBuffersCell();
// Initialization ;
myPipeline << input1 << input2 << ... << Pipeline::Process;
// Loop :
for(int k=0; k<numLoops; k++)
{
if(k%2==0)
{
myPipeline.changeTargetBuffersCell(cellB); // cellA was written in the init, now use cellB.
// Compute :
myPipeline << myPipeline.out(0, cellA) << myPipeline.out(1, cellA) << ... << Pipeline::Process;
}
else
{
myPipeline.changeTargetBuffersCell(cellA); // The opposite.
// Compute :
myPipeline << myPipeline.out(0, cellB) << myPipeline.out(1, cellB) << ... << Pipeline::Process;
}
}

Member Enumeration Documentation

Actions enumeration.

Enumerator
Process 

To start process.

Reset 

To reset argument chain.

Constructor & Destructor Documentation

Pipeline::Pipeline ( const AbstractPipelineLayout p,
const std::string &  name 
)

Pipeline constructor.

Parameters
pPipeline layout.
nameName of the pipeline.

Member Function Documentation

void Pipeline::changeTargetBuffersCell ( int  cellID)

Change the rendering target to another buffers cell.

Parameters
cellIDThe targeted ID.
int Pipeline::createBuffersCell ( void  )

Create a new buffers cell for this pipeline.

Returns
The ID of the new cell (larger or equal to 1).

The function will not change the current cell used by the pipeline.

void Pipeline::disablePerfsMonitoring ( void  )

Disable performances monitoring.

Stops a monitoring session on this instance. Do nothing if no session was started.

void Pipeline::enablePerfsMonitoring ( void  )

Enable performances monitoring.

Any following process on this instance will record time to perform the pipeline (time per element and total time). Calling this function twice will not reset previous results.

std::vector< int > Pipeline::getCellIDs ( void  ) const

Get all the IDs of the available cells.

Returns
A list of all the valid IDs.
int Pipeline::getCurrentCellID ( void  ) const

Get the ID of the buffers cell currently in use for rendering.

Returns
The cell ID of the current buffers cell.
int Pipeline::getNumActions ( void  ) const

Get the number of filters applied during processing.

Returns
Number of filters applied during processing.
int Pipeline::getNumBuffersCells ( void  ) const

Get the number of buffers cells.

Returns
The number of cells.
int Pipeline::getSize ( bool  askDriver = false)

Get the size in bytes of the elements on the GPU for this pipeline.

Parameters
askDriverIf true, it will use HdlTexture::getSizeOnGPU() to determine the real size (might be slower).
Returns
Size in bytes.
double Pipeline::getTiming ( int  filterID)

Get last result of performance monitoring IF it is still enabled.

Parameters
filterIDThe ID of the filter.
Returns
Time in milliseconds needed to apply the filter (not counting binding operation).
double Pipeline::getTiming ( int  action,
std::string &  filterName 
)

Get last result of performance monitoring IF it is still enabled.

Parameters
actionThe ID of the filter.
filterNameA reference string that will contain the name of the filter indexed by action at the end of the function.
Returns
Time in milliseconds needed to apply the filter (not counting binding operation).
double Pipeline::getTotalTiming ( void  )

Get total time elapsed for last run.

Returns
Time in milliseconds needed to apply the whole pipeline (counting everything and flushing after each filter).
bool Pipeline::isBroken ( void  ) const

Check if the pipeline is broken (its initialization failed, or an error occured during its first run).

Returns
True if the pipeline is broken and should not be used.
bool Pipeline::isBuffersCellValid ( int  cellID) const

Test if a cell ID is valid.

Parameters
cellIDThe targeted ID.
Returns
True if the cell ID corresponds to an existing buffers cell.
Pipeline & Pipeline::operator<< ( HdlTexture texture)

Add a data as input to the pipeline. The user must maintain the texture in memory while this Pipeline hasn't received a Pipeline::Process or Pipeline::Reset signal.

Parameters
textureThe data to use.
Returns
This pipeline or raise an exception if any errors occur.
Pipeline & Pipeline::operator<< ( Pipeline pipeline)

Add all the output of variable pipeline as input of this pipeline. The user must maintain the texture(s) in memory while this Pipeline hasn't received a Pipeline::Process or Pipeline::Reset signal.

Parameters
pipelineThe pipeline outputs to append.
Returns
This pipeline or raise an exception if any errors occur.
Pipeline & Pipeline::operator<< ( ActionType  a)

Apply operation on previously input data.

Parameters
aThe ActionType (Process or Reset arguments).
Returns
This pipeline or raise an exception if any errors occur.
Filter & Pipeline::operator[] ( int  filterID)

Access to the filter of described index.

Parameters
filterIDThe index of the filter, obtained with AbstractPipelineLayout::getElementID.
Returns
The index or raise an exception if any errors occur.
HdlTexture & Pipeline::out ( int  i = 0,
int  cellID = 0 
)

Return the output of the pipeline.

Parameters
iThe ID of the output port.
cellIDChoose the target cell (default : current in-use cell).
Returns
A reference to the corresponding output texture or raise an exception if any errors occur.
HdlTexture & Pipeline::out ( const std::string &  portName,
int  cellID = 0 
)

Return the output of the pipeline.

Parameters
portNameThe name of the output port.
cellIDChoose the target cell (default : current in-use cell).
Returns
A reference to the corresponding output texture or raise an exception if any errors occur.
void Pipeline::removeBuffersCell ( int  cellID)

Remove a buffers cell. If the cell is in use, it is necessary that the user change the rendering target afterward.

Parameters
cellIDThe targeted ID.
bool Pipeline::wentThroughFirstRun ( void  ) const

Check if the pipeline was already computed, at least once.

Returns
True if the pipeline was already applied.

The documentation for this class was generated from the following files: