Merge LL V3.7.22

Ansariel 2015-01-15 14:17:42 +01:00
commit 824bdebd79
6 changed files with 1028 additions and 1228 deletions

View File

@ -524,3 +524,4 @@ bcc2770e21c125e0bab59141c51db9145aec068d 3.7.17-release
82973b38a6c9a457333e3519e4f2b16bb5eedf47 3.7.19-release
27094824773b907c2e559396e6f9ec3a963de52d 3.7.20-release
9ecab4b0c7d8614767724a3422d3c1dca6bd4e4f 3.7.21-release
bc61801f614022c920cb5c3df1d7d67a9561ce1f 3.7.22-release

File diff suppressed because it is too large Load Diff

View File

@ -845,9 +845,11 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
// <FS:ND/> Fast timers can have measurable impact in frequent places. A better all around solution would be to disable all fast timers until the fast timer view is open. But we're not there yet.
//LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
stop_glerror();
LLGLSLShader::startProfile();
LLGLSLShader::startProfile();
stop_glerror();
glDrawArrays(sGLMode[mode], first, count);
LLGLSLShader::stopProfile(count, mode);
stop_glerror();
LLGLSLShader::stopProfile(count, mode);
}
stop_glerror();

View File

@ -81,9 +81,6 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable%s.txt";
const char FEATURE_TABLE_VER_FILENAME[] = "featuretable%s.%s.txt";
#endif
const char GPU_TABLE_FILENAME[] = "gpu_table.txt";
const char GPU_TABLE_VER_FILENAME[] = "gpu_table.%s.txt";
LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level)
: mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level)
{
@ -433,6 +430,7 @@ bool LLFeatureManager::loadGPUClass()
{ //couldn't bench, use GLVersion
#if LL_DARWIN
//GLVersion is misleading on OSX, just default to class 3 if we can't bench
LL_WARNS() << "Unable to get an accurate benchmark; defaulting to class 3" << LL_ENDL;
mGPUClass = GPU_CLASS_3;
#else
if (gGLManager.mGLVersion < 2.f)
@ -457,23 +455,31 @@ bool LLFeatureManager::loadGPUClass()
}
#endif
}
else if (gbps < 5.f)
else if (gGLManager.mGLVersion <= 2.f)
{
mGPUClass = GPU_CLASS_0;
}
else if (gbps < 10.f)
else if (gGLManager.mGLVersion <= 3.f)
{
mGPUClass = GPU_CLASS_1;
}
else if (gbps < 20.f)
else if (gbps <= 5.f)
{
mGPUClass = GPU_CLASS_0;
}
else if (gbps <= 8.f)
{
mGPUClass = GPU_CLASS_1;
}
else if (gbps <= 16.f)
{
mGPUClass = GPU_CLASS_2;
}
else if (gbps < 40.f)
else if (gbps <= 40.f)
{
mGPUClass = GPU_CLASS_3;
}
else if (gbps < 80.f)
else if (gbps <= 80.f)
{
mGPUClass = GPU_CLASS_4;
}
@ -481,195 +487,15 @@ bool LLFeatureManager::loadGPUClass()
{
mGPUClass = GPU_CLASS_5;
}
// defaults
mGPUString = gGLManager.getRawGLString();
mGPUSupported = TRUE;
#if 0
// first table is in the app dir
std::string app_path = gDirUtilp->getAppRODataDir();
app_path += gDirUtilp->getDirDelimiter();
app_path += GPU_TABLE_FILENAME;
// second table is downloaded with HTTP
std::string http_filename = llformat(GPU_TABLE_VER_FILENAME, LLVersionInfo::getShortVersion().c_str()); // <FS:Techwolf Lupindo> use getShortVersion instead of getVersion.
std::string http_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, http_filename);
// use HTTP table if it exists
std::string path;
bool parse_ok = false;
if (gDirUtilp->fileExists(http_path))
{
parse_ok = parseGPUTable(http_path);
if (!parse_ok)
{
// the HTTP table failed to parse, so delete it
LLFile::remove(http_path);
LL_WARNS("RenderInit") << "Removed invalid gpu table '" << http_path << "'" << LL_ENDL;
}
}
if (!parse_ok)
{
parse_ok = parseGPUTable(app_path);
}
#endif
return true; // indicates that the file parsed correctly, not that the gpu was recognized
return true; // indicates that a gpu value was established
}
bool LLFeatureManager::parseGPUTable(std::string filename)
{
llifstream file;
LL_INFOS("RenderInit") << "Attempting to parse GPU table from " << filename << LL_ENDL;
file.open(filename);
if (file)
{
const char recognizer[] = "//GPU_TABLE";
char first_line[MAX_STRING];
file.getline(first_line, MAX_STRING);
if (0 != strncmp(first_line, recognizer, strlen(recognizer)))
{
LL_WARNS("RenderInit") << "Invalid GPU table: " << filename << "!" << LL_ENDL;
return false;
}
}
else
{
LL_WARNS("RenderInit") << "Unable to open GPU table: " << filename << "!" << LL_ENDL;
return false;
}
std::string rawRenderer = gGLManager.getRawGLString();
std::string renderer = rawRenderer;
for (std::string::iterator i = renderer.begin(); i != renderer.end(); ++i)
{
*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++)
{
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
buffer[0] = 0;
file.getline(buffer, MAX_STRING);
if (strlen(buffer) >= 2 && /*Flawfinder: ignore*/
buffer[0] == '/' &&
buffer[1] == '/')
{
// This is a comment.
continue;
}
if (strlen(buffer) == 0) /*Flawfinder: ignore*/
{
// This is a blank line
continue;
}
// setup the tokenizer
std::string buf(buffer);
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();
// grab the label, pseudo regular expression, and class
if(token_iter != tokens.end())
{
label = *token_iter++;
}
if(token_iter != tokens.end())
{
expr = *token_iter++;
}
if(token_iter != tokens.end())
{
cls = *token_iter++;
}
if(token_iter != tokens.end())
{
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]);
}
// run the regular expression against the renderer
boost::regex re(expr.c_str());
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 )
{
LL_INFOS("RenderInit") << "GPU '" << rawRenderer << "' recognized as '" << mGPUString << "'" << LL_ENDL;
if (!mGPUSupported)
{
LL_INFOS("RenderInit") << "GPU '" << mGPUString << "' is not supported." << LL_ENDL;
}
}
else
{
LL_WARNS("RenderInit") << "GPU '" << rawRenderer << "' not recognized" << LL_ENDL;
}
//FS:TM based on team vote, don't allow defaulting above High (level 4). Used this here to reduce merge issues with gpu_table.xml
//#if LL_DARWIN // never go over "Mid" settings by default on OS X (FS:TM was GPU_CLASS_2)
mGPUClass = llmin(mGPUClass, GPU_CLASS_4);
//#endif
return true;
}
// responder saves table into file
class LLHTTPFeatureTableResponder : public LLHTTPClient::Responder
{
@ -787,37 +613,11 @@ void fetch_feature_table(std::string table)
// </FS:Techwolf Lupindo>
}
void fetch_gpu_table(std::string table)
{
const std::string base = gSavedSettings.getString("FeatureManagerHTTPTable");
const std::string filename = llformat(table.c_str(), LLVersionInfo::getShortVersion().c_str()); // <FS:Techwolf Lupindo> use getShortVersion instead of getVersion.
const std::string url = base + "/" + filename;
const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL;
// <FS:Techwolf Lupindo> downloadable gpu table support
LLSD headers;
headers.insert("User-Agent", LLVersionInfo::getBuildPlatform() + " " + LLVersionInfo::getVersion());
time_t last_modified = 0;
llstat stat_data;
if(!LLFile::stat(path, &stat_data))
{
last_modified = stat_data.st_mtime;
}
//LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path));
LLHTTPClient::getIfModified(url, new LLHTTPFeatureTableResponder(path), last_modified, headers);
// </FS:Techwolf Lupindo>
}
// fetch table(s) from a website (S3)
void LLFeatureManager::fetchHTTPTables()
{
fetch_feature_table(FEATURE_TABLE_VER_FILENAME);
fetch_gpu_table(GPU_TABLE_VER_FILENAME);
}

View File

@ -162,9 +162,6 @@ protected:
bool parseFeatureTable(std::string filename);
///< @returns TRUE is file parsed correctly, FALSE if not
bool parseGPUTable(std::string filename);
///< @returns true if file parsed correctly, false if not - does not reflect whether or not the gpu was recognized
void initBaseMask();

View File

@ -945,13 +945,14 @@ void LLViewerObjectList::renderObjectBeacons()
F32 gpu_benchmark()
{
if (!gGLManager.mHasShaderObjects)
{ //don't bother benchmarking the fixed function
if (!gGLManager.mHasShaderObjects || !gGLManager.mHasTimerQuery)
{ // don't bother benchmarking the fixed function
// or venerable drivers which don't support accurate timing anyway
// and are likely to be correctly identified by the GPU table already.
return -1.f;
}
if (gBenchmarkProgram.mProgramObject == 0)
if (gBenchmarkProgram.mProgramObject == 0)
{
LLViewerShaderMgr::instance()->initAttribsAndUniforms();
@ -984,7 +985,10 @@ F32 gpu_benchmark()
//number of samples to take
const S32 samples = 64;
LLGLSLShader::initProfile();
if (gGLManager.mHasTimerQuery)
{
LLGLSLShader::initProfile();
}
LLRenderTarget dest[count];
U32 source[count];
@ -1028,16 +1032,16 @@ F32 gpu_benchmark()
v[0].set(-1,1,0);
v[1].set(-1,-3,0);
v[2].set(3,1,0);
buff->flush();
gBenchmarkProgram.bind();
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
//wait for any previoius GL commands to finish
glFinish();
bool busted_finish = false;
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
glFinish();
for (S32 c = -1; c < samples; ++c)
{
LLTimer timer;
@ -1077,6 +1081,7 @@ F32 gpu_benchmark()
if (!gGLManager.mHasTimerQuery && !busted_finish && gbps > 128.f)
{ //unrealistically high bandwidth for a card without timer queries, glFinish is probably ignored
busted_finish = true;
LL_WARNS() << "GPU Benchmark detected GL driver with broken glFinish implementation." << LL_ENDL;
}
else
{
@ -1087,10 +1092,12 @@ F32 gpu_benchmark()
gBenchmarkProgram.unbind();
LLGLSLShader::finishProfile(false);
LLImageGL::deleteTextures(count, source);
if (gGLManager.mHasTimerQuery)
{
LLGLSLShader::finishProfile(false);
}
LLImageGL::deleteTextures(count, source);
std::sort(results.begin(), results.end());
@ -1101,27 +1108,20 @@ F32 gpu_benchmark()
#if LL_DARWIN
if (gbps > 512.f)
{
LL_INFOS() << "Memory bandwidth is improbably high and likely incorrect." << LL_ENDL;
LL_WARNS() << "Memory bandwidth is improbably high and likely incorrect; discarding result." << LL_ENDL;
//OSX is probably lying, discard result
gbps = -1.f;
}
#endif
if (gGLManager.mHasTimerQuery)
{
F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
F32 seconds = ms/1000.f;
F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
F32 seconds = ms/1000.f;
F64 samples_drawn = res*res*count*samples;
F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
gbps = samples_sec*8;
F64 samples_drawn = res*res*count*samples;
F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
gbps = samples_sec*8;
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
}
else
{
LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL;
}
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
return gbps;
}