openscenegraph
osgUtil::IncrementalCompileOperation Class Reference

#include <IncrementalCompileOperation>

Inheritance diagram for osgUtil::IncrementalCompileOperation:
osg::GraphicsOperation osg::Operation osg::Referenced

Classes

struct  CompileInfo
struct  CompileOp
struct  CompileDrawableOp
struct  CompileTextureOp
struct  CompileProgramOp
class  CompileList
struct  CompileCompletedCallback
class  CompileSet

Public Types

typedef std::vector< osg::GraphicsContext * > Contexts
typedef std::set< osg::GraphicsContext * > ContextSet
typedef std::list< osg::ref_ptr< CompileSet > > CompileSets

Public Member Functions

 IncrementalCompileOperation ()
bool isActive () const
bool requiresCompile (StateToCompile &stateToCompile)
void setTargetFrameRate (double tfr)
double getTargetFrameRate () const
void setMinimumTimeAvailableForGLCompileAndDeletePerFrame (double ta)
double getMinimumTimeAvailableForGLCompileAndDeletePerFrame () const
void setMaximumNumOfObjectsToCompilePerFrame (unsigned int num)
unsigned int getMaximumNumOfObjectsToCompilePerFrame () const
void setFlushTimeRatio (double ratio)
double getFlushTimeRatio () const
void setConservativeTimeRatio (double ratio)
double getConservativeTimeRatio () const
void assignForceTextureDownloadGeometry ()
void setForceTextureDownloadGeometry (osg::Geometry *geom)
osg::GeometrygetForceTextureDownloadGeometry ()
const osg::GeometrygetForceTextureDownloadGeometry () const
void assignContexts (Contexts &contexts)
void removeContexts (Contexts &contexts)
void addGraphicsContext (osg::GraphicsContext *gc)
void removeGraphicsContext (osg::GraphicsContext *gc)
ContextSetgetContextSet ()
const ContextSetgetContextSet () const
void mergeCompiledSubgraphs (const osg::FrameStamp *frameStamp)
void setCurrentFrameNumber (unsigned int fn)
unsigned int getCurrentFrameNumber () const
void compileAllForNextFrame (unsigned int numFramesToDoCompileAll=1)
void setCompileAllTillFrameNumber (unsigned int fn)
unsigned int getCompileAllTillFrameNumber () const
virtual void operator() (osg::GraphicsContext *context)
void add (osg::Node *subgraphToCompile)
void add (osg::Group *attachmentPoint, osg::Node *subgraphToCompile)
void add (CompileSet *compileSet, bool callBuildCompileMap=true)
void remove (CompileSet *compileSet)
OpenThreads::MutexgetToCompiledMutex ()
CompileSetsgetToCompile ()
OpenThreads::MutexgetCompiledMutex ()
CompileSetsgetCompiled ()
void setMarkerObject (osg::Object *mo)
osg::ObjectgetMarkerObject ()
const osg::ObjectgetMarkerObject () const
Public Member Functions inherited from osg::GraphicsOperation
 GraphicsOperation (const std::string &name, bool keep)
virtual void operator() (Object *object)
virtual void resizeGLObjectBuffers (unsigned int)
virtual void releaseGLObjects (osg::State *=0) const
Public Member Functions inherited from osg::Operation
 Operation (const std::string &name, bool keep)
void setName (const std::string &name)
const std::string & getName () const
void setKeep (bool keep)
bool getKeep () const
virtual void release ()
Public Member Functions inherited from osg::Referenced
 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
virtual void setThreadSafeRefUnref (bool)
bool getThreadSafeRefUnref () const
OpenThreads::MutexgetRefMutex () const
int ref () const
int unref () const
int unref_nodelete () const
int referenceCount () const
ObserverSetgetObserverSet () const
ObserverSetgetOrCreateObserverSet () const
void addObserver (Observer *observer) const
void removeObserver (Observer *observer) const

Protected Member Functions

virtual ~IncrementalCompileOperation ()
void compileSets (CompileSets &toCompile, CompileInfo &compileInfo)
Protected Member Functions inherited from osg::Operation
 Operation ()
virtual ~Operation ()
Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Protected Attributes

double _targetFrameRate
double _minimumTimeAvailableForGLCompileAndDeletePerFrame
unsigned int _maximumNumOfObjectsToCompilePerFrame
double _flushTimeRatio
double _conservativeTimeRatio
unsigned int _currentFrameNumber
unsigned int _compileAllTillFrameNumber
osg::ref_ptr< osg::Geometry_forceTextureDownloadGeometry
OpenThreads::Mutex _toCompileMutex
CompileSets _toCompile
OpenThreads::Mutex _compiledMutex
CompileSets _compiled
ContextSet _contexts
osg::ref_ptr< osg::Object_markerObject
Protected Attributes inherited from osg::Operation
std::string _name
bool _keep
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Additional Inherited Members

Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
static void setDeleteHandler (DeleteHandler *handler)
static DeleteHandlergetDeleteHandler ()

Member Typedef Documentation

◆ CompileSets

◆ Contexts

◆ ContextSet

Constructor & Destructor Documentation

◆ IncrementalCompileOperation()

osgUtil::IncrementalCompileOperation::IncrementalCompileOperation ( )

◆ ~IncrementalCompileOperation()

virtual osgUtil::IncrementalCompileOperation::~IncrementalCompileOperation ( )
protectedvirtual

Member Function Documentation

◆ add() [1/3]

void osgUtil::IncrementalCompileOperation::add ( CompileSet * compileSet,
bool callBuildCompileMap = true )

Add a CompileSet to be compiled.

◆ add() [2/3]

void osgUtil::IncrementalCompileOperation::add ( osg::Group * attachmentPoint,
osg::Node * subgraphToCompile )

Add a subgraph to be compiled and add automatically to attachPoint on call to mergeCompiledSubgraphs.

◆ add() [3/3]

void osgUtil::IncrementalCompileOperation::add ( osg::Node * subgraphToCompile)

Add a subgraph to be compiled.

◆ addGraphicsContext()

void osgUtil::IncrementalCompileOperation::addGraphicsContext ( osg::GraphicsContext * gc)

◆ assignContexts()

void osgUtil::IncrementalCompileOperation::assignContexts ( Contexts & contexts)

◆ assignForceTextureDownloadGeometry()

void osgUtil::IncrementalCompileOperation::assignForceTextureDownloadGeometry ( )

Assign a geometry and associated StateSet than is applied after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card.

◆ compileAllForNextFrame()

void osgUtil::IncrementalCompileOperation::compileAllForNextFrame ( unsigned int numFramesToDoCompileAll = 1)

tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, for specified number of frames.

◆ compileSets()

void osgUtil::IncrementalCompileOperation::compileSets ( CompileSets & toCompile,
CompileInfo & compileInfo )
protected

◆ getCompileAllTillFrameNumber()

unsigned int osgUtil::IncrementalCompileOperation::getCompileAllTillFrameNumber ( ) const
inline

◆ getCompiled()

CompileSets & osgUtil::IncrementalCompileOperation::getCompiled ( )
inline

References _compiled.

◆ getCompiledMutex()

OpenThreads::Mutex * osgUtil::IncrementalCompileOperation::getCompiledMutex ( )
inline

References _compiledMutex.

◆ getConservativeTimeRatio()

double osgUtil::IncrementalCompileOperation::getConservativeTimeRatio ( ) const
inline

◆ getContextSet() [1/2]

ContextSet & osgUtil::IncrementalCompileOperation::getContextSet ( )
inline

References _contexts.

◆ getContextSet() [2/2]

const ContextSet & osgUtil::IncrementalCompileOperation::getContextSet ( ) const
inline

References _contexts.

◆ getCurrentFrameNumber()

unsigned int osgUtil::IncrementalCompileOperation::getCurrentFrameNumber ( ) const
inline

References _currentFrameNumber.

◆ getFlushTimeRatio()

double osgUtil::IncrementalCompileOperation::getFlushTimeRatio ( ) const
inline

References _flushTimeRatio.

◆ getForceTextureDownloadGeometry() [1/2]

osg::Geometry * osgUtil::IncrementalCompileOperation::getForceTextureDownloadGeometry ( )
inline

◆ getForceTextureDownloadGeometry() [2/2]

const osg::Geometry * osgUtil::IncrementalCompileOperation::getForceTextureDownloadGeometry ( ) const
inline

◆ getMarkerObject() [1/2]

osg::Object * osgUtil::IncrementalCompileOperation::getMarkerObject ( )
inline

References _markerObject.

◆ getMarkerObject() [2/2]

const osg::Object * osgUtil::IncrementalCompileOperation::getMarkerObject ( ) const
inline

References _markerObject.

◆ getMaximumNumOfObjectsToCompilePerFrame()

unsigned int osgUtil::IncrementalCompileOperation::getMaximumNumOfObjectsToCompilePerFrame ( ) const
inline

Get the maximum number of OpenGL objects that the page should attempt to compile per frame.

References _maximumNumOfObjectsToCompilePerFrame.

◆ getMinimumTimeAvailableForGLCompileAndDeletePerFrame()

double osgUtil::IncrementalCompileOperation::getMinimumTimeAvailableForGLCompileAndDeletePerFrame ( ) const
inline

Get the minimum amount of time that should be made available for compiling and delete OpenGL objects per frame. For usage see notes in setTargetFrameRate.

References _minimumTimeAvailableForGLCompileAndDeletePerFrame.

◆ getTargetFrameRate()

double osgUtil::IncrementalCompileOperation::getTargetFrameRate ( ) const
inline

Get the target frame rate that the IncrementalCompileOperation should assume.

References _targetFrameRate.

◆ getToCompile()

CompileSets & osgUtil::IncrementalCompileOperation::getToCompile ( )
inline

References _toCompile.

◆ getToCompiledMutex()

OpenThreads::Mutex * osgUtil::IncrementalCompileOperation::getToCompiledMutex ( )
inline

References _toCompileMutex.

◆ isActive()

bool osgUtil::IncrementalCompileOperation::isActive ( ) const
inline

Return true if the IncrementCompileOperation is active.

References _contexts.

◆ mergeCompiledSubgraphs()

void osgUtil::IncrementalCompileOperation::mergeCompiledSubgraphs ( const osg::FrameStamp * frameStamp)

Merge subgraphs that have been compiled.

◆ operator()()

virtual void osgUtil::IncrementalCompileOperation::operator() ( osg::GraphicsContext * context)
virtual

◆ remove()

void osgUtil::IncrementalCompileOperation::remove ( CompileSet * compileSet)

Remove CompileSet from list.

◆ removeContexts()

void osgUtil::IncrementalCompileOperation::removeContexts ( Contexts & contexts)

◆ removeGraphicsContext()

void osgUtil::IncrementalCompileOperation::removeGraphicsContext ( osg::GraphicsContext * gc)

◆ requiresCompile()

bool osgUtil::IncrementalCompileOperation::requiresCompile ( StateToCompile & stateToCompile)

◆ setCompileAllTillFrameNumber()

void osgUtil::IncrementalCompileOperation::setCompileAllTillFrameNumber ( unsigned int fn)
inline

tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, till specified frame number.

References _compileAllTillFrameNumber.

◆ setConservativeTimeRatio()

void osgUtil::IncrementalCompileOperation::setConservativeTimeRatio ( double ratio)
inline

ConservativeTimeRatio governs how much of the measured spare time in each frame is used for flushing deleted and compile new OpenGL objects. Default value is 0.5, valid range is 0.1 to 1.0. A ratio near 1.0 will lead to paged databases being compiled and merged quicker but increase the chances of frame drop. A ratio near 0.1 will lead to paged databases being compiled and merged closer but reduce the chances of frame drop.

References _conservativeTimeRatio.

◆ setCurrentFrameNumber()

void osgUtil::IncrementalCompileOperation::setCurrentFrameNumber ( unsigned int fn)
inline

Set the current frame number that the IncrementalCompileOperation should use as a reference value for calculations based on current frame number. Note, this value is set by the mergeCompiledSubgraphs(..) method so one won't normally need to call set the CurrentFrameNumber manually.

References _currentFrameNumber.

◆ setFlushTimeRatio()

void osgUtil::IncrementalCompileOperation::setFlushTimeRatio ( double ratio)
inline

FlushTimeRatio governs how much of the spare time in each frame is used for flushing deleted OpenGL objects. Default value is 0.5, valid range is 0.1 to 0.9.

References _flushTimeRatio.

◆ setForceTextureDownloadGeometry()

void osgUtil::IncrementalCompileOperation::setForceTextureDownloadGeometry ( osg::Geometry * geom)
inline

Set the osg::Geometry to apply after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card.

References _forceTextureDownloadGeometry.

◆ setMarkerObject()

void osgUtil::IncrementalCompileOperation::setMarkerObject ( osg::Object * mo)
inline

References _markerObject.

◆ setMaximumNumOfObjectsToCompilePerFrame()

void osgUtil::IncrementalCompileOperation::setMaximumNumOfObjectsToCompilePerFrame ( unsigned int num)
inline

Set the maximum number of OpenGL objects that the page should attempt to compile per frame. Note, Lower values reduces chances of a frame drop but lower the rate that database will be paged in at. Default value is 8.

References _maximumNumOfObjectsToCompilePerFrame.

◆ setMinimumTimeAvailableForGLCompileAndDeletePerFrame()

void osgUtil::IncrementalCompileOperation::setMinimumTimeAvailableForGLCompileAndDeletePerFrame ( double ta)
inline

Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame. Default value is 0.001 (1 millisecond). For usage see notes in setTargetFrameRate.

References _minimumTimeAvailableForGLCompileAndDeletePerFrame.

◆ setTargetFrameRate()

void osgUtil::IncrementalCompileOperation::setTargetFrameRate ( double tfr)
inline

Set the target frame rate that the IncrementalCompileOperation should assume. Typically one would set this to the value refresh rate of your display system i.e. 60Hz. Default value is 100. Usage notes. The TargetFrameRate and the MinimumTimeAvailableForGLCompileAndDeletePerFrame parameters are not directly used by IncrementalCompileOperation, but are should be used as a guide for how long to set aside per frame for compiling and deleting OpenGL objects. The longer amount of time to set aside the faster databases will be paged in but with increased chance of frame drops, the lower the amount of time the set aside the slower databases will paged it but with better chance of avoid any frame drops. The default values are chosen to achieve the later when running on a modern mid to high end PC. The way to compute the amount of available time use a scheme such as : availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame).

References _targetFrameRate.

Member Data Documentation

◆ _compileAllTillFrameNumber

unsigned int osgUtil::IncrementalCompileOperation::_compileAllTillFrameNumber
protected

◆ _compiled

CompileSets osgUtil::IncrementalCompileOperation::_compiled
protected

Referenced by getCompiled().

◆ _compiledMutex

OpenThreads::Mutex osgUtil::IncrementalCompileOperation::_compiledMutex
protected

Referenced by getCompiledMutex().

◆ _conservativeTimeRatio

double osgUtil::IncrementalCompileOperation::_conservativeTimeRatio
protected

◆ _contexts

ContextSet osgUtil::IncrementalCompileOperation::_contexts
protected

◆ _currentFrameNumber

unsigned int osgUtil::IncrementalCompileOperation::_currentFrameNumber
protected

◆ _flushTimeRatio

double osgUtil::IncrementalCompileOperation::_flushTimeRatio
protected

◆ _forceTextureDownloadGeometry

osg::ref_ptr<osg::Geometry> osgUtil::IncrementalCompileOperation::_forceTextureDownloadGeometry
protected

◆ _markerObject

osg::ref_ptr<osg::Object> osgUtil::IncrementalCompileOperation::_markerObject
protected

◆ _maximumNumOfObjectsToCompilePerFrame

unsigned int osgUtil::IncrementalCompileOperation::_maximumNumOfObjectsToCompilePerFrame
protected

◆ _minimumTimeAvailableForGLCompileAndDeletePerFrame

double osgUtil::IncrementalCompileOperation::_minimumTimeAvailableForGLCompileAndDeletePerFrame
protected

◆ _targetFrameRate

double osgUtil::IncrementalCompileOperation::_targetFrameRate
protected

◆ _toCompile

CompileSets osgUtil::IncrementalCompileOperation::_toCompile
protected

Referenced by getToCompile().

◆ _toCompileMutex

OpenThreads::Mutex osgUtil::IncrementalCompileOperation::_toCompileMutex
protected

Referenced by getToCompiledMutex().


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