From 7a739f491504552df92b1a9060329688a6bdb6de Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 29 Jul 2011 17:24:39 +0200 Subject: [PATCH 01/10] Minor documentation fixes. --- indra/newview/statemachine/aievent.cpp | 2 +- indra/newview/statemachine/aievent.h | 2 +- indra/newview/statemachine/aifetchinventoryfolder.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/statemachine/aievent.cpp b/indra/newview/statemachine/aievent.cpp index 0e7e9fa6e..ec2901932 100644 --- a/indra/newview/statemachine/aievent.cpp +++ b/indra/newview/statemachine/aievent.cpp @@ -40,7 +40,7 @@ struct AIRSData { AIRSData(bool one_shot) : mOneShot(one_shot) { } }; -// A list of all statemachines registered for a particular event, and and API to work on it. +// A list of all statemachines registered for a particular event, and an API to work on it. struct AIRegisteredStateMachines { typedef std::map rsm_type; rsm_type mRegisteredStateMachines; diff --git a/indra/newview/statemachine/aievent.h b/indra/newview/statemachine/aievent.h index a90a04aaf..34ecc4db3 100644 --- a/indra/newview/statemachine/aievent.h +++ b/indra/newview/statemachine/aievent.h @@ -56,7 +56,7 @@ class AIEvent { * * This may be called for already unregistered events. * This should be called from the destructor of a statemachine for any event it registers, - * as well as when it doesn't need the event anymore (in the case on non- one shot events). + * as well as when it doesn't need the event anymore (in the case of non- one shot events). * * @param event the event we want to no longer be notified off. * @param statemachine the statemachine. diff --git a/indra/newview/statemachine/aifetchinventoryfolder.cpp b/indra/newview/statemachine/aifetchinventoryfolder.cpp index 9b19ee155..a0af969d1 100644 --- a/indra/newview/statemachine/aifetchinventoryfolder.cpp +++ b/indra/newview/statemachine/aifetchinventoryfolder.cpp @@ -88,7 +88,10 @@ void AIFetchInventoryFolder::initialize_impl(void) mNeedNotifyObservers = false; set_state(AIFetchInventoryFolder_checkFolderExists); if (!gInventory.isInventoryUsable()) + { + // This immediately calls this->idle(), and then when the event occurs cont(). AIEvent::Register(AIEvent::LLInventoryModel_mIsAgentInvUsable_true, this); + } } void AIFetchInventoryFolder::multiplex_impl(void) From dfa10281ea336940fb6e2fdc336d67b7474cd961 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Mon, 1 Aug 2011 21:00:27 +0200 Subject: [PATCH 02/10] LLFrameTimer review and resulting changes. This makes the class API a bit more sane, although only a bit, because I had to leave it working with possibly new code merged in from LL: the API can't really change. I also removed some unused code. While reviewing how LLFrameTimer worked however, I did find a few instances where things where broken: * sFrameDeltaTime wasn't correctly updated (more than once per frame and therefore erratic). This only influenced scrolling speed, but still. * While dragging an inventory item, the scroll arrows of a tab container didn't work (LLTabContainer::handleDragAndDrop). * Map zoom interpolation was broken (it interpolated between A and B, but used the already updated interpolation for A the next frame... (added mCurZoomValInterpolationStart). --- indra/llcommon/llapp.cpp | 9 -- indra/llcommon/llapp.h | 19 ---- indra/llcommon/llframetimer.cpp | 100 ++++++++++++---------- indra/llcommon/llframetimer.h | 95 +++++++++++--------- indra/llmessage/llpumpio.cpp | 4 +- indra/llui/llalertdialog.cpp | 3 +- indra/llui/lllineeditor.cpp | 3 +- indra/llui/lltabcontainer.cpp | 80 +++++++++-------- indra/llvfs/llpidlock.cpp | 2 +- indra/newview/llappviewer.cpp | 3 +- indra/newview/llfloateractivespeakers.cpp | 10 +-- indra/newview/llfloatersnapshot.cpp | 6 +- indra/newview/llfloaterworldmap.cpp | 19 ++-- indra/newview/llfloaterworldmap.h | 1 + indra/newview/llpanelmediahud.cpp | 3 +- indra/newview/llpreviewtexture.cpp | 3 +- indra/newview/llstatusbar.cpp | 6 +- indra/newview/llviewerinventory.cpp | 12 +-- indra/newview/llvoavatar.cpp | 2 +- 19 files changed, 189 insertions(+), 191 deletions(-) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 13a571e69..75c85a105 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -249,15 +249,6 @@ LLSD LLApp::getOptionData(OptionPriority level) return mOptions[level]; } -void LLApp::stepFrame() -{ - LLFrameTimer::updateFrameTime(); - LLFrameTimer::updateFrameCount(); - LLEventTimer::updateClass(); - mRunner.run(); -} - - void LLApp::setupErrorHandling() { // Error handling is done by starting up an error handling thread, which just sleeps and diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 05e2bccaf..09e88b326 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -236,17 +236,6 @@ public: pid_t fork(); #endif - /** - * @brief Get a reference to the application runner - * - * Please use the runner with caution. Since the Runner usage - * pattern is not yet clear, this method just gives access to it - * to add and remove runnables. - * @return Returns the application runner. Do not save the - * pointer past the caller's stack frame. - */ - LLRunner& getRunner() { return mRunner; } - public: typedef std::map string_map; string_map mOptionMap; // Contains all command-line options and arguments in a map @@ -264,11 +253,6 @@ protected: static LLAppChildCallback sDefaultChildCallback; #endif - /** - * @brief This method is called once a frame to do once a frame tasks. - */ - void stepFrame(); - /** * @ brief This method is called once as soon as logging is initialized. */ @@ -289,9 +273,6 @@ private: // Default application threads LLErrorThread* mThreadErrorp; // Waits for app to go to status ERROR, then runs the error callback - // This is the application level runnable scheduler. - LLRunner mRunner; - /** @name Runtime option implementation */ //@{ diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index 138c67a36..d05b9875c 100644 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -4,6 +4,7 @@ * $LicenseInfo:firstyear=2002&license=viewergpl$ * * Copyright (c) 2002-2009, Linden Research, Inc. + * Copyright (c) 2011, Aleric Inglewood. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -35,48 +36,55 @@ #include "llframetimer.h" +// Local constants. +static F64 const USEC_PER_SECOND = 1000000.0; +static F64 const USEC_TO_SEC_F64 = 0.000001; + // Static members -//LLTimer LLFrameTimer::sInternalTimer; -U64 LLFrameTimer::sStartTotalTime = totalTime(); -F64 LLFrameTimer::sFrameTime = 0.0; -U64 LLFrameTimer::sTotalTime = 0; -F64 LLFrameTimer::sTotalSeconds = 0.0; -S32 LLFrameTimer::sFrameCount = 0; -U64 LLFrameTimer::sFrameDeltaTime = 0; -const F64 USEC_PER_SECOND = 1000000.0; -const F64 USEC_TO_SEC_F64 = 0.000001; +U64 const LLFrameTimer::sStartTotalTime = totalTime(); // Application start in microseconds since epoch. +U64 LLFrameTimer::sTotalTime = LLFrameTimer::sStartTotalTime; // Current time in microseconds since epoch, updated at least once per frame. +F64 LLFrameTimer::sTotalSeconds = // Current time in seconds since epoch, updated together with LLFrameTimer::sTotalTime. + U64_to_F64(LLFrameTimer::sTotalTime) * USEC_TO_SEC_F64; +F64 LLFrameTimer::sFrameTime = 0.0; // Current time in seconds since application start, updated together with LLFrameTimer::sTotalTime. +// Updated exactly once per frame: +S32 LLFrameTimer::sFrameCount = 0; // Current frame number (number of frames since application start). +U64 LLFrameTimer::sPrevTotalTime = LLFrameTimer::sStartTotalTime; // Previous (frame) time in microseconds since epoch, updated once per frame. +U64 LLFrameTimer::sFrameDeltaTime = 0; // Microseconds between last two calls to LLFrameTimer::updateFrameTimeAndCount. // static void LLFrameTimer::updateFrameTime() { - U64 total_time = totalTime(); - sFrameDeltaTime = total_time - sTotalTime; - sTotalTime = total_time; + sTotalTime = totalTime(); sTotalSeconds = U64_to_F64(sTotalTime) * USEC_TO_SEC_F64; sFrameTime = U64_to_F64(sTotalTime - sStartTotalTime) * USEC_TO_SEC_F64; } -void LLFrameTimer::start() +// static +void LLFrameTimer::updateFrameTimeAndCount() { - reset(); - mStarted = TRUE; + updateFrameTime(); + sFrameDeltaTime = sTotalTime - sPrevTotalTime; + sPrevTotalTime = sTotalTime; + ++sFrameCount; +} + +void LLFrameTimer::reset(F32 expiration) +{ + llassert(!mPaused); + mStartTime = sFrameTime; + mExpiry = sFrameTime + expiration; +} + +void LLFrameTimer::start(F32 expiration) +{ + reset(expiration); + mRunning = true; // Start, if not already started. } void LLFrameTimer::stop() { - mStarted = FALSE; -} - -void LLFrameTimer::reset() -{ - mStartTime = sFrameTime; - mExpiry = sFrameTime; -} - -void LLFrameTimer::resetWithExpiry(F32 expiration) -{ - reset(); - setTimerExpirySec(expiration); + llassert(!mPaused); + mRunning = false; } // Don't combine pause/unpause with start/stop @@ -89,25 +97,31 @@ void LLFrameTimer::resetWithExpiry(F32 expiration) // Note: elapsed would also be valid with no unpause() call (= time run until pause() called) void LLFrameTimer::pause() { - if (mStarted) - mStartTime = sFrameTime - mStartTime; // save dtime - mStarted = FALSE; + if (!mPaused) + { + mStartTime = sFrameTime - mStartTime; // Abuse mStartTime to store the elapsed time so far. + } + mPaused = true; } void LLFrameTimer::unpause() { - if (!mStarted) - mStartTime = sFrameTime - mStartTime; // restore dtime - mStarted = TRUE; + if (mPaused) + { + mStartTime = sFrameTime - mStartTime; // Set mStartTime consistent with the elapsed time so far. + } + mPaused = false; } void LLFrameTimer::setTimerExpirySec(F32 expiration) { - mExpiry = expiration + mStartTime; + llassert(!mPaused); + mExpiry = mStartTime + expiration; } void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch) { + llassert(!mPaused); mStartTime = sFrameTime; mExpiry = seconds_since_epoch - (USEC_TO_SEC_F64 * sStartTotalTime); } @@ -119,20 +133,14 @@ F64 LLFrameTimer::expiresAt() const return expires_at; } -BOOL LLFrameTimer::checkExpirationAndReset(F32 expiration) +bool LLFrameTimer::checkExpirationAndReset(F32 expiration) { - //llinfos << "LLFrameTimer::checkExpirationAndReset()" << llendl; - //llinfos << " mStartTime:" << mStartTime << llendl; - //llinfos << " sFrameTime:" << sFrameTime << llendl; - //llinfos << " mExpiry: " << mExpiry << llendl; - - if(hasExpired()) + if (hasExpired()) { - reset(); - setTimerExpirySec(expiration); - return TRUE; + reset(expiration); + return true; } - return FALSE; + return false; } // static diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index f4775a992..e737a884e 100644 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -6,6 +6,7 @@ * $LicenseInfo:firstyear=2002&license=viewergpl$ * * Copyright (c) 2002-2009, Linden Research, Inc. + * Copyright (c) 2011, Aleric Inglewood. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -37,7 +38,7 @@ /** * *NOTE: Because of limitations on linux which we do not really have * time to explore, the total time is derived from the frame time - * and is recsynchronized on every frame. + * and is resynchronized on every frame. */ #include "lltimer.h" @@ -46,61 +47,64 @@ class LL_COMMON_API LLFrameTimer { public: - LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(TRUE) {} + // Create an LLFrameTimer and start it. After creation it is running and in the state expired (hasExpired will return true). + LLFrameTimer(void) : mStartTime(sFrameTime), mExpiry(0), mRunning(true), mPaused(false) { } - // Return the number of seconds since the start of this - // application instance. + // Return the number of seconds since the start of the application. static F64 getElapsedSeconds() { // Loses msec precision after ~4.5 hours... return sFrameTime; } - // Return a low precision usec since epoch + // Return a low precision usec since epoch. static U64 getTotalTime() { - return sTotalTime ? sTotalTime : totalTime(); + llassert(sTotalTime); + return sTotalTime; } - // Return a low precision seconds since epoch + // Return a low precision seconds since epoch. static F64 getTotalSeconds() { return sTotalSeconds; } - // Call this method once per frame to update the current frame time. This is actually called - // at some other times as well + // Call this method once per frame to update the current frame time. + // This is actually called at some other times as well. static void updateFrameTime(); - // Call this method once, and only once, per frame to update the current frame count. - static void updateFrameCount() { sFrameCount++; } + // Call this method once, and only once, per frame to update the current frame count and sFrameDeltaTime. + static void updateFrameTimeAndCount(); - static U32 getFrameCount() { return sFrameCount; } + // Return current frame number (the number of frames since application start). + static U32 getFrameCount() { return sFrameCount; } - static F32 getFrameDeltaTimeF32(); + // Return duration of last frame in seconds. + static F32 getFrameDeltaTimeF32(); // Return seconds since the current frame started - static F32 getCurrentFrameTime(); + static F32 getCurrentFrameTime(); // MANIPULATORS - void start(); - void stop(); - void reset(); - void resetWithExpiry(F32 expiration); - void pause(); - void unpause(); + + void reset(F32 expiration = 0.f); // Same as start() but leaves mRunning off when called after stop(). + void start(F32 expiration = 0.f); // Reset and (re)start with expiration. + void stop(); // Stop running. + + void pause(); // Mark elapsed time so far. + void unpause(); // Move 'start' time in order to decrement time between pause and unpause from ElapsedTime. + void setTimerExpirySec(F32 expiration); void setExpiryAt(F64 seconds_since_epoch); - BOOL checkExpirationAndReset(F32 expiration); - F32 getElapsedTimeAndResetF32() { F32 t = F32(sFrameTime - mStartTime); reset(); return t; } - - void setAge(const F64 age) { mStartTime = sFrameTime - age; } + bool checkExpirationAndReset(F32 expiration); // Returns true when expired. Only resets if expired. + F32 getElapsedTimeAndResetF32() { F32 t = getElapsedTimeF32(); reset(); return t; } + void setAge(const F64 age) { llassert(!mPaused); mStartTime = sFrameTime - age; } // ACCESSORS - BOOL hasExpired() const { return (sFrameTime >= mExpiry); } - F32 getTimeToExpireF32() const { return (F32)(mExpiry - sFrameTime); } - F32 getElapsedTimeF32() const { return mStarted ? (F32)(sFrameTime - mStartTime) : (F32)mStartTime; } - BOOL getStarted() const { return mStarted; } + bool hasExpired() const { return sFrameTime >= mExpiry; } + F32 getElapsedTimeF32() const { llassert(mRunning); return mPaused ? (F32)mStartTime : (F32)(sFrameTime - mStartTime); } + bool getStarted() const { return mRunning; } // return the seconds since epoch when this timer will expire. F64 expiresAt() const; @@ -114,45 +118,52 @@ protected: // Aplication constants // - // Start time of opp in usec since epoch - static U64 sStartTotalTime; + // Application start in microseconds since epoch. + static U64 const sStartTotalTime; // // Data updated per frame // - // Seconds since application start + // Current time in seconds since application start, updated together with sTotalTime. static F64 sFrameTime; - // Time that has elapsed since last call to updateFrameTime() + // Microseconds between last two calls to updateFrameTimeAndCount (time between last two frames). static U64 sFrameDeltaTime; - // Total microseconds since epoch. + // Current time in microseconds since epoch, updated at least once per frame. static U64 sTotalTime; - // Seconds since epoch. + // Previous (frame) time in microseconds since epoch, updated once per frame. + static U64 sPrevTotalTime; + + // Current time in seconds since epoch, updated together with sTotalTime. static F64 sTotalSeconds; - // Total number of frames elapsed in application + // Current frame number (number of frames since application start). static S32 sFrameCount; // // Member data // - // Number of seconds after application start when this timer was - // started. Set equal to sFrameTime when reset. + // When not paused (mPaused is false): number of seconds since application start, + // otherwise this value is equal to the accumulated run time (ElapsedTime). + // Set equal to sFrameTime when reset. F64 mStartTime; - // Timer expires this many seconds after application start time. + // Timer expires when sFrameTime reaches this value (in seconds since application start). F64 mExpiry; - // Useful bit of state usually associated with timers, but does - // not affect actual functionality - BOOL mStarted; + // True when running, merely a boolean return by getStarted(). The timer always runs. + bool mRunning; + + // True when accumulating ElapsedTime. If false mStartTime has a different meaning + // and really unpause() should be called before anything else. + bool mPaused; }; // Glue code for Havok (or anything else that doesn't want the full .h files) -extern F32 getCurrentFrameTime(); +extern F32 getCurrentFrameTime(); #endif // LL_LLFRAMETIMER_H diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index c50dcc876..7a10c0fa6 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -1147,9 +1147,7 @@ void LLPumpIO::LLChainInfo::setTimeoutSeconds(F32 timeout) LLMemType m1(LLMemType::MTYPE_IO_PUMP); if(timeout > 0.0f) { - mTimer.start(); - mTimer.reset(); - mTimer.setTimerExpirySec(timeout); + mTimer.start(timeout); } else { diff --git a/indra/llui/llalertdialog.cpp b/indra/llui/llalertdialog.cpp index f708e220e..27700ca20 100644 --- a/indra/llui/llalertdialog.cpp +++ b/indra/llui/llalertdialog.cpp @@ -349,8 +349,7 @@ bool LLAlertDialog::show() if(mDefaultOption >= 0) { // delay before enabling default button - mDefaultBtnTimer.start(); - mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY); + mDefaultBtnTimer.start(DEFAULT_BUTTON_DELAY); } // attach to floater if necessary diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index fe4190a2b..328e62051 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -858,8 +858,7 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) if (mScrollTimer.hasExpired()) { S32 increment = llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME); - mScrollTimer.reset(); - mScrollTimer.setTimerExpirySec(AUTO_SCROLL_TIME); + mScrollTimer.reset(AUTO_SCROLL_TIME); if( (x < mMinHPixels) && (mScrollHPos > 0 ) ) { // Scroll to the left diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 1f94191d2..e1bf4d4aa 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -630,49 +630,59 @@ LLXMLNodePtr LLTabContainer::getXML(bool save_children) const // virtual BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = (getMaxScrollPos() > 0); + bool const has_scroll_arrows = (getMaxScrollPos() > 0); - if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) + LLButton* button = NULL; + if (has_scroll_arrows) { - if (has_scroll_arrows) + // We're dragging an inventory item. Check if we're hovering over scroll arrows of this tab container. + if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) { - if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) + button = mJumpPrevArrowBtn; + } + else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) + { + button = mJumpNextArrowBtn; + } + else if (mPrevArrowBtn->getRect().pointInRect(x, y)) + { + button = mPrevArrowBtn; + } + else if (mNextArrowBtn->getRect().pointInRect(x, y)) + { + button = mNextArrowBtn; + } + if (button) + { + if (mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.hasExpired()) { - S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom; - mJumpPrevArrowBtn->handleHover(local_x, local_y, mask); + // We've been hovering (another) SCROLL_DELAY_TIME seconds. Emulate a button press. + button->onCommit(); + // Reset the timer. + mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME); } - if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) + else if (!mDragAndDropDelayTimer.getStarted()) { - S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom; - mJumpNextArrowBtn->handleHover(local_x, local_y, mask); - } - if (mPrevArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mPrevArrowBtn->getRect().mBottom; - mPrevArrowBtn->handleHover(local_x, local_y, mask); - } - else if (mNextArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mNextArrowBtn->getRect().mLeft; - S32 local_y = y - mNextArrowBtn->getRect().mBottom; - mNextArrowBtn->handleHover(local_x, local_y, mask); + // We just entered the arrow. Start the timer. + mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME); } } - - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + else { - LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); - S32 local_x = x - tuple->mButton->getRect().mLeft; - S32 local_y = y - tuple->mButton->getRect().mBottom; - if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) - { - tuple->mButton->onCommit(); - mDragAndDropDelayTimer.stop(); - } + // We're not on an arrow or just left it. Stop the time (in case it was running). + mDragAndDropDelayTimer.stop(); + } + } + + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + { + LLTabTuple* tuple = *iter; + tuple->mButton->setVisible( TRUE ); + S32 local_x = x - tuple->mButton->getRect().mLeft; + S32 local_y = y - tuple->mButton->getRect().mBottom; + if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + { + tuple->mButton->onCommit(); } } @@ -1849,5 +1859,3 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y) } } - - diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp index 28cee2940..5df5eadbe 100644 --- a/indra/llvfs/llpidlock.cpp +++ b/indra/llvfs/llpidlock.cpp @@ -167,7 +167,7 @@ bool LLPidLockFile::requestLock(LLNameTable *name_table, bool autosave, if (!mWaiting) //Not presently waiting to save. Queue up. { - mTimer.resetWithExpiry(timeout); + mTimer.reset(timeout); mWaiting=TRUE; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f621e0779..42aa24c78 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3545,8 +3545,7 @@ void LLAppViewer::idle() // Update frame timers static LLTimer idle_timer; - LLFrameTimer::updateFrameTime(); - LLFrameTimer::updateFrameCount(); + LLFrameTimer::updateFrameTimeAndCount(); LLEventTimer::updateClass(); LLCriticalDamp::updateInterpolants(); LLMortician::updateClass(); diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index a641ac69d..27d35c6bb 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -91,7 +91,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id)); - mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + mActivityTimer.reset(SPEAKER_TIMEOUT); } @@ -1021,7 +1021,7 @@ LLPointer LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin { // keep highest priority status (lowest value) instead of overriding current value speakerp->mStatus = llmin(speakerp->mStatus, status); - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); // RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id // we need to override speakers that we think are objects when we find out they are really // residents @@ -1329,7 +1329,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } else if (agent_data["transition"].asString() == "ENTER") { @@ -1377,7 +1377,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } else if ( agent_transition == "ENTER") { @@ -1476,7 +1476,7 @@ void LLLocalSpeakerMgr::updateSpeakerList() { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } } } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 80d4e975d..00d53193d 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -229,7 +229,6 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR) { setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")); - mSnapshotDelayTimer.setTimerExpirySec(0.0f); mSnapshotDelayTimer.start(); // gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this ); sList.insert(this); @@ -350,8 +349,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail mShineAnimTimer.stop(); if (new_snapshot) { - mSnapshotDelayTimer.start(); - mSnapshotDelayTimer.setTimerExpirySec(delay); + mSnapshotDelayTimer.start(delay); } if(new_thumbnail) { @@ -754,7 +752,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) // see if it's time yet to snap the shot and bomb out otherwise. previewp->mSnapshotActive = - (previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired()) + (previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired()) && !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active if ( ! previewp->mSnapshotActive) { diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 0dde8c746..0750f9e78 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -502,17 +502,26 @@ void LLFloaterWorldMap::draw() getDragHandle()->setMouseOpaque(TRUE); //RN: snaps to zoom value because interpolation caused jitter in the text rendering - if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal()) + F32 interp = 1.f; + if (!mZoomTimer.getStarted()) { - mZoomTimer.start(); + mCurZoomValInterpolationStart = mCurZoomVal; + if (mCurZoomVal < (F32)childGetValue("zoom slider").asReal()) + { + mZoomTimer.start(); + } } - F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; - if (interp > 1.f) + if (mZoomTimer.getStarted()) + { + interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; + } + if (interp >= 1.f) { interp = 1.f; mZoomTimer.stop(); } - mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp); + // Interpolate between mCurZoomValInterpolationStart and "zoom slider". + mCurZoomVal = lerp(mCurZoomValInterpolationStart, (F32)childGetValue("zoom slider").asReal(), interp); F32 map_scale = 256.f*pow(2.f, mCurZoomVal); LLWorldMapView::setScale( map_scale ); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 5c8c976d6..03baa3eef 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -164,6 +164,7 @@ protected: // Sets sMapScale, in pixels per region F32 mCurZoomVal; + F32 mCurZoomValInterpolationStart; // Used during mZoomTimer interpolation. LLFrameTimer mZoomTimer; LLDynamicArray mLandmarkAssetIDList; diff --git a/indra/newview/llpanelmediahud.cpp b/indra/newview/llpanelmediahud.cpp index 2ac5a62fb..a71bddfee 100644 --- a/indra/newview/llpanelmediahud.cpp +++ b/indra/newview/llpanelmediahud.cpp @@ -396,9 +396,8 @@ void LLPanelMediaHUD::updateShape() } } // If we need to start fading the UI (and we have not already started) - else if(! mFadeTimer.getStarted()) + else if (!mFadeTimer.getStarted()) { - mFadeTimer.reset(); mFadeTimer.start(); } } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index e23e662ec..55a5ef6b0 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -446,8 +446,7 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, } else { - self->mSavedFileTimer.reset(); - self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG ); + self->mSavedFileTimer.reset(SECONDS_TO_SHOW_FILE_SAVED_MSG); } self->mSaveFileName.clear(); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 036d4f76f..f897b6c50 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -683,8 +683,7 @@ void LLStatusBar::setBalance(S32 balance) if( balance != mBalance ) { - mBalanceTimer->reset(); - mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mBalanceTimer->reset(ICON_TIMER_EXPIRY); mBalance = balance; } } @@ -728,8 +727,7 @@ void LLStatusBar::setHealth(S32 health) } } - mHealthTimer->reset(); - mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mHealthTimer->reset(ICON_TIMER_EXPIRY); } mHealth = health; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index a1d157b7f..21f26d7dd 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -390,7 +390,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid, mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN) { - mDescendentsRequested.reset(); + mDescendentsRequested.stop(); } LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) : @@ -398,7 +398,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) : mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN) { - mDescendentsRequested.reset(); + mDescendentsRequested.stop(); } LLViewerInventoryCategory::LLViewerInventoryCategory(const LLViewerInventoryCategory* other) @@ -489,12 +489,12 @@ bool LLViewerInventoryCategory::fetchDescendents() // if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false; // - if((VERSION_UNKNOWN == mVersion) - && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. + if (VERSION_UNKNOWN == mVersion && + (!mDescendentsRequested.getStarted() || + mDescendentsRequested.hasExpired())) // Expired check prevents multiple downloads. { const F32 FETCH_TIMER_EXPIRY = 10.0f; - mDescendentsRequested.reset(); - mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); + mDescendentsRequested.start(FETCH_TIMER_EXPIRY); // bitfield // 1 = by date diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6af2875a7..6583eff06 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3964,7 +3964,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } //idle text std::string idle_string; - if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120 && gSavedSettings.getBOOL("AscentShowIdleTime")) + if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime")) { idle_string = getIdleTime(); } From 2ceebebb49c891c484c9953004b04dfe5014fcb8 Mon Sep 17 00:00:00 2001 From: TighMacFanatic Date: Tue, 2 Aug 2011 14:56:18 -0400 Subject: [PATCH 03/10] Fix label on disable TP and login screen options. --- .../default/xui/en-us/panel_preferences_ascent_vanity.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index 5db045198..a34e943bf 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -13,8 +13,8 @@ width="400" /> From f297068ec053d3f8f3ee1eeea8bf7711af3fb151 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 2 Aug 2011 23:26:02 +0200 Subject: [PATCH 04/10] Don't instantiate LLTextParser::getInstance before user logged in. --- indra/llui/lltextparser.cpp | 11 +++++------ indra/newview/llconsole.cpp | 10 +++++++++- indra/newview/llfloaterchat.cpp | 4 ++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 2493afcb5..c8a85dd86 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -233,15 +233,14 @@ void LLTextParser::loadKeywords() bool LLTextParser::saveToDisk(LLSD highlights) { mHighlights=highlights; - std::string filename=getFileName(); - if (filename.empty()) + if (gDirUtilp->getLindenUserDir(true).empty()) { - llwarns << "LLTextParser::saveToDisk() no valid user directory." << llendl; - return FALSE; + // User didn't login, so nothing to save. + return false; } llofstream file; - file.open(filename.c_str()); + file.open(getFileName().c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); - return TRUE; + return true; } diff --git a/indra/newview/llconsole.cpp b/indra/newview/llconsole.cpp index 937ccec24..db2d474b0 100644 --- a/indra/newview/llconsole.cpp +++ b/indra/newview/llconsole.cpp @@ -456,6 +456,14 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time) : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1) { - makeParagraphColorSegments(color); + // Only call makeParagraphColorSegments if the user logged in already (we come + // here before he logged in when they disabled login/logout screens). + // Otherwise makeParagraphColorSegments calls LLTextParser::getInstance() which + // causes a one-time initialization by reading highlights.xml, which fails + // when not logged in because it's per account. + if (!gDirUtilp->getLindenUserDir(true).empty()) + { + makeParagraphColorSegments(color); + } } diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 133986dfa..eac5187f0 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -497,6 +497,10 @@ void LLFloaterChat::addChat(const LLChat& chat, //static void LLFloaterChat::triggerAlerts(const std::string& text) { + // Cannot instantiate LLTextParser before logging in. + if (gDirUtilp->getLindenUserDir(true).empty()) + return; + LLTextParser* parser = LLTextParser::getInstance(); // bool spoken=FALSE; for (S32 i=0;imHighlights.size();i++) From a43f1ee299abe5f046b5feeaf7b54845b0e4a59f Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Thu, 4 Aug 2011 22:41:37 +0200 Subject: [PATCH 05/10] Fix a typo. --- .../skins/default/xui/en-us/panel_preferences_ascent_chat.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml index 00412ca2d..7d4d31cea 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml @@ -272,7 +272,7 @@ To use spellcheck, right-click a misspelled word left="5" name="CmdDivisor" width="356"/> From 3bde58d97072f40305ba8e39622b1a9e15a0cb48 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 5 Aug 2011 00:05:08 +0200 Subject: [PATCH 06/10] Wrap sGlobalRawMemory in AIThreadSafe. This is accessed by different threads. Other globals like it might also be accessed by different threads, this has to be investigated. --- indra/llimage/llimage.cpp | 14 ++++++++------ indra/llimage/llimage.h | 3 ++- indra/newview/lltextureview.cpp | 6 +++++- indra/newview/llviewerstats.cpp | 6 +++++- indra/newview/llviewertexturelist.cpp | 6 +++++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 00ed4e469..73b4b7b90 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -245,7 +245,7 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si // LLImageRaw //--------------------------------------------------------------------------- -S32 LLImageRaw::sGlobalRawMemory = 0; +AITHREADSAFESIMPLE(S32, LLImageRaw::sGlobalRawMemory, ); S32 LLImageRaw::sRawImageCount = 0; S32 LLImageRaw::sRawImageCachedCount = 0; @@ -295,23 +295,25 @@ LLImageRaw::~LLImageRaw() U8* LLImageRaw::allocateData(S32 size) { U8* res = LLImageBase::allocateData(size); - sGlobalRawMemory += getDataSize(); + *AIAccess(sGlobalRawMemory) += getDataSize(); return res; } // virtual U8* LLImageRaw::reallocateData(S32 size) { - sGlobalRawMemory -= getDataSize(); + S32 old_data_size = getDataSize(); U8* res = LLImageBase::reallocateData(size); - sGlobalRawMemory += getDataSize(); + *AIAccess(sGlobalRawMemory) += getDataSize() - old_data_size; return res; } // virtual void LLImageRaw::deleteData() { - sGlobalRawMemory -= getDataSize(); + { + *AIAccess(sGlobalRawMemory) -= getDataSize(); + } LLImageBase::deleteData(); } @@ -327,7 +329,7 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) LLImageBase::setSize(width, height, components) ; LLImageBase::setDataAndSize(data, width * height * components) ; - sGlobalRawMemory += getDataSize(); + *AIAccess(sGlobalRawMemory) += getDataSize(); } BOOL LLImageRaw::resize(U16 width, U16 height, S8 components) diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 9f0cfa87d..99b07be84 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -37,6 +37,7 @@ #include "llstring.h" #include "llmemory.h" #include "llthread.h" +#include "aithreadsafe.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 const S32 MAX_IMAGE_MIP = 11; // 2048x2048 @@ -241,7 +242,7 @@ protected: void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ; public: - static S32 sGlobalRawMemory; + static AIThreadSafeSimple sGlobalRawMemory; static S32 sRawImageCount; static S32 sRawImageCachedCount; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 2ce0c5ff4..736a6dafa 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -421,12 +421,16 @@ void LLGLTexMemBar::draw() std::string text; + S32 global_raw_memory; + { + global_raw_memory = *AIAccess(LLImageRaw::sGlobalRawMemory); + } text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB", total_mem, max_total_mem, bound_mem, max_bound_mem, - LLImageRaw::sGlobalRawMemory >> 20, discard_bias, + global_raw_memory >> 20, discard_bias, cache_usage, cache_max_usage, total_texture_downloaded, total_object_downloaded); //, cache_entries, cache_max_entries diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 3f24ba674..2c9468743 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -362,12 +362,16 @@ void reset_statistics() void output_statistics(void*) { + S32 global_raw_memory; + { + global_raw_memory = *AIAccess(LLImageRaw::sGlobalRawMemory); + } llinfos << "Number of orphans: " << gObjectList.getOrphanCount() << llendl; llinfos << "Number of dead objects: " << gObjectList.mNumDeadObjects << llendl; llinfos << "Num images: " << gTextureList.getNumImages() << llendl; llinfos << "Texture usage: " << LLImageGL::sGlobalTextureMemoryInBytes << llendl; llinfos << "Texture working set: " << LLImageGL::sBoundTextureMemoryInBytes << llendl; - llinfos << "Raw usage: " << LLImageRaw::sGlobalRawMemory << llendl; + llinfos << "Raw usage: " << global_raw_memory << llendl; llinfos << "Formatted usage: " << LLImageFormatted::sGlobalFormattedMemory << llendl; llinfos << "Zombie Viewer Objects: " << LLViewerObject::getNumZombieObjects() << llendl; llinfos << "Number of lights: " << gPipeline.getLightCount() << llendl; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index c5b973af5..997823268 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -608,11 +608,15 @@ void LLViewerTextureList::updateImages(F32 max_time) { LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec()); + S32 global_raw_memory; + { + global_raw_memory = *AIAccess(LLImageRaw::sGlobalRawMemory); + } sNumImagesStat.addValue(sNumImages); sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); sGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); sGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); - sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); + sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(global_raw_memory)); sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); updateImagesDecodePriorities(); From e70bc6b8007c63d8927bdd24a4e33d4bdc81090f Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 3 Aug 2011 17:40:06 +0200 Subject: [PATCH 07/10] Variable size region support, by RevolutionSmythe --- indra/llcommon/indra_constants.h | 5 +++++ indra/llinventory/llparcel.h | 1 + indra/llmessage/message_prehash.cpp | 2 ++ indra/llmessage/message_prehash.h | 2 ++ indra/llmessage/patch_code.cpp | 11 ++++++---- indra/llmessage/patch_code.h | 2 +- indra/llmessage/patch_dct.h | 2 +- indra/newview/llcloud.cpp | 2 +- indra/newview/llfloaterregioninfo.cpp | 9 ++++---- indra/newview/llglsandbox.cpp | 2 +- indra/newview/llstartup.cpp | 16 ++++++++++++-- indra/newview/llsurface.cpp | 20 ++++++++++++----- indra/newview/llviewermessage.cpp | 29 +++++++++++++++++++++++-- indra/newview/llviewerparcelmgr.cpp | 22 ++++++++++++------- indra/newview/llviewerparcelmgr.h | 2 ++ indra/newview/llviewerparceloverlay.cpp | 4 +++- indra/newview/llviewerparceloverlay.h | 1 + indra/newview/llviewerregion.cpp | 3 +++ indra/newview/llvlmanager.cpp | 28 +++++++++++++++++++----- indra/newview/llvlmanager.h | 1 + indra/newview/llvowater.cpp | 2 +- indra/newview/llwind.cpp | 4 ++-- indra/newview/llworld.cpp | 28 ++++++++++++++++++------ indra/newview/llworld.h | 6 ++--- 24 files changed, 155 insertions(+), 49 deletions(-) diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 815145ac8..089f8ed38 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -153,6 +153,11 @@ const char LAND_LAYER_CODE = 'L'; const char WATER_LAYER_CODE = 'W'; const char WIND_LAYER_CODE = '7'; const char CLOUD_LAYER_CODE = '8'; +// Extended land layer for Aurora Sim +const char AURORA_LAND_LAYER_CODE = 'M'; +const char AURORA_WATER_LAYER_CODE = 'X'; +const char AURORA_WIND_LAYER_CODE = '9'; +const char AURORA_CLOUD_LAYER_CODE = ':'; // keys // Bit masks for various keyboard modifier keys. diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 7423229f7..d55d09e3a 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -67,6 +67,7 @@ const F32 PARCEL_PASS_HOURS_DEFAULT = 1.f; // Number of "chunks" in which parcel overlay data is sent // Chunk 0 = southern rows, entire width +// NOTE: NOT USABLE FOR VAR SIZED REGIONS! const S32 PARCEL_OVERLAY_CHUNKS = 4; // Bottom three bits are a color index for the land overlay diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 892547cab..855d1cccf 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -588,6 +588,8 @@ char* _PREHASH_LastName = LLMessageStringTable::getInstance()->getString("LastNa char* _PREHASH_From = LLMessageStringTable::getInstance()->getString("From"); char* _PREHASH_RoleChange = LLMessageStringTable::getInstance()->getString("RoleChange"); char* _PREHASH_Port = LLMessageStringTable::getInstance()->getString("Port"); +char* _PREHASH_RegionSizeX = LLMessageStringTable::getInstance()->getString("RegionSizeX"); +char* _PREHASH_RegionSizeY = LLMessageStringTable::getInstance()->getString("RegionSizeY"); char* _PREHASH_MemberTitle = LLMessageStringTable::getInstance()->getString("MemberTitle"); char* _PREHASH_LogParcelChanges = LLMessageStringTable::getInstance()->getString("LogParcelChanges"); char* _PREHASH_AgentCachedTextureResponse = LLMessageStringTable::getInstance()->getString("AgentCachedTextureResponse"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 4bf89e513..77cfe710a 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -588,6 +588,8 @@ extern char * _PREHASH_LastName; extern char * _PREHASH_From; extern char * _PREHASH_RoleChange; extern char * _PREHASH_Port; +extern char * _PREHASH_RegionSizeX; +extern char * _PREHASH_RegionSizeY; extern char * _PREHASH_MemberTitle; extern char * _PREHASH_LogParcelChanges; extern char * _PREHASH_AgentCachedTextureResponse; diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index 90fb23634..12ed19ea4 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -235,7 +235,7 @@ void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp) gPatchSize = gopp->patch_size; } -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch) { U8 retvalu8; @@ -274,15 +274,18 @@ void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) #endif ph->range = retvalu16; - retvalu16 = 0; + retvalu32 = 0; #ifdef LL_BIG_ENDIAN ret = (U8 *)&retvalu16; bitpack.bitUnpack(&(ret[1]), 8); bitpack.bitUnpack(&(ret[0]), 2); #else - bitpack.bitUnpack((U8 *)&retvalu16, 10); + if (b_large_patch) + bitpack.bitUnpack((U8 *)&retvalu32, 32); + else + bitpack.bitUnpack((U8 *)&retvalu32, 10); #endif - ph->patchids = retvalu16; + ph->patchids = retvalu32; gWordBits = (ph->quant_wbits & 0xf) + 2; } diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h index 82fa6bb62..dbfdf7059 100644 --- a/indra/llmessage/patch_code.h +++ b/indra/llmessage/patch_code.h @@ -46,7 +46,7 @@ void end_patch_coding(LLBitPack &bitpack); void init_patch_decoding(LLBitPack &bitpack); void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp); -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph); +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch); void decode_patch(LLBitPack &bitpack, S32 *patches); #endif diff --git a/indra/llmessage/patch_dct.h b/indra/llmessage/patch_dct.h index 663e146a8..ba21be711 100644 --- a/indra/llmessage/patch_dct.h +++ b/indra/llmessage/patch_dct.h @@ -79,7 +79,7 @@ public: F32 dc_offset; // 4 bytes U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch) U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2) - U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) + U32 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) }; // Compression routines diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index ca35c3711..116d227cc 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -437,7 +437,7 @@ void LLCloudLayer::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) group_headerp->stride = group_headerp->patch_size; // offset required to step up one row set_group_of_patch_header(group_headerp); - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, gBuffer); decompress_patch(mDensityp, gBuffer, &patch_header); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index deae4fa92..fbf7d2e34 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1089,10 +1089,11 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; // Make sure user hasn't chosen wacky textures. - if (!validateTextureSizes()) - { - return FALSE; - } + // -Revolution Allow 'wacky' things + //if (!validateTextureSizes()) + //{ + // return FALSE; + //} LLTextureCtrl* texture_ctrl; std::string buffer; diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 092fdc6b5..5da3926b7 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -613,7 +613,7 @@ void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 hei return; // HACK: At edge of last region of world, we need to make sure the region // resolves correctly so we can get a height value. - const F32 BORDER = REGION_WIDTH_METERS - 0.1f; + const F32 BORDER = regionp->getWidth() - 0.1f; F32 clamped_x1 = x1; F32 clamped_y1 = y1; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b854358c9..b61ad580e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -370,6 +370,8 @@ bool idle_startup() static U64 first_sim_handle = 0; static LLHost first_sim; static std::string first_sim_seed_cap; + static U32 first_sim_size_x = 256; + static U32 first_sim_size_y = 256; static LLVector3 initial_sun_direction(1.f, 0.f, 0.f); static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server @@ -1657,7 +1659,17 @@ bool idle_startup() U32 region_y = strtoul(region_y_str.c_str(), NULL, 10); first_sim_handle = to_region_handle(region_x, region_y); } - + + text = LLUserAuth::getInstance()->getResponse("region_size_x"); + if(!text.empty()) { + first_sim_size_x = strtoul(text.c_str(), NULL, 10); + LLViewerParcelMgr::getInstance()->init(first_sim_size_x); + } + + //region Y size is currently unused, major refactoring required. - Patrick Sapinski (2/10/2011) + text = LLUserAuth::getInstance()->getResponse("region_size_y"); + if(!text.empty()) first_sim_size_y = strtoul(text.c_str(), NULL, 10); + const std::string look_at_str = LLUserAuth::getInstance()->getResponse("look_at"); if (!look_at_str.empty()) { @@ -1946,7 +1958,7 @@ bool idle_startup() gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); - LLWorld::getInstance()->addRegion(first_sim_handle, first_sim); + LLWorld::getInstance()->addRegion(first_sim_handle, first_sim, first_sim_size_x, first_sim_size_y); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(first_sim_handle); LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 9d718e88c..7a46305e4 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -299,7 +299,7 @@ void LLSurface::initTextures() mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp); gPipeline.createObject(mWaterObjp); LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle()); - water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); + water_pos_global += LLVector3d(mRegionp->getWidth()/2, mRegionp->getWidth()/2, DEFAULT_WATER_HEIGHT); mWaterObjp->setPositionGlobal(water_pos_global); } } @@ -329,8 +329,8 @@ void LLSurface::setOriginGlobal(const LLVector3d &origin_global) // Hack! if (mWaterObjp.notNull() && mWaterObjp->mDrawable.notNull()) { - const F64 x = origin_global.mdV[VX] + 128.0; - const F64 y = origin_global.mdV[VY] + 128.0; + const F64 x = origin_global.mdV[VX] + (F64)mRegionp->getWidth()/2; + const F64 y = origin_global.mdV[VY] + (F64)mRegionp->getWidth()/2; const F64 z = mWaterObjp->getPositionGlobal().mdV[VZ]; LLVector3d water_origin_global(x, y, z); @@ -680,14 +680,22 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL while (1) { - decode_patch_header(bitpack, &ph); + decode_patch_header(bitpack, &ph, b_large_patch); if (ph.quant_wbits == END_OF_PATCHES) { break; } - i = ph.patchids >> 5; - j = ph.patchids & 0x1F; + if (b_large_patch) + { + i = ph.patchids >> 16; //x + j = ph.patchids & 0xFFFF; //y + } + else + { + i = ph.patchids >> 5; //x + j = ph.patchids & 0x1F; //y + } if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge)) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d7a7566bd..0cb987908 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3708,6 +3708,18 @@ void process_teleport_finish(LLMessageSystem* msg, void**) U32 teleport_flags; msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeY, region_size_y); + + //and a little hack for Second Life compatibility + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } std::string seedCap; msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); @@ -3727,7 +3739,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Viewer trusts the simulator. gMessageSystem->enableCircuit(sim_host, TRUE); - LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); /* // send camera update to new region @@ -4033,9 +4045,22 @@ void process_crossed_region(LLMessageSystem* msg, void**) std::string seedCap; msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); + U32 region_size_x = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeY, region_size_y); + + //and a little hack for Second Life compatibility + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } + send_complete_agent_movement(sim_host); - LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); regionp->setSeedCapability(seedCap); } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index e68223285..9b13c9c06 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -137,7 +137,18 @@ LLViewerParcelMgr::LLViewerParcelMgr() mAgentParcel = new LLParcel(); mHoverParcel = new LLParcel(); mCollisionParcel = new LLParcel(); + mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"); + mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); + + init(256); + +} +//moved this stuff out of the constructor and into a function that we can call again after we get the region size. +//LLViewerParcelMgr needs to be changed so we either get an instance per region, or it handles various region sizes +//on a single grid properly - Patrick Sapinski (2/10/2011) +void LLViewerParcelMgr::init(F32 region_size) +{ mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mHighlightSegments); @@ -145,13 +156,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mCollisionSegments); - // JC: Resolved a merge conflict here, eliminated - // mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP); - // because it is done in llviewertexturelist.cpp - mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"); - mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); - - S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS; + S32 mParcelOverLayChunks = region_size * region_size / (128 * 128); + S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / mParcelOverLayChunks; sPackedOverlay = new U8[overlay_size]; mAgentParcelOverlay = new U8[mParcelsPerEdge * mParcelsPerEdge]; @@ -1360,7 +1366,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) } S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; - S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS; + S32 expected_size = 1024; if (packed_overlay_size != expected_size) { llwarns << "Got parcel overlay size " << packed_overlay_size diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 236dbcbec..43e79125c 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -82,6 +82,8 @@ public: LLViewerParcelMgr(); ~LLViewerParcelMgr(); + void init(F32 region_size); + static void cleanupGlobals(); BOOL selectionEmpty() const; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index fc6e1b1d0..27494aba4 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -58,6 +58,7 @@ const U8 OVERLAY_IMG_COMPONENTS = 4; LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), + mRegionSize(S32(region_width_meters)), mDirty( FALSE ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1), @@ -298,7 +299,8 @@ void LLViewerParcelOverlay::uncompressLandOverlay(S32 chunk, U8 *packed_overlay) { // Unpack the message data into the ownership array S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge; - S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS; + S32 mParcelOverLayChunks = mRegionSize * mRegionSize / (128 * 128); + S32 chunk_size = size / mParcelOverLayChunks; memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/ diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 161b7a386..97f2ec2b8 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -100,6 +100,7 @@ private: LLViewerRegion* mRegion; S32 mParcelGridsPerEdge; + S32 mRegionSize; LLPointer mTexture; LLPointer mImageRaw; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b57aa7720..c4cbffdba 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -70,6 +70,7 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llviewerparcelmgr.h" extern BOOL gNoRender; @@ -269,6 +270,8 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, if (!gNoRender) { mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters); + //Re-init the parcel mgr for this sim + LLViewerParcelMgr::getInstance()->init(region_width_meters); } else { diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index 07ef26266..19ebe05fa 100644 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -56,18 +56,26 @@ LLVLManager::~LLVLManager() void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size) { - if (LAND_LAYER_CODE == vl_datap->mType) + if (LAND_LAYER_CODE == vl_datap->mType || + AURORA_LAND_LAYER_CODE == vl_datap->mType) { mLandBits += mesg_size * 8; } - else if (WIND_LAYER_CODE == vl_datap->mType) + else if (WIND_LAYER_CODE == vl_datap->mType || + AURORA_WIND_LAYER_CODE == vl_datap->mType) { mWindBits += mesg_size * 8; } - else if (CLOUD_LAYER_CODE == vl_datap->mType) + else if (CLOUD_LAYER_CODE == vl_datap->mType || + AURORA_CLOUD_LAYER_CODE == vl_datap->mType) { mCloudBits += mesg_size * 8; } + else if (WATER_LAYER_CODE == vl_datap->mType || + AURORA_CLOUD_LAYER_CODE == vl_datap->mType) + { + mWaterBits += mesg_size * 8; + } else { llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl; @@ -93,15 +101,25 @@ void LLVLManager::unpackData(const S32 num_packets) { datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE); } - else if (WIND_LAYER_CODE == datap->mType) + else if (AURORA_LAND_LAYER_CODE == datap->mType) + { + datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, TRUE); + } + else if (WIND_LAYER_CODE == datap->mType || + AURORA_WIND_LAYER_CODE == datap->mType) { datap->mRegionp->mWind.decompress(bit_pack, &goph); } - else if (CLOUD_LAYER_CODE == datap->mType) + else if (CLOUD_LAYER_CODE == datap->mType || + AURORA_CLOUD_LAYER_CODE == datap->mType) { datap->mRegionp->mCloudLayer.decompress(bit_pack, &goph); } + else if (WATER_LAYER_CODE == datap->mType || + AURORA_WATER_LAYER_CODE == datap->mType) + { + } } for (i = 0; i < mPacketData.count(); i++) diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h index 9d64d6f24..4d7137fac 100644 --- a/indra/newview/llvlmanager.h +++ b/indra/newview/llvlmanager.h @@ -65,6 +65,7 @@ protected: U32 mLandBits; U32 mWindBits; U32 mCloudBits; + U32 mWaterBits; }; class LLVLData diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 2897f98ac..49120afa5 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -74,7 +74,7 @@ LLVOWater::LLVOWater(const LLUUID &id, { // Terrain must draw during selection passes so it can block objects behind it. mbCanSelect = FALSE; - setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility. + setScale(LLVector3(mRegionp->getWidth(), mRegionp->getWidth(), 0.f)); // Hack for setting scale for bounding boxes/visibility. mUseTexture = TRUE; mIsEdgePatch = FALSE; diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index 2b0f0d969..0a2afd428 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -121,12 +121,12 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) set_group_of_patch_header(group_headerp); // X component - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, buffer); decompress_patch(mVelX, buffer, &patch_header); // Y component - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, buffer); decompress_patch(mVelY, buffer, &patch_header); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 171d6a9bb..1b3e040b3 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -78,12 +78,12 @@ const S32 WORLD_PATCH_SIZE = 16; extern LLColor4U MAX_WATER_COLOR; -const U32 LLWorld::mWidth = 256; +U32 LLWorld::mWidth = 256; // meters/point, therefore mWidth * mScale = meters per edge const F32 LLWorld::mScale = 1.f; -const F32 LLWorld::mWidthInMeters = mWidth * mScale; +F32 LLWorld::mWidthInMeters = mWidth * mScale; // // Functions @@ -138,7 +138,7 @@ void LLWorld::destroyClass() } -LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) +LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y) { LLMemType mt(LLMemType::MTYPE_REGIONS); llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; @@ -171,9 +171,11 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) U32 iindex = 0; U32 jindex = 0; + mWidth = region_size_x; + mWidthInMeters = mWidth * mScale; from_region_handle(region_handle, &iindex, &jindex); - S32 x = (S32)(iindex/mWidth); - S32 y = (S32)(jindex/mWidth); + S32 x = (S32)(iindex/256); + S32 y = (S32)(jindex/256); llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Host: " << host << llendl; @@ -823,7 +825,7 @@ F32 LLWorld::getLandFarClip() const void LLWorld::setLandFarClip(const F32 far_clip) { - static S32 const rwidth = (S32)REGION_WIDTH_U32; + static S32 const rwidth = (S32)getRegionWidthInMeters(); S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth; S32 const n2 = (llceil(far_clip) - 1) / rwidth; bool need_water_objects_update = n1 != n2; @@ -1253,9 +1255,21 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) // which simulator should we modify? LLHost sim(ip_u32, port); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeY, region_size_y); + + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } + // Viewer trusts the simulator. msg->enableCircuit(sim, TRUE); - LLWorld::getInstance()->addRegion(handle, sim); + LLWorld::getInstance()->addRegion(handle, sim, region_size_x, region_size_y); // give the simulator a message it can use to get ip and port llinfos << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << llendl; diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index ec6e45b23..b3bd661cf 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -71,7 +71,7 @@ public: LLWorld(); void destroyClass(); - LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); + LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y); // safe to call if already present, does the "right thing" if // hosts are same, or if hosts are different, etc... void removeRegion(const LLHost &host); @@ -170,12 +170,12 @@ private: region_list_t mCulledRegionList; // Number of points on edge - static const U32 mWidth; + static U32 mWidth; // meters/point, therefore mWidth * mScale = meters per edge static const F32 mScale; - static const F32 mWidthInMeters; + static F32 mWidthInMeters; F32 mLandFarClip; // Far clip distance for land. LLPatchVertexArray mLandPatch; From 39b18cd2ca038ff954117a3b1ecf865e2d674a68 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 3 Aug 2011 23:16:00 +0200 Subject: [PATCH 08/10] Build fix for that --- indra/newview/CMakeLists.txt | 1 + indra/newview/llviewerparcelmgr.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3062e3b0e..e3dd2b851 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1232,6 +1232,7 @@ set_source_files_properties(${viewer_XUI_FILES} list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) set(viewer_APPSETTINGS_FILES + viewer_manifest.py app_settings/anim.ini app_settings/cmd_line.xml app_settings/grass.xml diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 9b13c9c06..bb0f0ee22 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -138,16 +138,16 @@ LLViewerParcelMgr::LLViewerParcelMgr() mHoverParcel = new LLParcel(); mCollisionParcel = new LLParcel(); mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"); - mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); - - init(256); - + mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); + + init(256); + } -//moved this stuff out of the constructor and into a function that we can call again after we get the region size. -//LLViewerParcelMgr needs to be changed so we either get an instance per region, or it handles various region sizes -//on a single grid properly - Patrick Sapinski (2/10/2011) -void LLViewerParcelMgr::init(F32 region_size) +//moved this stuff out of the constructor and into a function that we can call again after we get the region size. +//LLViewerParcelMgr needs to be changed so we either get an instance per region, or it handles various region sizes +//on a single grid properly - Patrick Sapinski (2/10/2011) +void LLViewerParcelMgr::init(F32 region_size) { mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; @@ -1365,7 +1365,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) return; } - S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; + //S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; S32 expected_size = 1024; if (packed_overlay_size != expected_size) { From 923c8d32ef209724fdd32c6dc13b37f98dfb3cb1 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 5 Aug 2011 14:53:11 +0200 Subject: [PATCH 09/10] Never pass an empty string as directory path to the filepicker. Should work around the problem as described in http://code.google.com/p/singularity-viewer/issues/detail?id=117 --- indra/newview/statemachine/aifilepicker.cpp | 29 ++++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/indra/newview/statemachine/aifilepicker.cpp b/indra/newview/statemachine/aifilepicker.cpp index fdfb5a968..19b3af0d4 100644 --- a/indra/newview/statemachine/aifilepicker.cpp +++ b/indra/newview/statemachine/aifilepicker.cpp @@ -82,7 +82,7 @@ std::string AIFilePicker::get_folder(std::string const& default_path, std::strin { AIAccess wContextMap(sContextMap); context_map_type::iterator iter = wContextMap->find(context); - if (iter != wContextMap->end()) + if (iter != wContextMap->end() && !iter->second.empty()) { return iter->second; } @@ -91,22 +91,37 @@ std::string AIFilePicker::get_folder(std::string const& default_path, std::strin LL_DEBUGS("Plugin") << "context \"" << context << "\" not found. Returning default_path \"" << default_path << "\"." << LL_ENDL; return default_path; } - else if ((iter = wContextMap->find("savefile")) != wContextMap->end()) + else if ((iter = wContextMap->find("savefile")) != wContextMap->end() && !iter->second.empty()) { LL_DEBUGS("Plugin") << "context \"" << context << "\" not found and default_path empty. Returning context \"savefile\": \"" << iter->second << "\"." << LL_ENDL; return iter->second; } else { - LL_DEBUGS("Plugin") << "context \"" << context << "\" not found, default_path empty and context \"savefile\" not found. Returning \"$HOME\"." << LL_ENDL; // This is the last resort when all else failed. Open the file chooser in directory 'home'. - char const* home = NULL; #if LL_WINDOWS - home = getenv("HOMEPATH"); + char const* envname = "HOMEPATH"; #else - home = getenv("HOME"); + char const* envname = "HOME"; #endif - return home ? home : ""; + char const* home = getenv(envname); + if (!home || home[0] == '\0') + { +#if LL_WINDOWS + // On windows, the filepicker window won't pop up at all if we pass an empty string. + home = "C:\\"; +#else + home = "/"; +#endif + LL_DEBUGS("Plugin") << "context \"" << context << "\" not found, default_path empty, context \"savefile\" not found " + "and environment variable \"$" << envname << "\" empty! Returning \"" << home << "\"." << LL_ENDL; + } + else + { + LL_DEBUGS("Plugin") << "context \"" << context << "\" not found, default_path empty and context \"savefile\" not found. " + "Returning environment variable \"$" << envname << "\" (" << home << ")." << LL_ENDL; + } + return home; } } From 05c132c3427ff383f51cdce2de92d0c4c1a25b6f Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Sun, 7 Aug 2011 19:29:57 +0200 Subject: [PATCH 10/10] Correct, complete user profile path on Windows --- indra/newview/statemachine/aifilepicker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/statemachine/aifilepicker.cpp b/indra/newview/statemachine/aifilepicker.cpp index 19b3af0d4..38cbf6996 100644 --- a/indra/newview/statemachine/aifilepicker.cpp +++ b/indra/newview/statemachine/aifilepicker.cpp @@ -100,7 +100,7 @@ std::string AIFilePicker::get_folder(std::string const& default_path, std::strin { // This is the last resort when all else failed. Open the file chooser in directory 'home'. #if LL_WINDOWS - char const* envname = "HOMEPATH"; + char const* envname = "USERPROFILE"; #else char const* envname = "HOME"; #endif