summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewerwin32.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-06-21 08:04:56 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-06-21 08:04:56 +0000
commit9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 (patch)
tree4a505c1e0919af52800b3ffb3eaf135e7d6f9ce6 /indra/newview/llappviewerwin32.cpp
parent351ebe9fcb76f3b99c2957004bb8493a904869ee (diff)
merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3
ignore-dead-branch
Diffstat (limited to 'indra/newview/llappviewerwin32.cpp')
-rw-r--r--indra/newview/llappviewerwin32.cpp63
1 files changed, 45 insertions, 18 deletions
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 16928923bf..98d7ab712b 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -64,6 +64,7 @@
#include "llfindlocale.h"
#include "llcommandlineparser.h"
+#include "lltrans.h"
// *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib
// The lib was compiled under VS2005 - in VS2003 we need to remap assert
@@ -84,7 +85,7 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti
{
// *NOTE:Mani - this code is stolen from LLApp, where its never actually used.
//OSMessageBox("Attach Debugger Now", "Error", OSMB_OK);
- // Translate the signals/exceptions into cross-platform stuff
+ // *TODO: Translate the signals/exceptions into cross-platform stuff
// Windows implementation
_tprintf( _T("Entering Windows Exception Handler...\n") );
llinfos << "Entering Windows Exception Handler..." << llendl;
@@ -159,9 +160,31 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
int nCmdShow)
{
LLMemType mt1(LLMemType::MTYPE_STARTUP);
+
+ const S32 MAX_HEAPS = 255;
+ DWORD heap_enable_lfh_error[MAX_HEAPS];
+ S32 num_heaps = 0;
#if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit
+#elif 1
+ // Experimental - enable the low fragmentation heap
+ // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations)
+ // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1
+
+ _CrtSetDbgFlag(0); // default, just making explicit
+
+ ULONG ulEnableLFH = 2;
+ HANDLE* hHeaps = new HANDLE[MAX_HEAPS];
+ num_heaps = GetProcessHeaps(MAX_HEAPS, hHeaps);
+ for(S32 i = 0; i < num_heaps; i++)
+ {
+ bool success = HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH));
+ if (success)
+ heap_enable_lfh_error[i] = 0;
+ else
+ heap_enable_lfh_error[i] = GetLastError();
+ }
#endif
// *FIX: global
@@ -183,8 +206,21 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
llwarns << "Application init failed." << llendl;
return -1;
}
-
- // Run the application main loop
+
+ // Have to wait until after logging is initialized to display LFH info
+ if (num_heaps > 0)
+ {
+ llinfos << "Attempted to enable LFH for " << num_heaps << " heaps." << llendl;
+ for(S32 i = 0; i < num_heaps; i++)
+ {
+ if (heap_enable_lfh_error[i])
+ {
+ llinfos << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl;
+ }
+ }
+ }
+
+ // Run the application main loop
if(!LLApp::isQuitting())
{
viewer_app_ptr->mainLoop();
@@ -409,33 +445,24 @@ bool LLAppViewerWin32::initHardwareTest()
// but vram.
vram_only = TRUE;
- LLSplashScreen::update("Detecting hardware...");
+ LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware"));
LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
gDXHardware.setWriteDebugFunc(write_debug_dx);
BOOL probe_ok = gDXHardware.getInfo(vram_only);
if (!probe_ok
- && gSavedSettings.getWarning("AboutDirectX9"))
+ && gWarningSettings.getBOOL("AboutDirectX9"))
{
LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL;
// Warn them that runnin without DirectX 9 will
// not allow us to tell them about driver issues
std::ostringstream msg;
- msg <<
- LLAppViewer::instance()->getSecondLifeTitle() << " is unable to detect DirectX 9.0b or greater.\n"
- "\n" <<
- LLAppViewer::instance()->getSecondLifeTitle() << " uses DirectX to detect hardware and/or\n"
- "outdated drivers that can cause stability problems,\n"
- "poor performance and crashes. While you can run\n" <<
- LLAppViewer::instance()->getSecondLifeTitle() << " without it, we highly recommend running\n"
- "with DirectX 9.0b\n"
- "\n"
- "Do you wish to continue?\n";
+ msg << LLTrans::getString ("MBNoDirectX");
S32 button = OSMessageBox(
msg.str(),
- "Warning",
+ LLTrans::getString("MBWarning"),
OSMB_YESNO);
if (OSBTN_NO== button)
{
@@ -443,7 +470,7 @@ bool LLAppViewerWin32::initHardwareTest()
LLWeb::loadURLExternal(DIRECTX_9_URL);
return false;
}
- gSavedSettings.setWarning("AboutDirectX9", FALSE);
+ gWarningSettings.setBOOL("AboutDirectX9", FALSE);
}
LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL;
@@ -452,7 +479,7 @@ bool LLAppViewerWin32::initHardwareTest()
// Disable so debugger can work
std::ostringstream splash_msg;
- splash_msg << "Loading " << LLAppViewer::instance()->getSecondLifeTitle() << "...";
+ splash_msg << LLTrans::getString("StartupLoading") << " " << LLAppViewer::instance()->getSecondLifeTitle() << "...";
LLSplashScreen::update(splash_msg.str());
}