From Tim Moore, Fix for drivers that don't properly support timer extensions.

""
This commit is contained in:
Robert Osfield 2010-11-24 10:38:28 +00:00
parent e2a315ee49
commit 043ae090a5
3 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;
}