GL: Timer query check if result is available.

This commit is contained in:
Branimir Karadžić 2015-08-16 15:44:13 -07:00
parent bc2077acb0
commit 79d2b81eb1
1 changed files with 13 additions and 5 deletions

View File

@ -1151,13 +1151,21 @@ namespace bgfx { namespace gl
{ {
if (0 != m_control.available() ) if (0 != m_control.available() )
{ {
GL_CHECK(glGetQueryObjectui64v(m_frame[m_control.m_read] GLint available;
, GL_QUERY_RESULT GL_CHECK(glGetQueryObjectiv(m_frame[m_control.m_read]
, &m_elapsed , GL_QUERY_RESULT_AVAILABLE
, &available
) ); ) );
m_control.consume(1);
return true; if (available)
{
GL_CHECK(glGetQueryObjectui64v(m_frame[m_control.m_read]
, GL_QUERY_RESULT
, &m_elapsed
) );
m_control.consume(1);
return true;
}
} }
return false; return false;