diff options
author | Dave Parks <davep@lindenlab.com> | 2014-03-19 17:57:00 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2014-03-19 17:57:00 -0500 |
commit | 24f8745914f7cec320d707f36895ac393575b861 (patch) | |
tree | 463c9838c4415feb0f0d5311df75aaff7d847a9e /indra/llrender | |
parent | cb2bd577099f87881d467249cac679200bb367f0 (diff) |
MAINT-3131 Use benchmark to determine GPU class instead of GPU table.
Diffstat (limited to 'indra/llrender')
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 58 | ||||
-rwxr-xr-x | indra/llrender/llglslshader.h | 4 | ||||
-rwxr-xr-x | indra/llrender/llrendertarget.cpp | 1 | ||||
-rwxr-xr-x | indra/llrender/llshadermgr.cpp | 6 |
4 files changed, 47 insertions, 22 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 1c50a51d02..b99435f39e 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()); - llinfos << "-----------------------------------" << llendl; - llinfos << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << llendl; - llinfos << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << llendl; - llinfos << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << llendl; + for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter) + { + (*iter)->dumpStats(); + } + + llinfos << "-----------------------------------" << llendl; + llinfos << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << llendl; + llinfos << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << llendl; + llinfos << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << llendl; + } } void LLGLSLShader::clearStats() @@ -175,7 +179,7 @@ void LLGLSLShader::dumpStats() } } llinfos << "=============================================" << llendl; - + 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(); diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 7b2f5f04c2..5abddf274b 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -51,6 +51,7 @@ public: S32 mIndexedTextureChannels; bool disableTextureIndex; bool hasAlphaMask; + bool attachNothing; // char numLights; @@ -80,7 +81,7 @@ public: static bool sNoFixedFunction; static void initProfile(); - static void finishProfile(); + static void finishProfile(bool emit_report = true); static void startProfile(); static void stopProfile(U32 count, U32 mode); @@ -184,6 +185,7 @@ public: //statistcis for profiling shader performance U32 mTimerQuery; + U32 mSamplesQuery; U64 mTimeElapsed; static U64 sTotalTimeElapsed; U32 mTrianglesDrawn; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index fe8110904d..33ef831cb4 100755 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -388,6 +388,7 @@ void LLRenderTarget::release() // if (mFBO && (mTex.size() > 1)) { + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); S32 z; for (z = mTex.size() - 1; z >= 1; z--) { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 6e04fc82df..b81ae9af09 100755 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -73,7 +73,11 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { llassert_always(shader != NULL); LLShaderFeatures *features = & shader->mFeatures; - + + if (features->attachNothing) + { + return TRUE; + } ////////////////////////////////////// // Attach Vertex Shader Features First ////////////////////////////////////// |