diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-11-26 11:40:32 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-11-26 11:40:32 -0500 |
commit | e345cfbe55f8a530432780b03ff78b4edae6e036 (patch) | |
tree | 7b1f14c30834f14cc1bff9e3f9da101f39135b33 /indra/llrender/llglslshader.cpp | |
parent | c7c549b7e24af3b9ee87d464a03adeab75ee6553 (diff) | |
parent | 2301cf800f40101baed7a5936683d0b1e4968be1 (diff) |
merge
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 9fae63385d..b81dd4c9a1 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -87,6 +87,7 @@ LLShaderFeatures::LLShaderFeatures() , mIndexedTextureChannels(0) , disableTextureIndex(false) , hasAlphaMask(false) + , attachNothing(false) { } @@ -119,28 +120,31 @@ struct LLGLSLShaderCompareTimeElapsed }; //static -void LLGLSLShader::finishProfile() +void LLGLSLShader::finishProfile(bool emit_report) { sProfileEnabled = false; - std::vector<LLGLSLShader*> sorted; - - for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) + if (emit_report) { - sorted.push_back(*iter); - } + std::vector<LLGLSLShader*> sorted; - std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed()); + for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) + { + sorted.push_back(*iter); + } - for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter) - { - (*iter)->dumpStats(); - } + std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed()); + for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter) + { + (*iter)->dumpStats(); + } + LL_INFOS() << "-----------------------------------" << LL_ENDL; LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << LL_ENDL; LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << LL_ENDL; LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << LL_ENDL; + } } void LLGLSLShader::clearStats() @@ -175,7 +179,7 @@ void LLGLSLShader::dumpStats() } } LL_INFOS() << "=============================================" << LL_ENDL; - + F32 ms = mTimeElapsed/1000000.f; F32 seconds = ms/1000.f; @@ -221,6 +225,7 @@ void LLGLSLShader::placeProfileQuery() #if !LL_DARWIN if (mTimerQuery == 0) { + glGenQueriesARB(1, &mSamplesQuery); glGenQueriesARB(1, &mTimerQuery); } @@ -257,7 +262,7 @@ void LLGLSLShader::placeProfileQuery() } - glBeginQueryARB(GL_SAMPLES_PASSED, 1); + glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery); glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); #endif } @@ -272,7 +277,7 @@ void LLGLSLShader::readProfileQuery(U32 count, U32 mode) glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); U64 samples_passed = 0; - glGetQueryObjectui64v(1, GL_QUERY_RESULT, &samples_passed); + glGetQueryObjectui64v(mSamplesQuery, GL_QUERY_RESULT, &samples_passed); sTotalTimeElapsed += time_elapsed; mTimeElapsed += time_elapsed; @@ -307,14 +312,15 @@ LLGLSLShader::LLGLSLShader() mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE), - mTimerQuery(0) + mTimerQuery(0), + mSamplesQuery(0) + { } LLGLSLShader::~LLGLSLShader() { - } void LLGLSLShader::unload() @@ -349,6 +355,18 @@ void LLGLSLShader::unload() mProgramObject = 0; } + if (mTimerQuery) + { + glDeleteQueriesARB(1, &mTimerQuery); + mTimerQuery = 0; + } + + if (mSamplesQuery) + { + glDeleteQueriesARB(1, &mSamplesQuery); + mSamplesQuery = 0; + } + //hack to make apple not complain glGetError(); |