diff options
author | Graham Linden <none@none> | 2014-11-17 11:40:28 -0800 |
---|---|---|
committer | Graham Linden <none@none> | 2014-11-17 11:40:28 -0800 |
commit | 9eeb8344a6dd8721ebc85463e966b05a9b034381 (patch) | |
tree | 9f4d1bb68d4636fe0a3a426d71fd1837209ae0a0 /indra/llrender/llglslshader.cpp | |
parent | 2301cf800f40101baed7a5936683d0b1e4968be1 (diff) |
Avoid using GL_ARB_timer_query functionality when not supported and protect against probably-not-NULL current bound shader pointer
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b81dd4c9a1..a98737ee64 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -214,7 +214,7 @@ void LLGLSLShader::startProfile() //static void LLGLSLShader::stopProfile(U32 count, U32 mode) { - if (sProfileEnabled) + if (sProfileEnabled && sCurBoundShaderPtr) { sCurBoundShaderPtr->readProfileQuery(count, mode); } @@ -263,18 +263,29 @@ void LLGLSLShader::placeProfileQuery() glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery); - glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); + + if (gGLManager.mHasTimerQuery) + { + glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); + } #endif } void LLGLSLShader::readProfileQuery(U32 count, U32 mode) { #if !LL_DARWIN - glEndQueryARB(GL_TIME_ELAPSED); + if (gGLManager.mHasTimerQuery) + { + glEndQueryARB(GL_TIME_ELAPSED); + } + glEndQueryARB(GL_SAMPLES_PASSED); U64 time_elapsed = 0; - glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); + if (gGLManager.mHasTimerQuery) + { + glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); + } U64 samples_passed = 0; glGetQueryObjectui64v(mSamplesQuery, GL_QUERY_RESULT, &samples_passed); |