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/newview/llglsandbox.cpp | |
parent | cb2bd577099f87881d467249cac679200bb367f0 (diff) |
MAINT-3131 Use benchmark to determine GPU class instead of GPU table.
Diffstat (limited to 'indra/newview/llglsandbox.cpp')
-rwxr-xr-x | indra/newview/llglsandbox.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index c4c1827266..92553e875d 100755 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -878,13 +878,32 @@ void LLViewerObjectList::renderObjectBeacons() } -void gpu_benchmark() +F32 gpu_benchmark() { - if (!LLGLSLShader::sNoFixedFunction) - { //don't bother benchmarking the fixed function - return; + if (!gGLManager.mHasShaderObjects || !gGLManager.mHasTimerQuery) + { //don't bother benchmarking the fixed function or using CPU timers + return -1.f; } + + if (gBenchmarkProgram.mProgramObject == 0) + { + LLViewerShaderMgr::instance()->initAttribsAndUniforms(); + + gBenchmarkProgram.mName = "Benchmark Shader"; + gBenchmarkProgram.mFeatures.attachNothing = true; + gBenchmarkProgram.mShaderFiles.clear(); + gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER_ARB)); + gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER_ARB)); + gBenchmarkProgram.mShaderLevel = 1; + if (!gBenchmarkProgram.createShader(NULL, NULL)) + { + return -1.f; + } + } + + LLGLDisable blend(GL_BLEND); + //measure memory bandwidth by: // - allocating a batch of textures and render targets // - rendering those textures to those render targets @@ -981,7 +1000,7 @@ void gpu_benchmark() gBenchmarkProgram.unbind(); - LLGLSLShader::finishProfile(); + LLGLSLShader::finishProfile(false); LLImageGL::deleteTextures(count, source); @@ -1007,5 +1026,7 @@ void gpu_benchmark() { llinfos << "ARB_timer_query unavailable." << llendl; } + + return gbps; } |