diff options
author | Oz Linden <oz@lindenlab.com> | 2013-03-22 18:08:49 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-03-22 18:08:49 -0400 |
commit | 1057caffaf24790be26376b2794059e7635dde7b (patch) | |
tree | 6f207f916bcf9430ffd0e863600dca642ec799c7 /indra/newview/llfeaturemanager.cpp | |
parent | 7632861fc40ffd05b6a1704f629a38250600c294 (diff) | |
parent | e15b7bafbb7168a721ffd286c1d1f4e6299abb44 (diff) |
merge changes for latest snowstorm project viewer
Diffstat (limited to 'indra/newview/llfeaturemanager.cpp')
-rw-r--r-- | indra/newview/llfeaturemanager.cpp | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 393f8b9d46..a4cadcd5dc 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -57,6 +57,7 @@ #include "lldxhardware.h" #endif +#define LL_EXPORT_GPU_TABLE 0 #if LL_DARWIN const char FEATURE_TABLE_FILENAME[] = "featuretable_mac.txt"; @@ -386,6 +387,13 @@ void LLFeatureManager::parseGPUTable(std::string filename) *i = tolower(*i); } +#if LL_EXPORT_GPU_TABLE + llofstream json; + json.open("gpu_table.json"); + + json << "var gpu_table = [" << std::endl; +#endif + bool gpuFound; U32 lineNumber; for (gpuFound = false, lineNumber = 0; !gpuFound && !file.eof(); lineNumber++) @@ -411,7 +419,7 @@ void LLFeatureManager::parseGPUTable(std::string filename) // setup the tokenizer std::string buf(buffer); - std::string cls, label, expr, supported; + std::string cls, label, expr, supported, stats_based, expected_gl_version; boost_tokenizer tokens(buf, boost::char_separator<char>("\t\n")); boost_tokenizer::iterator token_iter = tokens.begin(); @@ -432,13 +440,29 @@ void LLFeatureManager::parseGPUTable(std::string filename) { supported = *token_iter++; } + if (token_iter != tokens.end()) + { + stats_based = *token_iter++; + } + if (token_iter != tokens.end()) + { + expected_gl_version = *token_iter++; + } if (label.empty() || expr.empty() || cls.empty() || supported.empty()) { LL_WARNS("RenderInit") << "invald gpu_table.txt:" << lineNumber << ": '" << buffer << "'" << LL_ENDL; continue; } - +#if LL_EXPORT_GPU_TABLE + json << "{'label' : '" << label << "',\n" << + "'regexp' : '" << expr << "',\n" << + "'class' : '" << cls << "',\n" << + "'supported' : '" << supported << "',\n" << + "'stats_based' : " << stats_based << ",\n" << + "'gl_version' : " << expected_gl_version << "\n},\n"; +#endif + for (U32 i = 0; i < expr.length(); i++) /*Flawfinder: ignore*/ { expr[i] = tolower(expr[i]); @@ -449,12 +473,19 @@ void LLFeatureManager::parseGPUTable(std::string filename) if(boost::regex_search(renderer, re)) { // if we found it, stop! +#if !LL_EXPORT_GPU_TABLE gpuFound = true; +#endif mGPUString = label; mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10); mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10); + sscanf(expected_gl_version.c_str(), "%f", &mExpectedGLVersion); } } +#if LL_EXPORT_GPU_TABLE + json << "];\n\n"; + json.close(); +#endif file.close(); if ( gpuFound ) @@ -469,6 +500,10 @@ void LLFeatureManager::parseGPUTable(std::string filename) { LL_WARNS("RenderInit") << "GPU '" << rawRenderer << "' not recognized" << LL_ENDL; } + +#if LL_DARWIN // never go over "Mid" settings by default on OS X + mGPUClass = llmin(mGPUClass, GPU_CLASS_2); +#endif } // responder saves table into file @@ -585,7 +620,7 @@ void LLFeatureManager::applyRecommendedSettings() { // apply saved settings // cap the level at 2 (high) - S32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_2)); + S32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5)); llinfos << "Applying Recommended Features" << llendl; @@ -680,12 +715,21 @@ void LLFeatureManager::setGraphicsLevel(S32 level, bool skipFeatures) } break; case 1: - maskFeatures("Mid"); + maskFeatures("LowMid"); break; case 2: - maskFeatures("High"); + maskFeatures("Mid"); break; case 3: + maskFeatures("MidHigh"); + break; + case 4: + maskFeatures("High"); + break; + case 5: + maskFeatures("HighUltra"); + break; + case 6: maskFeatures("Ultra"); break; default: @@ -715,14 +759,16 @@ void LLFeatureManager::applyBaseMasks() mFeatures = maskp->getFeatures(); // mask class - if (mGPUClass >= 0 && mGPUClass < 4) + if (mGPUClass >= 0 && mGPUClass < 6) { const char* class_table[] = { "Class0", "Class1", "Class2", - "Class3" + "Class3", + "Class4", + "Class5", }; LL_INFOS("RenderInit") << "Setting GPU Class to " << class_table[mGPUClass] << LL_ENDL; |