Moved GraphicsCostEstimator ref pointer into osg::State

This commit is contained in:
Robert Osfield
2011-02-03 12:42:23 +00:00
parent 88ce98b47d
commit 6496e35421
4 changed files with 24 additions and 16 deletions

View File

@@ -29,6 +29,7 @@
#include <osg/Viewport>
#include <osg/GLBeginEndAdapter>
#include <osg/ArrayDispatchers>
#include <osg/GraphicsCostEstimator>
#include <iosfwd>
#include <vector>
@@ -1381,12 +1382,24 @@ class OSG_EXPORT State : public Referenced, public Observer
virtual void objectDeleted(void* object);
/** get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/
/** Get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/
inline GLBeginEndAdapter& getGLBeginEndAdapter() { return _glBeginEndAdapter; }
/** get the helper class for dispatching osg::Arrays as OpenGL attribute data.*/
/** Get the helper class for dispatching osg::Arrays as OpenGL attribute data.*/
inline ArrayDispatchers& getArrayDispatchers() { return _arrayDispatchers; }
/** Set the helper class that provides applications with estimate on how much different graphics operations will cost.*/
inline void setGraphicsCostEstimator(GraphicsCostEstimator* gce) { _graphicsCostEstimator = gce; }
/** Get the helper class that provides applications with estimate on how much different graphics operations will cost.*/
inline GraphicsCostEstimator* getGraphicsCostEstimator() { return _graphicsCostEstimator.get(); }
/** Get the cont helper class that provides applications with estimate on how much different graphics operations will cost.*/
inline const GraphicsCostEstimator* getGraphicsCostEstimator() const { return _graphicsCostEstimator.get(); }
/** Support for synchronizing the system time and the timestamp
* counter available with ARB_timer_query. Note that State
* doesn't update these values itself.
@@ -1822,6 +1835,9 @@ class OSG_EXPORT State : public Referenced, public Observer
GLBeginEndAdapter _glBeginEndAdapter;
ArrayDispatchers _arrayDispatchers;
osg::ref_ptr<GraphicsCostEstimator> _graphicsCostEstimator;
Timer_t _startTick;
Timer_t _gpuTick;
GLuint64EXT _gpuTimestamp;

View File

@@ -15,7 +15,6 @@
#define OSGUTIL_INCREMENTALCOMPILEOPERATOR
#include <osgUtil/GLObjectsVisitor>
#include <osg/GraphicsCostEstimator>
#include <osg/Geometry>
namespace osgUtil {
@@ -120,10 +119,6 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
osg::Geometry* getForceTextureDownloadGeometry() { return _forceTextureDownloadGeometry.get(); }
const osg::Geometry* getForceTextureDownloadGeometry() const { return _forceTextureDownloadGeometry.get(); }
osg::GraphicsCostEstimator* getGraphicsCostEstimator() { return _graphicsCostEstimator.get(); }
const osg::GraphicsCostEstimator* getGraphicsCostEstimator() const { return _graphicsCostEstimator.get(); }
typedef std::vector<osg::GraphicsContext*> Contexts;
void assignContexts(Contexts& contexts);
void removeContexts(Contexts& contexts);
@@ -148,7 +143,6 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
double availableTime() { return allocatedTime - timer.elapsedTime(); }
IncrementalCompileOperation* incrementalCompileOperation;
osg::GraphicsCostEstimator* graphicsCostEstimator;
unsigned int maxNumObjectsToCompile;
osg::ElapsedTime timer;
double allocatedTime;
@@ -280,7 +274,6 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
double _conservativeTimeRatio;
osg::ref_ptr<osg::Geometry> _forceTextureDownloadGeometry;
osg::ref_ptr<osg::GraphicsCostEstimator> _graphicsCostEstimator;
OpenThreads::Mutex _toCompileMutex;
CompileSets _toCompile;