diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfeaturemanager.cpp | 63 | ||||
-rwxr-xr-x | indra/newview/llglsandbox.cpp | 31 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 2 |
3 files changed, 86 insertions, 10 deletions
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index ba6f26d3ef..938ea707f9 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -417,13 +417,67 @@ bool LLFeatureManager::parseFeatureTable(std::string filename) return parse_ok; } +F32 gpu_benchmark(); + bool LLFeatureManager::loadGPUClass() { + //get memory bandwidth from benchmark + F32 gbps = gpu_benchmark(); + + if (gbps < -1.f) + { //couldn't bench, use GLVersion + + if (gGLManager.mGLVersion < 2.f) + { + mGPUClass = GPU_CLASS_0; + } + else if (gGLManager.mGLVersion < 3.f) + { + mGPUClass = GPU_CLASS_1; + } + else if (gGLManager.mGLVersion < 3.3f) + { + mGPUClass = GPU_CLASS_2; + } + else if (gGLManager.mGLVersion < 4.f) + { + mGPUClass = GPU_CLASS_3; + } + else + { + mGPUClass = GPU_CLASS_4; + } + } + else if (gbps < 5.f) + { + mGPUClass = GPU_CLASS_0; + } + else if (gbps < 10.f) + { + mGPUClass = GPU_CLASS_1; + } + else if (gbps < 20.f) + { + mGPUClass = GPU_CLASS_2; + } + else if (gbps < 40.f) + { + mGPUClass = GPU_CLASS_3; + } + else if (gbps < 80.f) + { + mGPUClass = GPU_CLASS_4; + } + else + { + mGPUClass = GPU_CLASS_5; + } + // defaults - mGPUClass = GPU_CLASS_UNKNOWN; mGPUString = gGLManager.getRawGLString(); - mGPUSupported = FALSE; + mGPUSupported = TRUE; +#if 0 // first table is in the app dir std::string app_path = gDirUtilp->getAppRODataDir(); app_path += gDirUtilp->getDirDelimiter(); @@ -451,8 +505,8 @@ bool LLFeatureManager::loadGPUClass() { parse_ok = parseGPUTable(app_path); } - - return parse_ok; // indicates that the file parsed correctly, not that the gpu was recognized +#endif + return true; // indicates that the file parsed correctly, not that the gpu was recognized } @@ -719,6 +773,7 @@ void LLFeatureManager::init() void LLFeatureManager::applyRecommendedSettings() { + loadGPUClass(); // apply saved settings // cap the level at 2 (high) U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5)); 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; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c7c8da27f3..d5acec7c9a 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7197,7 +7197,7 @@ class LLAdvancedClickRenderProfile: public view_listener_t } }; -void gpu_benchmark(); +F32 gpu_benchmark(); class LLAdvancedClickRenderBenchmark: public view_listener_t { |