From 043ae090a5de62580ae550f2e1079408c1b52217 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 24 Nov 2010 10:38:28 +0000 Subject: [PATCH] From Tim Moore, Fix for drivers that don't properly support timer extensions. "" --- include/osg/Drawable | 2 +- src/osgViewer/Renderer.cpp | 2 +- src/osgViewer/StatsHandler.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 3b6b235f9..4ea527506 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -609,7 +609,7 @@ class OSG_EXPORT Drawable : public Object void setTimerQuerySupported(bool flag) { _isTimerQuerySupported = flag; } bool isTimerQuerySupported() const { return _isTimerQuerySupported; } void setARBTimerQuerySupported(bool flag) { _isARBTimerQuerySupported = flag; } - bool isARBTimerQuerySupported() { return _isARBTimerQuerySupported; } + bool isARBTimerQuerySupported() const { return _isARBTimerQuerySupported; } void glSecondaryColor3ubv(const GLubyte* coord) const; void glSecondaryColor3fv(const GLfloat* coord) const; diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index 39ef535df..f914845ca 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -410,7 +410,7 @@ void Renderer::initialize(osg::State* state) { _initialized = true; osg::Drawable::Extensions* ext = osg::Drawable::getExtensions(state->getContextID(), true); - if (ext->isARBTimerQuerySupported()) + if (ext->isARBTimerQuerySupported() && state->getTimestampBits() > 0) _querySupport = new ARBQuerySupport(); else if (ext->isTimerQuerySupported()) _querySupport = new EXTQuerySupport(); diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index e663d1afd..601152e5d 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -1090,9 +1090,13 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) { if ((*citr)->getGraphicsContext()) { - unsigned int contextID = (*citr)->getGraphicsContext()->getState()->getContextID(); + const osg::State* state = (*citr)->getGraphicsContext()->getState(); + unsigned int contextID = state->getContextID(); const osg::Drawable::Extensions* extensions = osg::Drawable::getExtensions(contextID, false); - if (extensions && extensions->isTimerQuerySupported()) + if (extensions && + (((extensions->isARBTimerQuerySupported() + && state->getTimestampBits() > 0)) + || extensions->isTimerQuerySupported())) { ++numCamrasWithTimerQuerySupport; }