diff options
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.h | 4 | ||||
-rw-r--r-- | indra/llwindow/llwindow.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 143 | ||||
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 4 |
5 files changed, 88 insertions, 69 deletions
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 60159a0497..410efe9a70 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -50,6 +50,7 @@ void check_framebuffer_status() } } +bool LLRenderTarget::sInitFailed = false; bool LLRenderTarget::sUseFBO = false; U32 LLRenderTarget::sCurFBO = 0; @@ -352,6 +353,9 @@ void LLRenderTarget::release() LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; llassert(!isBoundInStack()); + if (sInitFailed) + return; + if (mDepth) { LLImageGL::deleteTextures(1, &mDepth); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index a1adf93fa1..fc78f059e0 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -61,7 +61,9 @@ class LLRenderTarget { public: - //whether or not to use FBO implementation + // Whether app initialization failed + static bool sInitFailed; + // Whether or not to use FBO implementation static bool sUseFBO; static U32 sBytesAllocated; static U32 sCurFBO; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 56c393be0f..378e633cd2 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -71,8 +71,8 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) } S32 result = 0; -#if LL_MESA_HEADLESS // !!! *FIX: (?) LL_WARNS() << "OSMessageBox: " << text << LL_ENDL; +#if LL_MESA_HEADLESS // !!! *FIX: (?) return OSBTN_OK; #elif LL_WINDOWS result = OSMessageBoxWin32(text, caption, type); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ac689f7319..968e863496 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -340,24 +340,24 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME; S32 gPendingMetricsUploads = 0; -bool gDisconnected = false; +bool gDisconnected = false; -// used to restore texture state after a mode switch -LLFrameTimer gRestoreGLTimer; -bool gRestoreGL = false; -bool gUseWireframe = false; +// Used to restore texture state after a mode switch +LLFrameTimer gRestoreGLTimer; +bool gRestoreGL = false; +bool gUseWireframe = false; LLMemoryInfo gSysMemory; U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp std::string gLastVersionChannel; -LLVector3 gWindVec(3.0, 3.0, 0.0); -LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); +LLVector3 gWindVec(3.0, 3.0, 0.0); +LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); -U32 gPacketsIn = 0; +U32 gPacketsIn = 0; -bool gPrintMessagesThisFrame = false; +bool gPrintMessagesThisFrame = false; bool gRandomizeFramerate = false; bool gPeriodicSlowFrame = false; @@ -723,6 +723,19 @@ public: bool LLAppViewer::init() { + struct ResultHandler + { + bool success = false; // Should be set in case of successful result + ~ResultHandler() + { + if (!success) + { + // Mark critical flags in case of unsuccessful initialization + LLRenderTarget::sInitFailed = true; + } + } + } result_handler; + setupErrorHandling(mSecondInstance); // @@ -752,7 +765,10 @@ bool LLAppViewer::init() // inits from settings.xml and from strings.xml if (!initConfiguration()) + { + LL_WARNS("InitInfo") << "initConfiguration() failed." << LL_ENDL; return false; + } LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; @@ -760,7 +776,6 @@ bool LLAppViewer::init() initMaxHeapSize() ; LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize")); - // Although initLoggingAndGetLastDuration() is the right place to mess with // setFatalFunction(), we can't query gSavedSettings until after // initConfiguration(). @@ -783,14 +798,12 @@ bool LLAppViewer::init() LLMachineID::init(); + if (gSavedSettings.getBOOL("QAModeMetrics")) { - if (gSavedSettings.getBOOL("QAModeMetrics")) - { - app_metrics_qa_mode = true; - app_metrics_interval = METRICS_INTERVAL_QA; - } - LLViewerAssetStatsFF::init(); + app_metrics_qa_mode = true; + app_metrics_interval = METRICS_INTERVAL_QA; } + LLViewerAssetStatsFF::init(); initThreads(); LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; @@ -906,8 +919,9 @@ bool LLAppViewer::init() // do any necessary set-up for accepting incoming SLURLs from apps initSLURLHandler(); - if(false == initHardwareTest()) + if (!initHardwareTest()) { + LL_WARNS("InitInfo") << "initHardwareTest() failed." << LL_ENDL; // Early out from user choice. return false; } @@ -927,7 +941,7 @@ bool LLAppViewer::init() std::ostringstream msg; msg << LLTrans::getString("MBUnableToAccessFile"); OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); - return 0; + return false; } LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ; @@ -958,8 +972,9 @@ bool LLAppViewer::init() // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements) { + LL_WARNS("InitInfo") << "gGLManager.mHasRequirements is false." << LL_ENDL; // already handled with a MBVideoDrvErr - return 0; + return false; } // Without SSE2 support we will crash almost immediately, warn here. @@ -971,11 +986,11 @@ bool LLAppViewer::init() LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"), LLStringUtil::null, OSMB_OK); - return 0; + return false; } // alert the user if they are using unsupported hardware - if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) + if (!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) { bool unsupported = false; LLSD args; @@ -991,19 +1006,19 @@ bool LLAppViewer::init() U64Bytes minRAM; minRAMString >> minRAM; - if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) + if (!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedGPU"); minSpecs += "\n"; unsupported = true; } - if(gSysCPU.getMHz() < minCPU) + if (gSysCPU.getMHz() < minCPU) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU"); minSpecs += "\n"; unsupported = true; } - if(gSysMemory.getPhysicalMemoryKB() < minRAM) + if (gSysMemory.getPhysicalMemoryKB() < minRAM) { minSpecs += LLNotifications::instance().getGlobalString("UnsupportedRAM"); minSpecs += "\n"; @@ -1015,15 +1030,14 @@ bool LLAppViewer::init() LLNotificationsUtil::add("UnknownGPU"); } - if(unsupported) + if (unsupported) { - if(!gSavedSettings.controlExists("WarnUnsupportedHardware") + if (!gSavedSettings.controlExists("WarnUnsupportedHardware") || gSavedSettings.getBOOL("WarnUnsupportedHardware")) { args["MINSPECS"] = minSpecs; LLNotificationsUtil::add("UnsupportedHardware", args ); } - } } @@ -1115,12 +1129,13 @@ bool LLAppViewer::init() LLViewerJoystick::getInstance()->init(false); } - try { + try + { initializeSecHandler(); } catch (LLProtectedDataException&) { - LLNotificationsUtil::add("CorruptedProtectedDataStore"); + LLNotificationsUtil::add("CorruptedProtectedDataStore"); } gGLActive = false; @@ -1227,7 +1242,7 @@ bool LLAppViewer::init() //datetime formatting functions didn't support some parameters such as "weekday". //Names for days and months localized in xml are also useful for Polish locale(STORM-107). std::string language = gSavedSettings.getString("Language"); - if(language == "ja" || language == "pl") + if (language == "ja" || language == "pl") { LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames")); LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames")); @@ -1284,6 +1299,8 @@ bool LLAppViewer::init() } #endif + result_handler.success = true; + return true; } @@ -2513,7 +2530,7 @@ bool tempSetControl(const std::string& name, const std::string& value) bool LLAppViewer::initConfiguration() { - //Load settings files list + // Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); LLXMLNodePtr root; bool success = LLXMLNode::parseFile(settings_file_list, root, NULL); @@ -2560,7 +2577,7 @@ bool LLAppViewer::initConfiguration() // - load defaults bool set_defaults = true; - if(!loadSettingsFromDirectory("Default", set_defaults)) + if (!loadSettingsFromDirectory("Default", set_defaults)) { OSMessageBox( "Unable to load default settings file. The installation may be corrupted.", @@ -2577,13 +2594,12 @@ bool LLAppViewer::initConfiguration() #ifndef LL_RELEASE_FOR_DOWNLOAD // provide developer build only overrides for these control variables that are not // persisted to settings.xml - LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers"); - if (c) + if (LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers")) { c->setValue(true, false); } - gSavedSettings.setBOOL("QAMode", true ); + gSavedSettings.setBOOL("QAMode", true); gSavedSettings.setS32("WatchdogEnabled", 0); #endif @@ -2616,7 +2632,7 @@ bool LLAppViewer::initConfiguration() clp.configure(cmd_line_config, &gSavedSettings); - if(!initParseCommandLine(clp)) + if (!initParseCommandLine(clp)) { handleCommandLineError(clp); return false; @@ -2626,7 +2642,7 @@ bool LLAppViewer::initConfiguration() // If the user has specified a alternate settings file name. // Load it now before loading the user_settings/settings.xml - if(clp.hasOption("settings")) + if (clp.hasOption("settings")) { std::string user_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, @@ -2668,7 +2684,7 @@ bool LLAppViewer::initConfiguration() loadSettingsFromDirectory("UserSession"); // - apply command line settings - if (! clp.notify()) + if (!clp.notify()) { handleCommandLineError(clp); return false; @@ -2677,7 +2693,7 @@ bool LLAppViewer::initConfiguration() // Register the core crash option as soon as we can // if we want gdb post-mortem on cores we need to be up and running // ASAP or we might miss init issue etc. - if(gSavedSettings.getBOOL("DisableCrashLogger")) + if (gSavedSettings.getBOOL("DisableCrashLogger")) { LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL; disableCrashlogger(); @@ -2691,7 +2707,7 @@ bool LLAppViewer::initConfiguration() initConsole(); } - if(clp.hasOption("help")) + if (clp.hasOption("help")) { std::ostringstream msg; msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp; @@ -2705,17 +2721,17 @@ bool LLAppViewer::initConfiguration() return false; } - if(clp.hasOption("set")) + if (clp.hasOption("set")) { const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); - if(0x1 & set_values.size()) + if (0x1 & set_values.size()) { LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL; } else { LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin(); - for(; itr != set_values.end(); ++itr) + for (; itr != set_values.end(); ++itr) { const std::string& name = *itr; const std::string& value = *(++itr); @@ -2727,12 +2743,13 @@ bool LLAppViewer::initConfiguration() } } - if (clp.hasOption("logevents")) { + if (clp.hasOption("logevents")) + { LLViewerEventRecorder::instance().setEventLoggingOn(); } std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel")); - if(! CmdLineChannel.empty()) + if (!CmdLineChannel.empty()) { LLVersionInfo::instance().resetChannel(CmdLineChannel); } @@ -2747,7 +2764,7 @@ bool LLAppViewer::initConfiguration() } std::string test_name(gSavedSettings.getString("LogMetrics")); - if (! test_name.empty()) + if (!test_name.empty()) { LLTrace::BlockTimer::sMetricLog = true; // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test @@ -2789,7 +2806,7 @@ bool LLAppViewer::initConfiguration() } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); - if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) + if (skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) { // Examining "Language" may not suffice -- see LLUI::getLanguage() // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much @@ -2823,7 +2840,6 @@ bool LLAppViewer::initConfiguration() llassert_always(!gSavedSettings.getBOOL("SLURLPassToOtherInstance")); } - // Handle slurl use. NOTE: Don't let SL-55321 reappear. // This initial-SLURL logic, up through the call to // sendURLToOtherInstance(), must precede LLSplashScreen::show() -- @@ -2849,21 +2865,21 @@ bool LLAppViewer::initConfiguration() std::string starting_location; std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation")); - if(! cmd_line_login_location.empty()) + if (!cmd_line_login_location.empty()) { starting_location = cmd_line_login_location; } else { std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation")); - if (! default_login_location.empty()) + if (!default_login_location.empty()) { starting_location = default_login_location; } } LLSLURL start_slurl; - if (! starting_location.empty()) + if (!starting_location.empty()) { start_slurl = starting_location; LLStartUp::setStartSLURL(start_slurl); @@ -2875,12 +2891,12 @@ bool LLAppViewer::initConfiguration() // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL() std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); - if ( !nextLoginLocation.empty() ) + if (!nextLoginLocation.empty()) { LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL; LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation)); } - else if ( ( clp.hasOption("login") || clp.hasOption("autologin")) + else if ((clp.hasOption("login") || clp.hasOption("autologin")) && gSavedSettings.getString("CmdLineLoginLocation").empty()) { // If automatic login from command line with --login switch @@ -2936,7 +2952,7 @@ bool LLAppViewer::initConfiguration() #endif if (!gArgs.empty()) { - gWindowTitle += std::string(" ") + gArgs; + gWindowTitle += std::string(" ") + gArgs; } LLStringUtil::truncate(gWindowTitle, 255); @@ -2960,7 +2976,7 @@ bool LLAppViewer::initConfiguration() // but make sure the setting is *not* persisted. // Also see LLVivoxVoiceClient::voiceEnabled() LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat"); - if(enable_voice) + if (enable_voice) { const bool DO_NOT_PERSIST = false; enable_voice->setValue(LLSD(false), DO_NOT_PERSIST); @@ -3164,8 +3180,8 @@ bool LLAppViewer::initWindow() gSavedSettings.setBOOL("RenderInitError", false); gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), true ); - //If we have a startup crash, it's usually near GL initialization, so simulate that. - if(gCrashOnStartup) + // If we have a startup crash, it's usually near GL initialization, so simulate that. + if (gCrashOnStartup) { LLAppViewer::instance()->forceErrorLLError(); } @@ -3990,11 +4006,11 @@ void LLAppViewer::requestQuit() LLViewerRegion* region = gAgent.getRegion(); - if( (LLStartUp::getStartupState() < STATE_STARTED) || !region ) + if ((LLStartUp::getStartupState() < STATE_STARTED) || !region) { // If we have a region, make some attempt to send a logout request first. // This prevents the halfway-logged-in avatar from hanging around inworld for a couple minutes. - if(region) + if (region) { sendLogoutRequest(); } @@ -5043,9 +5059,6 @@ void LLAppViewer::idleShutdown() return; } - - - // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() // *TODO: ugly static bool saved_teleport_history = false; @@ -5094,7 +5107,7 @@ void LLAppViewer::idleShutdown() } // All floaters are closed. Tell server we want to quit. - if( !logoutRequestSent() ) + if (!logoutRequestSent()) { sendLogoutRequest(); @@ -5106,8 +5119,8 @@ void LLAppViewer::idleShutdown() } // Make sure that we quit if we haven't received a reply from the server. - if( logoutRequestSent() - && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime ) + if (logoutRequestSent() + && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime) { forceQuit(); return; diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 3cdae041fc..83fa4a3ca9 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -240,7 +240,7 @@ bool create_app_mutex() LPCWSTR unique_mutex_name = L"SecondLifeAppMutex"; HANDLE hMutex; hMutex = CreateMutex(NULL, TRUE, unique_mutex_name); - if(GetLastError() == ERROR_ALREADY_EXISTS) + if (GetLastError() == ERROR_ALREADY_EXISTS) { result = false; } @@ -464,7 +464,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, gDebugInfo["FoundOtherInstanceAtStartup"] = LLSD::Boolean(found_other_instance); bool ok = viewer_app_ptr->init(); - if(!ok) + if (!ok) { LL_WARNS() << "Application init failed." << LL_ENDL; return -1; |