GPU timers and NVidia 257.15 Drivers

Anyone else having problems with GPU timers under NVidia 257.15 drivers? They are working fine under 197.45 (windows XP, 64 bit) but if I go to 257.15, glGetQueryObjectiv no longer lets me know when a result is available.

On my machines with WinXP x32, Vista x32 and Win7 x64 (8600M, 8600GT, GTX470) everything works perfectly with 257.15 drivers. Furthermore, TimerQuery works better than in previous releases. I had a problem with short intervals where fps should be several hundreds or thousands, but timer returned 0.4, for example. Now (with 257.15) it doesn’t appear.

Can you post a peace of your code to check if the usage is correct (although you said that it used to work… :frowning: )?

This is how I get elapsed time


GLint available = 0;

glGetQueryObjectiv(m_iTimeQuery, GL_QUERY_RESULT_AVAILABLE, &available);

if(available) 
        glGetQueryObjectuiv(m_iTimeQuery, GL_QUERY_RESULT, &m_timeElapsed_ns);
	
glBeginQuery(GL_TIME_ELAPSED, m_iTimeQuery);

//DrawScene()

glEndQuery(GL_TIME_ELAPSED);


Is that working Aleksander? I mean what if the result is not available, yet, don’t you start a new query with the same object and thus overwrite any previous query?

So, if your result is always just not yet ready, won’t you destroy any possibility to ever get a result, because you always “cancel” your previous query ?

Jan.

You are right! Starting new query can be done conditionally, according to availability of previous reading. But, because this code measures a frame rate of whole DrawScene function, it always succeeds.

Ok, for the purity reason, let’s change the code this way:


Lint available = 0;

glGetQueryObjectiv(m_iTimeQuery, GL_QUERY_RESULT_AVAILABLE, &available);

if(available){
        glGetQueryObjectuiv(m_iTimeQuery, GL_QUERY_RESULT, &m_timeElapsed_ns);
        glBeginQuery(GL_TIME_ELAPSED, m_iTimeQuery);
}

//DrawScene()

if(available)	
        glEndQuery(GL_TIME_ELAPSED);

This is the full version of measuring execution time code (with declarations and initialization code).


// -------------
// GLRenderer.h 
// -------------
GLuint m_iTimeQuery;
unsigned int m_timeElapsed_ns;


// ---------------
// GLRenderer.cpp 
// ---------------

// Prepare scene

glGenQueries(1, &m_iTimeQuery);
glBeginQuery(GL_TIME_ELAPSED, m_iTimeQuery);
//...
glEndQuery(GL_TIME_ELAPSED);

// Draw scene

GLint available = 0;
glGetQueryObjectiv(m_iTimeQuery, GL_QUERY_RESULT_AVAILABLE, &available);

if(available){
   glGetQueryObjectuiv(m_iTimeQuery, GL_QUERY_RESULT, &m_timeElapsed_ns);
   glBeginQuery(GL_TIME_ELAPSED, m_iTimeQuery);
}

//DrawScene()

if(available)	
   glEndQuery(GL_TIME_ELAPSED);