summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-08-06 19:56:44 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-08-06 19:56:44 +0300
commite236da41e96ac88e8f8c6b1a6a4a9f3a25c923b8 (patch)
tree1648e8d392d3344c11690193476cc8aad6d21dfa
parent07f8c156fc85a6efee057660a5e4b63ad3528291 (diff)
MAINT-8197 Compliment benchmark crash processing with SEH handling
-rw-r--r--indra/newview/llfeaturemanager.cpp45
1 files changed, 43 insertions, 2 deletions
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 487496df9a..6cf93b547e 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -377,6 +377,43 @@ bool LLFeatureManager::parseFeatureTable(std::string filename)
F32 gpu_benchmark();
+#if LL_WINDOWS
+
+static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
+
+U32 exception_benchmark_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
+{
+ if (code == STATUS_MSC_EXCEPTION)
+ {
+ // C++ exception, go on
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+ else
+ {
+ // handle it
+ return EXCEPTION_EXECUTE_HANDLER;
+ }
+}
+
+F32 logExceptionBenchmark()
+{
+ // Todo: make a wrapper/class for SEH exceptions
+ F32 gbps = -1;
+ __try
+ {
+ gbps = gpu_benchmark();
+ }
+ __except (exception_benchmark_filter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ // convert to C++ styled exception
+ char integer_string[32];
+ sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
+ throw std::exception(integer_string);
+ }
+ return gbps;
+}
+#endif
+
bool LLFeatureManager::loadGPUClass()
{
if (!gSavedSettings.getBOOL("SkipBenchmark"))
@@ -385,7 +422,11 @@ bool LLFeatureManager::loadGPUClass()
F32 gbps;
try
{
+#if LL_WINDOWS
+ gbps = logExceptionBenchmark();
+#else
gbps = gpu_benchmark();
+#endif
}
catch (const std::exception& e)
{
@@ -400,11 +441,11 @@ bool LLFeatureManager::loadGPUClass()
LL_WARNS("RenderInit") << "Unable to get an accurate benchmark; defaulting to class 3" << LL_ENDL;
mGPUClass = GPU_CLASS_3;
#else
- if (gGLManager.mGLVersion < 2.f)
+ if (gGLManager.mGLVersion <= 2.f)
{
mGPUClass = GPU_CLASS_0;
}
- else if (gGLManager.mGLVersion < 3.f)
+ else if (gGLManager.mGLVersion <= 3.f)
{
mGPUClass = GPU_CLASS_1;
}