diff options
Diffstat (limited to 'indra/newview')
41 files changed, 920 insertions, 940 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 339a8f1ab0..f506765da3 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -293,12 +293,12 @@ U32 gFrameCount = 0; U32 gForegroundFrameCount = 0; // number of frames that app window was in foreground LLPumpIO* gServicePump = NULL; -LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime = 0; -LLUnitImplicit<F32, LLUnits::Seconds> gFrameTimeSeconds = 0.f; -LLUnitImplicit<F32, LLUnits::Seconds> gFrameIntervalSeconds = 0.f; +U64MicrosecondsImplicit gFrameTime = 0; +F32SecondsImplicit gFrameTimeSeconds = 0.f; +F32SecondsImplicit gFrameIntervalSeconds = 0.f; F32 gFPSClamped = 10.f; // Pretend we start at target rate. F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets -LLUnitImplicit<U64, LLUnits::Microseconds> gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds +U64MicrosecondsImplicit gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds U32 gFrameStalls = 0; const F64 FRAME_STALL_THRESHOLD = 1.0; @@ -1046,9 +1046,8 @@ bool LLAppViewer::init() // get RAM data from XML std::stringstream minRAMString(LLNotifications::instance().getGlobalString("UnsupportedRAMAmount")); - U64 minRAM = 0; + U64Bytes minRAM; minRAMString >> minRAM; - minRAM = minRAM * 1024 * 1024; if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) { @@ -1202,7 +1201,7 @@ void LLAppViewer::initMaxHeapSize() //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB. //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; - F32 max_heap_size_gb = gSavedSettings.getF32("MaxHeapSize") ; + F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; @@ -1464,7 +1463,7 @@ bool LLAppViewer::mainLoop() ms_sleep(500); } - const F64 max_idle_time = llmin(.005*10.0*gFrameTimeSeconds, LLUnitImplicit<F32, LLUnits::Seconds>(0.005f)); // 5 ms a second + const F64 max_idle_time = llmin(.005f*10.f*(F32MillisecondsImplicit)gFrameTimeSeconds, F32MillisecondsImplicit(5)); // 5 ms a second idleTimer.reset(); S32 total_work_pending = 0; S32 total_io_pending = 0; @@ -3138,8 +3137,7 @@ bool LLAppViewer::meetsRequirementsForMaximizedStart() { bool maximizedOk = (LLFeatureManager::getInstance()->getGPUClass() >= GPU_CLASS_2); - const U32 one_gigabyte_kb = 1024 * 1024; - maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= one_gigabyte_kb); + maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1)); return maximizedOk; } @@ -3330,7 +3328,7 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2(); gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value()); - gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kibibytes>()); + gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>()); gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); // The user is not logged on yet, but record the current grid choice login url diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 10452e64e2..6b16a96c11 100755 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -334,10 +334,10 @@ extern U32 gForegroundFrameCount; extern LLPumpIO* gServicePump; -extern LLUnitImplicit<U64, LLUnits::Microseconds> gStartTime; -extern LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime; // The timestamp of the most-recently-processed frame -extern LLUnitImplicit<F32, LLUnits::Seconds> gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... -extern LLUnitImplicit<F32, LLUnits::Seconds> gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds +extern U64MicrosecondsImplicit gStartTime; +extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame +extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... +extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame extern F32 gFrameDTClamped; extern U32 gFrameStalls; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 9311056a27..03b1f14a03 100755 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -35,7 +35,7 @@ #include <boost/foreach.hpp> #include "boost/lexical_cast.hpp" -const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec +const S32Days CONVERSATION_LIFETIME = (S32Days)30; // lifetime of LLConversation is 30 days by spec struct ConversationParams : public LLInitParam::Block<ConversationParams> { @@ -100,7 +100,7 @@ LLConversation::~LLConversation() void LLConversation::updateTimestamp() { - mTime = time_corrected(); + mTime = (U64Seconds)time_corrected(); mTimestamp = createTimestamp(mTime); } @@ -130,10 +130,10 @@ const std::string LLConversation::createTimestamp(const U64Seconds& utc_time) return timeStr; } -bool LLConversation::isOlderThan(U32 days) const +bool LLConversation::isOlderThan(U32Days days) const { U64Seconds now(time_corrected()); - LLUnit<U32, LLUnits::Days> age = now - mTime; + U32Days age = now - mTime; return age > days; } diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index fd6ad9ad66..b38d472156 100755 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -61,7 +61,7 @@ public: void setConversationName(std::string conv_name) { mConversationName = conv_name; } void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; } - bool isOlderThan(U32 days) const; + bool isOlderThan(U32Days days) const; /* * updates last interaction time diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 725a2f2daf..36cbd67333 100755 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1143,7 +1143,7 @@ void LLFastTimerView::drawLineGraph() } //interpolate towards new maximum - max_time = lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); + max_time = (F32Seconds)lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); if (llabs((max_time - cur_max).value()) <= 1) { max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max)); @@ -1439,7 +1439,7 @@ void LLFastTimerView::drawBars() bar_height -= vpad; updateTotalTime(); - if (mTotalTimeDisplay <= 0.0) return; + if (mTotalTimeDisplay <= (F32Seconds)0.0) return; drawTicks(); const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); @@ -1550,7 +1550,7 @@ S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::TimeBlock* time_block, Timer if (timer_bar_index == 0) { - timer_bar.mSelfStart = 0.f; + timer_bar.mSelfStart = F32Seconds(0.f); timer_bar.mSelfEnd = bar_time; } @@ -1583,7 +1583,7 @@ S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::TimeBlock* time_block, Timer } child_timer_bar.mStartFraction = bar_fraction_start; - child_timer_bar.mEndFraction = bar_time > 0 + child_timer_bar.mEndFraction = bar_time > (S32Seconds)0 ? bar_fraction_start + child_timer_bar.mTotalTime / bar_time : 1.f; child_timer_bar.mSelfStart = timer_bar.mChildrenStart diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 01596f0b4b..333e8ee67e 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -867,7 +867,7 @@ void LLFeatureManager::applyBaseMasks() maskFeatures(gpustr); // now mask cpu type ones - if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024) + if (gSysMemory.getPhysicalMemoryClamped() <= U32Megabytes(256)) { maskFeatures("RAM256MB"); } diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index ad94949863..7f81d40ebb 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -259,7 +259,7 @@ LLSD LLFloaterAbout::getInfo() // CPU info["CPU"] = gSysCPU.getCPUString(); - info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Mibibytes>()); + info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>()); // Moved hack adjustment to Windows memory size into llsys.cpp info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString(); info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR)); diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index adb490d524..9efdf9d10e 100755 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -89,8 +89,8 @@ void LLFloaterHardwareSettings::refresh() void LLFloaterHardwareSettings::refreshEnabledState() { - S32Mibibytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32Mibibytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(); getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index ecee801e8e..7fafabb493 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -471,7 +471,8 @@ void LLSceneMonitor::fetchQueryResult() LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); // also throttle timing here, to avoid going below sample time due to phasing with frame capture - static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime"); + F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control(); if(mDiffState == WAIT_ON_RESULT && !LLAppViewer::instance()->quitRequested()) @@ -491,7 +492,7 @@ void LLSceneMonitor::fetchQueryResult() record(sFramePixelDiff, mDiffResult); static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); - F32 elapsed_time = mRecordingTimer.getElapsedTimeF32(); + F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32(); if (elapsed_time > scene_load_sample_time) { @@ -649,7 +650,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits<LLUnits::Kibibytes>(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits<LLUnits::Kilobytes>(); } os << '\n'; diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index f94232e536..c99ec1e824 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -62,7 +62,7 @@ public: const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;} void dumpToFile(std::string file_name); - bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != 0;} + bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != S32Seconds(0);} private: void freezeScene(); diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 55afc3e454..2d06b8599c 100755 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -43,7 +43,7 @@ #include "noise.h" extern bool gShiftFrame; -extern LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime; +extern U64MicrosecondsImplicit gFrameTime; extern LLPipeline gPipeline; LLSurfacePatch::LLSurfacePatch() diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 07ff1de702..8d63ebdffc 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -946,7 +946,7 @@ LLTextureFetchWorker::~LLTextureFetchWorker() mHttpBufferArray = NULL; } unlockWorkMutex(); // -Mw - mFetcher->removeFromHTTPQueue(mID, 0); + mFetcher->removeFromHTTPQueue(mID, (S32Bytes)0); mFetcher->removeHttpWaiter(mID); mFetcher->updateStateStats(mCacheReadCount, mCacheWriteCount, mResourceWaitCount); } @@ -1483,7 +1483,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mGetReason.clear(); LL_DEBUGS("Texture") << "HTTP GET: " << mID << " Offset: " << mRequestedOffset << " Bytes: " << mRequestedSize - << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth().value() << "/" << mFetcher->mMaxBandwidth + << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth << LL_ENDL; // Will call callbackHttpGet when curl request completes @@ -1931,7 +1931,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe partial = (par_status == status); } - S32 data_size = callbackHttpGet(response, partial, success); + S32BytesImplicit data_size = callbackHttpGet(response, partial, success); if (log_texture_traffic && data_size > 0) { @@ -2352,7 +2352,7 @@ void LLTextureFetchWorker::recordTextureDone(bool is_http) is_http, LLImageBase::TYPE_AVATAR_BAKE == mType, LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime); - mMetricsStartTime = 0; + mMetricsStartTime = (U32Seconds)0; } LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, is_http, @@ -2607,11 +2607,11 @@ void LLTextureFetch::addToHTTPQueue(const LLUUID& id) } // -Mfnq // Threads: T* -void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32 received_size) +void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size) { LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq mHTTPTextureQueue.erase(id); - mHTTPTextureBits += received_size * 8; // Approximate - does not include header bits + mHTTPTextureBits += received_size; // Approximate - does not include header bits } // -Mfnq // NB: If you change deleteRequest() you should probably make @@ -2762,7 +2762,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, raw = worker->mRawImage; aux = worker->mAuxImage; F32Seconds cache_read_time(worker->mCacheReadTime); - if (cache_read_time != 0.f) + if (cache_read_time != (F32Seconds)0.f) { record(sCacheReadLatency, cache_read_time); } @@ -2888,10 +2888,10 @@ S32 LLTextureFetch::update(F32 max_time_ms) { mNetworkQueueMutex.lock(); // +Mfnq - mMaxBandwidth = band_width; + mMaxBandwidth = band_width(); add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits); - mHTTPTextureBits = 0; + mHTTPTextureBits = (U32Bits)0; mNetworkQueueMutex.unlock(); // -Mfnq } diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 78b13cdd80..81c505679e 100755 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -107,10 +107,10 @@ public: bool receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data); // Threads: T* (but not safe) - void setTextureBandwidth(F32Kibibits bandwidth) { mTextureBandwidth = bandwidth; } + void setTextureBandwidth(F32 bandwidth) { mTextureBandwidth = bandwidth; } // Threads: T* (but not safe) - F32Kibibits getTextureBandwidth() { return mTextureBandwidth; } + F32 getTextureBandwidth() { return mTextureBandwidth; } // Threads: T* BOOL isFromLocalCache(const LLUUID& id); @@ -234,7 +234,7 @@ protected: // XXX possible delete // Threads: T* - void removeFromHTTPQueue(const LLUUID& id, S32 received_size); + void removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size); // Identical to @deleteRequest but with different arguments // (caller already has the worker pointer). @@ -325,8 +325,8 @@ private: queue_t mHTTPTextureQueue; // Mfnq typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t; cancel_queue_t mCancelQueue; // Mfnq - F32Kibibits mTextureBandwidth; // <none> - F32Kibibits mMaxBandwidth; // Mfnq + F32 mTextureBandwidth; // <none> + F32 mMaxBandwidth; // Mfnq LLTextureInfo mTextureInfo; // XXX possible delete diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index 6906f82c1c..59d692b287 100755 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -40,7 +40,7 @@ LLTextureInfo::LLTextureInfo() : mLogTextureDownloadsToViewerLog(false), mLogTextureDownloadsToSimulator(false), mTextureDownloadProtocol("NONE"), - mTextureLogThreshold(LLUnits::Kibibytes::fromValue(100)) + mTextureLogThreshold(LLUnits::Kilobytes::fromValue(100)) { mTextures.clear(); mRecording.start(); @@ -95,7 +95,7 @@ void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime) { addRequest(id); } - mTextures[id]->mStartTime = startTime; + mTextures[id]->mStartTime = (U64Microseconds)startTime; add(sTextureDownloadsStarted, 1); } @@ -105,7 +105,7 @@ void LLTextureInfo::setRequestSize(const LLUUID& id, U32 size) { addRequest(id); } - mTextures[id]->mSize = size; + mTextures[id]->mSize = (U32Bytes)size; } void LLTextureInfo::setRequestOffset(const LLUUID& id, U32 offset) @@ -194,7 +194,7 @@ LLSD LLTextureInfo::getAverages() LLSD averagedTextureData; S32 averageDownloadRate; U32Milliseconds download_time = mRecording.getSum(sTexureDownloadTime); - if(download_time == 0) + if(download_time == (U32Milliseconds)0) { averageDownloadRate = 0; } diff --git a/indra/newview/lltextureinfodetails.h b/indra/newview/lltextureinfodetails.h index 0ad95eb94e..7cba87e5a8 100755 --- a/indra/newview/lltextureinfodetails.h +++ b/indra/newview/lltextureinfodetails.h @@ -40,10 +40,10 @@ struct LLTextureInfoDetails }; U32Microseconds mStartTime, - mCompleteTime; - U32 mOffset; - U32Bytes mSize; - LLRequestType mType; + mCompleteTime; + U32 mOffset; + U32Bytes mSize; + LLRequestType mType; LLTextureInfoDetails(); }; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index f39d41c2b8..3974668d09 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -350,7 +350,7 @@ void LLTextureBar::draw() // draw the image size at the end { std::string num_str = llformat("%3dx%3d (%2d) %7d", mImagep->getWidth(), mImagep->getHeight(), - mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0); + mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory().value() : 0); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color, LLFontGL::LEFT, LLFontGL::TOP); } @@ -507,13 +507,13 @@ private: void LLGLTexMemBar::draw() { - S32Mibibytes bound_mem = LLViewerTexture::sBoundTextureMemory; - S32Mibibytes max_bound_mem = LLViewerTexture::sMaxBoundTextureMem; - S32Mibibytes total_mem = LLViewerTexture::sTotalTextureMemory; - S32Mibibytes max_total_mem = LLViewerTexture::sMaxTotalTextureMem; + S32Megabytes bound_mem = LLViewerTexture::sBoundTextureMemory; + S32Megabytes max_bound_mem = LLViewerTexture::sMaxBoundTextureMem; + S32Megabytes total_mem = LLViewerTexture::sTotalTextureMemory; + S32Megabytes max_total_mem = LLViewerTexture::sMaxTotalTextureMem; F32 discard_bias = LLViewerTexture::sDesiredDiscardBias; - F32 cache_usage = (F32)F32Mibibytes(LLAppViewer::getTextureCache()->getUsage()).value() ; - F32 cache_max_usage = (F32)F32Mibibytes(LLAppViewer::getTextureCache()->getMaxUsage()).value() ; + F32 cache_usage = (F32)F32Megabytes(LLAppViewer::getTextureCache()->getUsage()).value() ; + F32 cache_max_usage = (F32)F32Megabytes(LLAppViewer::getTextureCache()->getMaxUsage()).value() ; S32 line_height = LLFontGL::getFontMonospace()->getLineHeight(); S32 v_offset = 0;//(S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f); F32Bytes total_texture_downloaded = gTotalTextureData; @@ -586,8 +586,8 @@ void LLGLTexMemBar::draw() left = 550; - F32Kibibits bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); - F32Kibibits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS")); + F32Kilobits bandwidth(LLAppViewer::getTextureFetch()->getTextureBandwidth()); + F32Kilobits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS")); color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; color[VALPHA] = text_color[VALPHA]; text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value()); @@ -793,7 +793,7 @@ void LLTextureView::draw() if (mPrintList) { - S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ; + S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory().value() : 0 ; LL_INFOS() << imagep->getID() << "\t" << tex_mem << "\t" << imagep->getBoostLevel() diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index df65a637b7..5fb99ce02f 100755 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -77,7 +77,7 @@ protected: LLViewerAssetStatsFF::record_response(mType, false, false, (LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime)); - mMetricsStartTime = 0; + mMetricsStartTime = (U32Seconds)0; } } @@ -113,7 +113,7 @@ void LLViewerAssetStorage::storeAssetData( bool is_priority, bool store_local, bool user_waiting, - F64 timeout) + F64Seconds timeout) { LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) @@ -237,7 +237,7 @@ void LLViewerAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool user_waiting, - F64 timeout) + F64Seconds timeout) { if(filename.empty()) { diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index ca9b9943fa..6baec647e6 100755 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -51,7 +51,7 @@ public: bool is_priority = false, bool store_local = false, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( const std::string& filename, @@ -62,7 +62,7 @@ public: bool temp_file = false, bool is_priority = false, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); protected: using LLAssetStorage::_queueDataRequest; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index d0491450dc..95419c7cf3 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -287,7 +287,7 @@ static bool handleMaxPartCountChanged(const LLSD& newvalue) static bool handleVideoMemoryChanged(const LLSD& newvalue) { - gTextureList.updateMaxResidentTexMem(S32Mibibytes(newvalue.asInteger())); + gTextureList.updateMaxResidentTexMem(S32Megabytes(newvalue.asInteger())); return true; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index cb5078b988..d2a702049a 100755 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -220,8 +220,8 @@ void display_stats() F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency"); if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq) { - gMemoryAllocated = LLMemory::getCurrentRSS(); - U32Mibibytes memory = gMemoryAllocated; + gMemoryAllocated = (U64Bytes)LLMemory::getCurrentRSS(); + U32Megabytes memory = gMemoryAllocated; LL_INFOS() << llformat("MEMORY: %d MB", memory.value()) << LL_ENDL; LLMemory::logMemoryInfo(TRUE) ; gRecentMemoryTime.reset(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6c435bf147..cbc895390c 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -401,11 +401,11 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) LLVLData *vl_datap = new LLVLData(regionp, type, datap, size); if (mesgsys->getReceiveCompressedSize()) { - gVLManager.addLayerData(vl_datap, mesgsys->getReceiveCompressedSize()); + gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveCompressedSize()); } else { - gVLManager.addLayerData(vl_datap, mesgsys->getReceiveSize()); + gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveSize()); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index b054e519e0..8092eda7b2 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2417,14 +2417,14 @@ void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) if (!mStatic && sVelocityInterpolate && !isSelected()) { // calculate dt from last update - F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); + F32 dt_raw = ((F64Seconds)time - mLastInterpUpdateSecs).value(); F32 dt = mTimeDilation * dt_raw; applyAngularVelocity(dt); if (isAttachment()) { - mLastInterpUpdateSecs = time; + mLastInterpUpdateSecs = (F64Seconds)time; return; } else @@ -2438,8 +2438,8 @@ void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } -// Move an object due to idle-time viewer side updates by iterpolating motion -void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) +// Move an object due to idle-time viewer side updates by interpolating motion +void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& time, const F32SecondsImplicit& dt) { // linear motion // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object @@ -2450,8 +2450,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) // to see if object is selected, instead of explicitly // zeroing it out - F64 time_since_last_update = time - mLastMessageUpdateSecs; - if (time_since_last_update <= 0.0 || dt <= 0.f) + F64Seconds time_since_last_update = time - mLastMessageUpdateSecs; + if (time_since_last_update <= (F64Seconds)0.0 || dt <= (F32Seconds)0.f) { return; } @@ -2459,11 +2459,11 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 accel = getAcceleration(); LLVector3 vel = getVelocity(); - if (sMaxUpdateInterpolationTime <= 0.0) + if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0) { // Old code path ... unbounded, simple interpolation if (!(accel.isExactlyZero() && vel.isExactlyZero())) { - LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; + LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt.value(); // region local setPositionRegion(pos + getPositionRegion()); @@ -2477,12 +2477,12 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) { // Object is moving, and hasn't been too long since we got an update from the server // Calculate predicted position and velocity - LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; + LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt.value(); LLVector3 new_v = accel * dt; if (time_since_last_update > sPhaseOutUpdateInterpolationTime && - sPhaseOutUpdateInterpolationTime > 0.0) - { // Haven't seen a viewer update in a while, check to see if the ciruit is still active + sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0) + { // Haven't seen a viewer update in a while, check to see if the circuit is still active if (mRegionp) { // The simulator will NOT send updates if the object continues normally on the path // predicted by the velocity and the acceleration (often gravity) sent to the viewer @@ -2498,7 +2498,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) (time_since_last_packet > sPhaseOutUpdateInterpolationTime)) { // Start to reduce motion interpolation since we haven't seen a server update in a while - F64 time_since_last_interpolation = time - mLastInterpUpdateSecs; + F64Seconds time_since_last_interpolation = time - mLastInterpUpdateSecs; F64 phase_out = 1.0; if (time_since_last_update > sMaxUpdateInterpolationTime) { // Past the time limit, so stop the object diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 3943709049..24dff45ae8 100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -580,7 +580,7 @@ private: U32 checkMediaURL(const std::string &media_url); // Motion prediction between updates - void interpolateLinearMotion(const F64 & time, const F32 & dt); + void interpolateLinearMotion(const F64SecondsImplicit & time, const F32SecondsImplicit & dt); static void initObjectDataMap(); @@ -707,8 +707,8 @@ protected: child_list_t mChildList; - F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation - F64 mLastMessageUpdateSecs; // Last update from a message from the simulator + F64Seconds mLastInterpUpdateSecs; // Last update for purposes of interpolation + F64Seconds mLastMessageUpdateSecs; // Last update from a message from the simulator TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator // extra data sent from the sim...currently only used for tree species info @@ -781,7 +781,7 @@ protected: mutable LLVector3 mPositionAgent; static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; } - static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64) value; } + static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; } static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; } static void setPingInterpolate(BOOL value) { sPingInterpolate = value; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24c56df8db..61a0ed098a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -428,14 +428,14 @@ void LLViewerRegion::initStats() { mImpl->mLastNetUpdate.reset(); mPacketsIn = 0; - mBitsIn = 0; - mLastBitsIn = 0; + mBitsIn = (U32Bits)0; + mLastBitsIn = (U32Bits)0; mLastPacketsIn = 0; mPacketsOut = 0; mLastPacketsOut = 0; mPacketsLost = 0; mLastPacketsLost = 0; - mPingDelay = 0; + mPingDelay = (U32Seconds)0; mAlive = false; // can become false if circuit disconnects } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index bb2c13df33..f300983f19 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -95,7 +95,7 @@ LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat"); -LLTrace::CountStatHandle<F64Kibibytes > +LLTrace::CountStatHandle<F64Kilobytes > ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"), LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"), OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"), @@ -156,7 +156,7 @@ LLTrace::SampleStatHandle<F64Megabytes > GL_TEX_MEM("gltexmemstat"), GL_BOUND_MEM("glboundmemstat"), RAW_MEM("rawmemstat"), FORMATTED_MEM("formattedmemstat"); -LLTrace::SampleStatHandle<F64Kibibytes > DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), +LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting"); @@ -221,7 +221,7 @@ void LLViewerStats::resetStats() void LLViewerStats::updateFrameStats(const F64Seconds time_diff) { - if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > 5.0) + if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > F32Percent(5.0)) { add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff); } @@ -239,20 +239,20 @@ void LLViewerStats::updateFrameStats(const F64Seconds time_diff) add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff); } - if (time_diff >= 0.5) + if (time_diff >= (F64Seconds)0.5) { record(LLStatViewer::FPS_2_TIME, time_diff); } - if (time_diff >= 0.125) + if (time_diff >= (F64Seconds)0.125) { record(LLStatViewer::FPS_8_TIME, time_diff); } - if (time_diff >= 0.1) + if (time_diff >= (F64Seconds)0.1) { record(LLStatViewer::FPS_10_TIME, time_diff); } - if (gFrameCount && mLastTimeDiff > 0.0) + if (gFrameCount && mLastTimeDiff > (F64Seconds)0.0) { // new "stutter" meter add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0); @@ -260,7 +260,7 @@ void LLViewerStats::updateFrameStats(const F64Seconds time_diff) // old stats that were never really used sample(LLStatViewer::FRAMETIME_JITTER, F64Milliseconds (mLastTimeDiff - time_diff)); - F32 average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount; + F32Seconds average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount; sample(LLStatViewer::FRAMETIME_SLEW, F64Milliseconds (average_frametime - time_diff)); F32 max_bandwidth = gViewerThrottle.getMaxBandwidth(); @@ -359,7 +359,7 @@ void update_statistics() if (cdp) { sample(LLStatViewer::SIM_PING, F64Milliseconds (cdp->getPingDelay())); - gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay().value())) / ((F32)gSimPingCount + 1); + gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1); gSimPingCount++; } else @@ -373,8 +373,8 @@ void update_statistics() } add(LLStatViewer::FPS, 1); - F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); - add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, F64Bits(layer_bits)); + F64Bits layer_bits = gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits(); + add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, layer_bits); add(LLStatViewer::OBJECT_NETWORK_DATA_RECEIVED, gObjectData); sample(LLStatViewer::PENDING_VFS_OPERATIONS, LLVFile::getVFSThread()->getPending()); add(LLStatViewer::ASSET_UDP_DATA_RECEIVED, F64Bits(gTransferManager.getTransferBitsIn(LLTCT_ASSET))); @@ -395,7 +395,7 @@ void update_statistics() // Reset all of these values. gVLManager.resetBitCounts(); - gObjectData = 0; + gObjectData = (U32Bytes)0; // gDecodedBits = 0; // Only update texture stats periodically so that they are less noisy @@ -553,9 +553,9 @@ void send_stats() LLSD &download = body["downloads"]; - download["world_kbytes"] = F64Kibibytes(gTotalWorldData).value(); - download["object_kbytes"] = F64Kibibytes(gTotalObjectData).value(); - download["texture_kbytes"] = F64Kibibytes(gTotalTextureData).value(); + download["world_kbytes"] = F64Kilobytes(gTotalWorldData).value(); + download["object_kbytes"] = F64Kilobytes(gTotalObjectData).value(); + download["texture_kbytes"] = F64Kilobytes(gTotalTextureData).value(); download["mesh_kbytes"] = LLMeshRepository::sBytesReceived/1024.0; LLSD &in = body["stats"]["net"]["in"]; diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 42c56e8835..0d959ed034 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -142,7 +142,7 @@ extern LLTrace::CountStatHandle<> FPS, extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN; -extern LLTrace::CountStatHandle<F64Kibibytes > ACTIVE_MESSAGE_DATA_RECEIVED, +extern LLTrace::CountStatHandle<F64Kilobytes > ACTIVE_MESSAGE_DATA_RECEIVED, LAYERS_NETWORK_DATA_RECEIVED, OBJECT_NETWORK_DATA_RECEIVED, ASSET_UDP_DATA_RECEIVED, @@ -196,7 +196,7 @@ extern LLTrace::SampleStatHandle<F64Megabytes > GL_TEX_MEM, GL_BOUND_MEM, RAW_MEM, FORMATTED_MEM; -extern LLTrace::SampleStatHandle<F64Kibibytes > DELTA_BANDWIDTH, +extern LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH, MAX_BANDWIDTH; extern SimMeasurement<F64Milliseconds > SIM_FRAME_TIME, SIM_NET_TIME, diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 4290d338c1..6bda1499d0 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -63,8 +63,8 @@ /////////////////////////////////////////////////////////////////////////////// // extern -const S32Mibibytes gMinVideoRam(32); -const S32Mibibytes gMaxVideoRam(512); +const S32Megabytes gMinVideoRam(32); +const S32Megabytes gMaxVideoRam(512); // statics @@ -76,8 +76,8 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sWhiteImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sFlatNormalImagep = NULL; -LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ; -LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ; +LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap; +LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL; const std::string sTesterName("TextureTester"); S32 LLViewerTexture::sImageCount = 0; @@ -88,19 +88,19 @@ F32 LLViewerTexture::sDesiredDiscardBias = 0.f; F32 LLViewerTexture::sDesiredDiscardScale = 1.1f; S32Bytes LLViewerTexture::sBoundTextureMemory; S32Bytes LLViewerTexture::sTotalTextureMemory; -S32Mibibytes LLViewerTexture::sMaxBoundTextureMem; -S32Mibibytes LLViewerTexture::sMaxTotalTextureMem; +S32Megabytes LLViewerTexture::sMaxBoundTextureMem; +S32Megabytes LLViewerTexture::sMaxTotalTextureMem; S32Bytes LLViewerTexture::sMaxDesiredTextureMem; -S8 LLViewerTexture::sCameraMovingDiscardBias = 0 ; -F32 LLViewerTexture::sCameraMovingBias = 0.0f ; -S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size -const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64 ; -const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez ; -const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128 ; -S32 LLViewerTexture::sMinLargeImageSize = 65536 ; //256 * 256. -S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA ; -BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE ; -F32 LLViewerTexture::sCurrentTime = 0.0f ; +S8 LLViewerTexture::sCameraMovingDiscardBias = 0; +F32 LLViewerTexture::sCameraMovingBias = 0.0f; +S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size +const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; +const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez; +const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128; +S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. +S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; +BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE; +F32 LLViewerTexture::sCurrentTime = 0.0f; F32 LLViewerTexture::sTexelPixelRatio = 1.0f; LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF; @@ -142,7 +142,7 @@ void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex) { if(mSourceCallbackList) { - mSourceCallbackList->erase(tex->getID()) ; + mSourceCallbackList->erase(tex->getID()); } } @@ -155,33 +155,33 @@ void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_ca for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin(); iter != callback_list->end(); ++iter) { - LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ; + LLViewerFetchedTexture* tex = gTextureList.findImage(*iter); if(tex) { - tex->deleteCallbackEntry(callback_list) ; + tex->deleteCallbackEntry(callback_list); } } - callback_list->clear() ; + callback_list->clear(); } } LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image) { - return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ; + return new LLViewerMediaTexture(media_id, usemipmaps, gl_image); } LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id) { - LLViewerTexture* tex ; + LLViewerTexture* tex; //search fetched texture list - tex = gTextureList.findImage(id) ; + tex = gTextureList.findImage(id); //search media texture list if(!tex) { - tex = LLViewerTextureManager::findMediaTexture(id) ; + tex = LLViewerTextureManager::findMediaTexture(id); } - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id) @@ -191,78 +191,78 @@ LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &media_id) { - return LLViewerMediaTexture::findMediaTexture(media_id) ; + return LLViewerMediaTexture::findMediaTexture(media_id); } LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image) { - LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id) ; + LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id); if(!tex) { - tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image) ; + tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image); } - tex->initVirtualSize() ; + tex->initVirtualSize(); - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error) { if(!tex) { - return NULL ; + return NULL; } - S8 type = tex->getType() ; + S8 type = tex->getType(); if(type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE) { - return static_cast<LLViewerFetchedTexture*>(tex) ; + return static_cast<LLViewerFetchedTexture*>(tex); } if(report_error) { - LL_ERRS() << "not a fetched texture type: " << type << LL_ENDL ; + LL_ERRS() << "not a fetched texture type: " << type << LL_ENDL; } - return NULL ; + return NULL; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps) ; - tex->setCategory(LLGLTexture::LOCAL) ; - return tex ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps); + tex->setCategory(LLGLTexture::LOCAL); + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( @@ -275,7 +275,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( LLGLenum primary_format, LLHost request_from_host) { - return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; + return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host); } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( @@ -288,7 +288,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( LLGLenum primary_format, const LLUUID& force_id) { - return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } //static @@ -302,12 +302,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s const LLUUID& force_id ) { - return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) { - return gTextureList.getImageFromHost(image_id, f_type, host) ; + return gTextureList.getImageFromHost(image_id, f_type, host); } // Create a bridge to the viewer texture manager. @@ -335,15 +335,15 @@ void LLViewerTextureManager::init() { LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3); raw->clear(0x77, 0x77, 0x77, 0xFF); - LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE) ; + LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE); } const S32 dim = 128; LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3); U8* data = image_raw->getData(); - memset(data, 0, dim * dim * 3) ; - LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ; + memset(data, 0, dim * dim * 3); + LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); #if 1 LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT); @@ -372,16 +372,16 @@ void LLViewerTextureManager::init() } imagep->createGLTexture(0, image_raw); //cache the raw image - imagep->setCachedRawImage(0, image_raw) ; + imagep->setCachedRawImage(0, image_raw); image_raw = NULL; #else LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); #endif LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); - LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; + LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER); LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ; + LLViewerFetchedTexture::sSmokeImagep->setNoDelete(); image_raw = new LLImageRaw(32,32,3); data = image_raw->getData(); @@ -398,14 +398,14 @@ void LLViewerTextureManager::init() LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); - LLViewerTexture::initClass() ; + LLViewerTexture::initClass(); // Create a texture manager bridge. gTextureManagerBridgep = new LLViewerTextureManagerBridge; if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) { - sTesterp = new LLTexturePipelineTester() ; + sTesterp = new LLTexturePipelineTester(); if (!sTesterp->isValid()) { delete sTesterp; @@ -419,7 +419,7 @@ void LLViewerTextureManager::cleanup() stop_glerror(); delete gTextureManagerBridgep; - LLImageGL::sDefaultGLTexture = NULL ; + LLImageGL::sDefaultGLTexture = NULL; LLViewerTexture::sNullImagep = NULL; LLViewerTexture::sBlackImagep = NULL; LLViewerTexture::sCheckerBoardImagep = NULL; @@ -429,7 +429,7 @@ void LLViewerTextureManager::cleanup() LLViewerFetchedTexture::sWhiteImagep = NULL; LLViewerFetchedTexture::sFlatNormalImagep = NULL; - LLViewerMediaTexture::cleanUpClass() ; + LLViewerMediaTexture::cleanUpClass(); } //---------------------------------------------------------------------------------------------- @@ -439,7 +439,7 @@ void LLViewerTextureManager::cleanup() // static void LLViewerTexture::initClass() { - LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture() ; + LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture(); if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) { @@ -460,37 +460,37 @@ static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check"); //static bool LLViewerTexture::isMemoryForTextureLow() { - const F32 WAIT_TIME = 1.0f ; //second - static LLFrameTimer timer ; + const F32 WAIT_TIME = 1.0f; //second + static LLFrameTimer timer; if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second. { return false; } - timer.reset() ; + timer.reset(); LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK); - const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB - const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB + const S32Megabytes MIN_FREE_TEXTURE_MEMORY(5); //MB + const S32Megabytes MIN_FREE_MAIN_MEMORY(100); //MB - bool low_mem = false ; + bool low_mem = false; if (gGLManager.mHasATIMemInfo) { S32 meminfo[4]; glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo); - if(meminfo[0] / 1024 < MIN_FREE_TEXTURE_MEMORY) + if((S32Megabytes)meminfo[0] < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } if(!low_mem) //check main memory, only works for windows. { - LLMemory::updateMemoryInfo() ; - if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) + LLMemory::updateMemoryInfo(); + if(LLMemory::getAvailableMemKB() < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } } } @@ -502,12 +502,12 @@ bool LLViewerTexture::isMemoryForTextureLow() if(free_memory / 1024 < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } } #endif - return low_mem ; + return low_mem; } static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_MEDIA("Media"); @@ -516,31 +516,31 @@ static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_TEST("Test"); //static void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity) { - sCurrentTime = gFrameTimeSeconds ; + sCurrentTime = gFrameTimeSeconds; LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { LLFastTimer t(FTM_TEXTURE_UPDATE_TEST); - tester->update() ; + tester->update(); } { LLFastTimer t(FTM_TEXTURE_UPDATE_MEDIA); - LLViewerMediaTexture::updateClass() ; + LLViewerMediaTexture::updateClass(); } sBoundTextureMemory = LLImageGL::sBoundTextureMemory; sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; sMaxBoundTextureMem = gTextureList.getMaxResidentTexMem(); sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem(); - sMaxDesiredTextureMem = sMaxTotalTextureMem ; //in Bytes, by default and when total used texture memory is small. + sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small. if (sBoundTextureMemory >= sMaxBoundTextureMem || sTotalTextureMemory >= sMaxTotalTextureMem) { //when texture memory overflows, lower down the threshold to release the textures more aggressively. - sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, S32Bytes(gMaxVideoRam)); + sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam)); // If we are using more texture memory than we should, // scale up the desired discard level @@ -569,13 +569,13 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity } sDesiredDiscardBias = llclamp(sDesiredDiscardBias, desired_discard_bias_min, desired_discard_bias_max); - F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ; + F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed(); F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed(); sCameraMovingBias = llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1); sCameraMovingDiscardBias = (S8)(sCameraMovingBias); LLViewerTexture::sFreezeImageScalingDown = (sBoundTextureMemory < 0.75f * sMaxBoundTextureMem * texmem_middle_bound_scale) && - (sTotalTextureMemory < 0.75f * sMaxTotalTextureMem * texmem_middle_bound_scale) ; + (sTotalTextureMemory < 0.75f * sMaxTotalTextureMem * texmem_middle_bound_scale); } //end of static functions @@ -631,31 +631,31 @@ void LLViewerTexture::init(bool firstinit) mSelectedTime = 0.f; mMaxVirtualSize = 0.f; mMaxVirtualSizeResetInterval = 1; - mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval ; - mAdditionalDecodePriority = 0.f ; - mParcelMedia = NULL ; + mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval; + mAdditionalDecodePriority = 0.f; + mParcelMedia = NULL; mNumVolumes = 0; - mFaceList[LLRender::DIFFUSE_MAP].clear() ; - mFaceList[LLRender::NORMAL_MAP].clear() ; - mFaceList[LLRender::SPECULAR_MAP].clear() ; + mFaceList[LLRender::DIFFUSE_MAP].clear(); + mFaceList[LLRender::NORMAL_MAP].clear(); + mFaceList[LLRender::SPECULAR_MAP].clear(); mNumFaces[LLRender::DIFFUSE_MAP] = mNumFaces[LLRender::NORMAL_MAP] = - mNumFaces[LLRender::SPECULAR_MAP] = 0 ; + mNumFaces[LLRender::SPECULAR_MAP] = 0; mVolumeList.clear(); } //virtual S8 LLViewerTexture::getType() const { - return LLViewerTexture::LOCAL_TEXTURE ; + return LLViewerTexture::LOCAL_TEXTURE; } void LLViewerTexture::cleanup() { - mFaceList[LLRender::DIFFUSE_MAP].clear() ; - mFaceList[LLRender::NORMAL_MAP].clear() ; - mFaceList[LLRender::SPECULAR_MAP].clear() ; + mFaceList[LLRender::DIFFUSE_MAP].clear(); + mFaceList[LLRender::NORMAL_MAP].clear(); + mFaceList[LLRender::SPECULAR_MAP].clear(); mVolumeList.clear(); } @@ -673,11 +673,11 @@ void LLViewerTexture::setBoostLevel(S32 level) { if(mBoostLevel != level) { - mBoostLevel = level ; + mBoostLevel = level; if(mBoostLevel != LLViewerTexture::BOOST_NONE && mBoostLevel != LLViewerTexture::BOOST_SELECTED) { - setNoDelete() ; + setNoDelete(); } } @@ -732,12 +732,12 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) stop_glerror(); //check if there is cached raw image and switch to it if possible - switchToCachedImage() ; + switchToCachedImage(); LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->updateGrayTextureBinding() ; + tester->updateGrayTextureBinding(); } return res; } @@ -757,17 +757,17 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co { if(needs_gltexture) { - mNeedsGLTexture = TRUE ; + mNeedsGLTexture = TRUE; } virtual_size *= sTexelPixelRatio; if(!mMaxVirtualSizeResetCounter) { //flag to reset the values because the old values are used. - resetMaxVirtualSizeResetCounter() ; + resetMaxVirtualSizeResetCounter(); mMaxVirtualSize = virtual_size; - mAdditionalDecodePriority = 0.f ; - mNeedsGLTexture = needs_gltexture ; + mAdditionalDecodePriority = 0.f; + mNeedsGLTexture = needs_gltexture; } else if (virtual_size > mMaxVirtualSize) { @@ -777,15 +777,15 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co void LLViewerTexture::resetTextureStats() { - mMaxVirtualSize = 0.0f ; - mAdditionalDecodePriority = 0.f ; - mMaxVirtualSizeResetCounter = 0 ; + mMaxVirtualSize = 0.0f; + mAdditionalDecodePriority = 0.f; + mMaxVirtualSizeResetCounter = 0; } //virtual F32 LLViewerTexture::getMaxVirtualSize() { - return mMaxVirtualSize ; + return mMaxVirtualSize; } //virtual @@ -801,12 +801,12 @@ void LLViewerTexture::addFace(U32 ch, LLFace* facep) if(mNumFaces[ch] >= mFaceList[ch].size()) { - mFaceList[ch].resize(2 * mNumFaces[ch] + 1) ; + mFaceList[ch].resize(2 * mNumFaces[ch] + 1); } - mFaceList[ch][mNumFaces[ch]] = facep ; - facep->setIndexInTex(ch, mNumFaces[ch]) ; - mNumFaces[ch]++ ; - mLastFaceListUpdateTimer.reset() ; + mFaceList[ch][mNumFaces[ch]] = facep; + facep->setIndexInTex(ch, mNumFaces[ch]); + mNumFaces[ch]++; + mLastFaceListUpdateTimer.reset(); } //virtual @@ -816,18 +816,18 @@ void LLViewerTexture::removeFace(U32 ch, LLFace* facep) if(mNumFaces[ch] > 1) { - S32 index = facep->getIndexInTex(ch) ; + S32 index = facep->getIndexInTex(ch); llassert(index < mFaceList[ch].size()); llassert(index < mNumFaces[ch]); - mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]] ; - mFaceList[ch][index]->setIndexInTex(ch, index) ; + mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]]; + mFaceList[ch][index]->setIndexInTex(ch, index); } else { - mFaceList[ch].clear() ; - mNumFaces[ch] = 0 ; + mFaceList[ch].clear(); + mNumFaces[ch] = 0; } - mLastFaceListUpdateTimer.reset() ; + mLastFaceListUpdateTimer.reset(); } S32 LLViewerTexture::getTotalNumFaces() const @@ -854,12 +854,12 @@ void LLViewerTexture::addVolume(LLVOVolume* volumep) { if( mNumVolumes >= mVolumeList.size()) { - mVolumeList.resize(2 * mNumVolumes + 1) ; + mVolumeList.resize(2 * mNumVolumes + 1); } - mVolumeList[mNumVolumes] = volumep ; - volumep->setIndexInTex(mNumVolumes) ; - mNumVolumes++ ; - mLastVolumeListUpdateTimer.reset() ; + mVolumeList[mNumVolumes] = volumep; + volumep->setIndexInTex(mNumVolumes); + mNumVolumes++; + mLastVolumeListUpdateTimer.reset(); } //virtual @@ -867,64 +867,64 @@ void LLViewerTexture::removeVolume(LLVOVolume* volumep) { if(mNumVolumes > 1) { - S32 index = volumep->getIndexInTex() ; + S32 index = volumep->getIndexInTex(); llassert(index < mVolumeList.size()); llassert(index < mNumVolumes); - mVolumeList[index] = mVolumeList[--mNumVolumes] ; - mVolumeList[index]->setIndexInTex(index) ; + mVolumeList[index] = mVolumeList[--mNumVolumes]; + mVolumeList[index]->setIndexInTex(index); } else { - mVolumeList.clear() ; - mNumVolumes = 0 ; + mVolumeList.clear(); + mNumVolumes = 0; } - mLastVolumeListUpdateTimer.reset() ; + mLastVolumeListUpdateTimer.reset(); } S32 LLViewerTexture::getNumVolumes() const { - return mNumVolumes ; + return mNumVolumes; } void LLViewerTexture::reorganizeFaceList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds - static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + static const U32 MAX_EXTRA_BUFFER_SIZE = 4; if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) { - return ; + return; } for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) { if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size()) { - return ; + return; } mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end()); } - mLastFaceListUpdateTimer.reset() ; + mLastFaceListUpdateTimer.reset(); } void LLViewerTexture::reorganizeVolumeList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds - static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + static const U32 MAX_EXTRA_BUFFER_SIZE = 4; if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size()) { - return ; + return; } if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) { - return ; + return; } - mLastVolumeListUpdateTimer.reset() ; + mLastVolumeListUpdateTimer.reset(); mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); } @@ -942,7 +942,7 @@ void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) BOOL LLViewerTexture::isLargeImage() { - return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize ; + return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize; } //virtual @@ -951,7 +951,7 @@ void LLViewerTexture::updateBindStatsForTester() LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->updateTextureBindingStats(this) ; + tester->updateTextureBindingStats(this); } } @@ -967,19 +967,19 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, : LLViewerTexture(id, usemipmaps), mTargetHost(host) { - init(TRUE) ; + init(TRUE); mFTType = f_type; if (mFTType == FTT_HOST_BAKE) { mCanUseHTTP = false; } - generateGLTexture() ; + generateGLTexture(); } LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps) : LLViewerTexture(raw, usemipmaps) { - init(TRUE) ; + init(TRUE); mFTType = f_type; } @@ -987,9 +987,9 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_ : LLViewerTexture(id, usemipmaps), mUrl(url) { - init(TRUE) ; + init(TRUE); mFTType = f_type; - generateGLTexture() ; + generateGLTexture(); } void LLViewerFetchedTexture::init(bool firstinit) @@ -1000,7 +1000,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mRequestedDiscardLevel = -1; mRequestedDownloadPriority = 0.f; mFullyLoaded = FALSE; - mCanUseHTTP = true ; + mCanUseHTTP = true; mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; @@ -1008,7 +1008,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mKnownDrawWidth = 0; mKnownDrawHeight = 0; - mKnownDrawSizeChanged = FALSE ; + mKnownDrawSizeChanged = FALSE; if (firstinit) { @@ -1021,7 +1021,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mIsMissingAsset = FALSE; mLoadedCallbackDesiredDiscardLevel = S8_MAX; - mPauseLoadedCallBacks = FALSE ; + mPauseLoadedCallBacks = FALSE; mNeedsCreateTexture = FALSE; @@ -1036,21 +1036,21 @@ void LLViewerFetchedTexture::init(bool firstinit) mDownloadProgress = 0.f; mFetchDeltaTime = 999999.f; mRequestDeltaTime = 0.f; - mForSculpt = FALSE ; - mIsFetched = FALSE ; + mForSculpt = FALSE; + mIsFetched = FALSE; mInFastCacheList = FALSE; - mCachedRawImage = NULL ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImageReady = FALSE ; - - mSavedRawImage = NULL ; - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; - mSavedRawDiscardLevel = -1 ; - mDesiredSavedRawDiscardLevel = -1 ; - mLastReferencedSavedRawImageTime = 0.0f ; - mKeptSavedRawImageTime = 0.f ; + mCachedRawImage = NULL; + mCachedRawDiscardLevel = -1; + mCachedRawImageReady = FALSE; + + mSavedRawImage = NULL; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; + mSavedRawDiscardLevel = -1; + mDesiredSavedRawDiscardLevel = -1; + mLastReferencedSavedRawImageTime = 0.0f; + mKeptSavedRawImageTime = 0.f; mLastCallBackActiveTime = 0.f; mInDebug = FALSE; @@ -1073,7 +1073,7 @@ LLViewerFetchedTexture::~LLViewerFetchedTexture() //virtual S8 LLViewerFetchedTexture::getType() const { - return LLViewerTexture::FETCHED_TEXTURE ; + return LLViewerTexture::FETCHED_TEXTURE; } FTType LLViewerFetchedTexture::getFTType() const @@ -1090,7 +1090,7 @@ void LLViewerFetchedTexture::cleanup() // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData ); - entryp->removeTexture(this) ; + entryp->removeTexture(this); delete entryp; } mLoadedCallbackList.clear(); @@ -1098,10 +1098,10 @@ void LLViewerFetchedTexture::cleanup() // Clean up image data destroyRawImage(); - mCachedRawImage = NULL ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImageReady = FALSE ; - mSavedRawImage = NULL ; + mCachedRawImage = NULL; + mCachedRawDiscardLevel = -1; + mCachedRawImageReady = FALSE; + mSavedRawImage = NULL; mSavedRawDiscardLevel = -1; } @@ -1114,7 +1114,7 @@ void LLViewerFetchedTexture::loadFromFastCache() } mInFastCacheList = FALSE; - mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel) ; + mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel); if(mRawImage.notNull()) { mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; @@ -1127,56 +1127,56 @@ void LLViewerFetchedTexture::loadFromFastCache() destroyRawImage(); LL_WARNS() << "oversized, setting as missing" << LL_ENDL; setIsMissingAsset(); - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } else { mRequestedDiscardLevel = mDesiredDiscardLevel + 1; mIsRawImageValid = TRUE; - addToCreateTexture() ; + addToCreateTexture(); } } } void LLViewerFetchedTexture::setForSculpt() { - static const S32 MAX_INTERVAL = 8 ; //frames + static const S32 MAX_INTERVAL = 8; //frames - mForSculpt = TRUE ; + mForSculpt = TRUE; if(isForSculptOnly() && hasGLTexture() && !getBoundRecently()) { - destroyGLTexture() ; //sculpt image does not need gl texture. + destroyGLTexture(); //sculpt image does not need gl texture. mTextureState = ACTIVE; } - checkCachedRawSculptImage() ; - setMaxVirtualSizeResetInterval(MAX_INTERVAL) ; + checkCachedRawSculptImage(); + setMaxVirtualSizeResetInterval(MAX_INTERVAL); } BOOL LLViewerFetchedTexture::isForSculptOnly() const { - return mForSculpt && !mNeedsGLTexture ; + return mForSculpt && !mNeedsGLTexture; } BOOL LLViewerFetchedTexture::isDeleted() { - return mTextureState == DELETED ; + return mTextureState == DELETED; } BOOL LLViewerFetchedTexture::isInactive() { - return mTextureState == INACTIVE ; + return mTextureState == INACTIVE; } BOOL LLViewerFetchedTexture::isDeletionCandidate() { - return mTextureState == DELETION_CANDIDATE ; + return mTextureState == DELETION_CANDIDATE; } void LLViewerFetchedTexture::setDeletionCandidate() { if(mGLTexturep.notNull() && mGLTexturep->getTexName() && (mTextureState == INACTIVE)) { - mTextureState = DELETION_CANDIDATE ; + mTextureState = DELETION_CANDIDATE; } } @@ -1185,7 +1185,7 @@ void LLViewerFetchedTexture::setInactive() { if(mTextureState == ACTIVE && mGLTexturep.notNull() && mGLTexturep->getTexName() && !mGLTexturep->getBoundRecently()) { - mTextureState = INACTIVE ; + mTextureState = INACTIVE; } } @@ -1229,57 +1229,57 @@ void LLViewerFetchedTexture::destroyTexture() { //if(LLImageGL::sGlobalTextureMemoryInBytes < sMaxDesiredTextureMemInBytes)//not ready to release unused memory. //{ - // return ; + // return; //} if (mNeedsCreateTexture)//return if in the process of generating a new texture. { - return ; + return; } //LL_DEBUGS("Avatar") << mID << LL_ENDL; - destroyGLTexture() ; - mFullyLoaded = FALSE ; + destroyGLTexture(); + mFullyLoaded = FALSE; } void LLViewerFetchedTexture::addToCreateTexture() { - bool force_update = false ; + bool force_update = false; if (getComponents() != mRawImage->getComponents()) { // We've changed the number of components, so we need to move any // objects using this pool to a different pool. mComponents = mRawImage->getComponents(); - mGLTexturep->setComponents(mComponents) ; - force_update = true ; + mGLTexturep->setComponents(mComponents); + force_update = true; for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j) { llassert(mNumFaces[j] <= mFaceList[j].size()); - for(U32 i = 0 ; i < mNumFaces[j]; i++) + for(U32 i = 0; i < mNumFaces[j]; i++) { - mFaceList[j][i]->dirtyTexture() ; + mFaceList[j][i]->dirtyTexture(); } } //discard the cached raw image and the saved raw image - mCachedRawImageReady = FALSE ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImage = NULL ; - mSavedRawDiscardLevel = -1 ; - mSavedRawImage = NULL ; + mCachedRawImageReady = FALSE; + mCachedRawDiscardLevel = -1; + mCachedRawImage = NULL; + mSavedRawDiscardLevel = -1; + mSavedRawImage = NULL; } if(isForSculptOnly()) { //just update some variables, not to create a real GL texture. - createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE) ; - mNeedsCreateTexture = FALSE ; + createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE); + mNeedsCreateTexture = FALSE; destroyRawImage(); } else if(!force_update && getDiscardLevel() > -1 && getDiscardLevel() <= mRawDiscardLevel) { - mNeedsCreateTexture = FALSE ; + mNeedsCreateTexture = FALSE; destroyRawImage(); } else @@ -1299,11 +1299,11 @@ void LLViewerFetchedTexture::addToCreateTexture() //scale it down to size >= LLViewerTexture::sMinLargeImageSize if(w * h > LLViewerTexture::sMinLargeImageSize) { - S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel ; + S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel; if(d_level > 0) { - S32 i = 0 ; + S32 i = 0; while((d_level > 0) && ((w >> i) * (h >> i) > LLViewerTexture::sMinLargeImageSize)) { i++; @@ -1311,14 +1311,14 @@ void LLViewerFetchedTexture::addToCreateTexture() } if(i > 0) { - mRawDiscardLevel += i ; + mRawDiscardLevel += i; if(mRawDiscardLevel >= getDiscardLevel() && getDiscardLevel() > 0) { - mNeedsCreateTexture = FALSE ; + mNeedsCreateTexture = FALSE; destroyRawImage(); - return ; + return; } - mRawImage->scale(w >> i, h >> i) ; + mRawImage->scale(w >> i, h >> i); } } } @@ -1327,7 +1327,7 @@ void LLViewerFetchedTexture::addToCreateTexture() mNeedsCreateTexture = TRUE; gTextureList.mCreateTextureList.insert(this); } - return ; + return; } // ONLY called from LLViewerTextureList @@ -1405,7 +1405,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); - setActive() ; + setActive(); if (!needsToSaveRawImage()) { @@ -1421,11 +1421,11 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) { if(mKnownDrawWidth < width || mKnownDrawHeight < height) { - mKnownDrawWidth = llmax(mKnownDrawWidth, width) ; - mKnownDrawHeight = llmax(mKnownDrawHeight, height) ; + mKnownDrawWidth = llmax(mKnownDrawWidth, width); + mKnownDrawHeight = llmax(mKnownDrawHeight, height); - mKnownDrawSizeChanged = TRUE ; - mFullyLoaded = FALSE ; + mKnownDrawSizeChanged = TRUE; + mFullyLoaded = FALSE; } addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight)); } @@ -1437,13 +1437,13 @@ void LLViewerFetchedTexture::processTextureStats() { if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; - mFullyLoaded = FALSE ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); + mFullyLoaded = FALSE; } } else { - updateVirtualSize() ; + updateVirtualSize(); static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes"); @@ -1453,7 +1453,7 @@ void LLViewerFetchedTexture::processTextureStats() } else if(!mFullWidth || !mFullHeight) { - mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel) ; + mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel); } else { @@ -1471,36 +1471,36 @@ void LLViewerFetchedTexture::processTextureStats() else if(mKnownDrawSizeChanged)//known draw size is set { mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, - log((F32)mFullHeight / mKnownDrawHeight) / log_2) ; - mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ; - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; + log((F32)mFullHeight / mKnownDrawHeight) / log_2); + mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()); + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); } - mKnownDrawSizeChanged = FALSE ; + mKnownDrawSizeChanged = FALSE; if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) { - mFullyLoaded = TRUE ; + mFullyLoaded = TRUE; } } } if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture. { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel) { - mFullyLoaded = FALSE ; + mFullyLoaded = FALSE; } } } -const F32 MAX_PRIORITY_PIXEL = 999.f ; //pixel area -const F32 PRIORITY_BOOST_LEVEL_FACTOR = 1000.f ; //boost level -const F32 PRIORITY_DELTA_DISCARD_LEVEL_FACTOR = 100000.f ; //delta discard -const S32 MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY = 4 ; -const F32 PRIORITY_ADDITIONAL_FACTOR = 1000000.f ; //additional -const S32 MAX_ADDITIONAL_LEVEL_FOR_PRIORITY = 8 ; -const F32 PRIORITY_BOOST_HIGH_FACTOR = 10000000.f ;//boost high +const F32 MAX_PRIORITY_PIXEL = 999.f; //pixel area +const F32 PRIORITY_BOOST_LEVEL_FACTOR = 1000.f; //boost level +const F32 PRIORITY_DELTA_DISCARD_LEVEL_FACTOR = 100000.f; //delta discard +const S32 MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY = 4; +const F32 PRIORITY_ADDITIONAL_FACTOR = 1000000.f; //additional +const S32 MAX_ADDITIONAL_LEVEL_FOR_PRIORITY = 8; +const F32 PRIORITY_BOOST_HIGH_FACTOR = 10000000.f;//boost high F32 LLViewerFetchedTexture::calcDecodePriority() { #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1516,7 +1516,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } if(mFullyLoaded && !mForceToSaveRawImage)//already loaded for static texture { - return -1.0f ; //alreay fetched + return -1.0f; //alreay fetched } S32 cur_discard = getCurrentDiscardLevelForFetching(); @@ -1531,7 +1531,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } else if(mDesiredDiscardLevel >= cur_discard && cur_discard > -1) { - priority = -2.0f ; + priority = -2.0f; } else if(mCachedRawDiscardLevel > -1 && mDesiredDiscardLevel >= mCachedRawDiscardLevel) { @@ -1568,7 +1568,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired; ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; - setAdditionalDecodePriority(0.1f) ;//boost the textures without any data so far. + setAdditionalDecodePriority(0.1f);//boost the textures without any data so far. } else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel)) { @@ -1603,13 +1603,13 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // [10,000,000] + [1,000,000-9,000,000] + [100,000-500,000] + [1-20,000] + [0-999] if (priority > 0.0f) { - bool large_enough = mCachedRawImageReady && ((S32)mTexelsPerImage > sMinLargeImageSize) ; + bool large_enough = mCachedRawImageReady && ((S32)mTexelsPerImage > sMinLargeImageSize); if(large_enough) { //Note: //to give small, low-priority textures some chance to be fetched, //cut the priority in half if the texture size is larger than 256 * 256 and has a 64*64 ready. - priority *= 0.5f ; + priority *= 0.5f; } pixel_priority = llclamp(pixel_priority, 0.0f, MAX_PRIORITY_PIXEL); @@ -1628,7 +1628,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() //Note: //to give small, low-priority textures some chance to be fetched, //if high priority texture has a 64*64 ready, lower its fetching priority. - setAdditionalDecodePriority(0.5f) ; + setAdditionalDecodePriority(0.5f); } else { @@ -1645,7 +1645,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() //Note: //to give small, low-priority textures some chance to be fetched, //cut the additional priority to a quarter if the texture size is larger than 256 * 256 and has a 64*64 ready. - additional *= 0.25f ; + additional *= 0.25f; } priority += additional; } @@ -1660,9 +1660,9 @@ F32 LLViewerFetchedTexture::maxDecodePriority() PRIORITY_ADDITIONAL_FACTOR * (MAX_ADDITIONAL_LEVEL_FOR_PRIORITY + 1) + //additional (view dependent factors) PRIORITY_DELTA_DISCARD_LEVEL_FACTOR * (MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY + 1) + //delta discard PRIORITY_BOOST_LEVEL_FACTOR * (BOOST_MAX_LEVEL - 1) + //boost level - MAX_PRIORITY_PIXEL + 1.0f ; //pixel area. + MAX_PRIORITY_PIXEL + 1.0f; //pixel area. - return max_priority ; + return max_priority; } //============================================================================ @@ -1673,7 +1673,7 @@ void LLViewerFetchedTexture::setDecodePriority(F32 priority) if(mDecodePriority < F_ALMOST_ZERO) { - mStopFetchingTimer.reset() ; + mStopFetchingTimer.reset(); } } @@ -1690,16 +1690,16 @@ void LLViewerFetchedTexture::updateVirtualSize() { if(!mMaxVirtualSizeResetCounter) { - addTextureStats(0.f, FALSE) ;//reset + addTextureStats(0.f, FALSE);//reset } for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) { llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = 0 ; i < mNumFaces[ch]; i++) + for(U32 i = 0; i < mNumFaces[ch]; i++) { - LLFace* facep = mFaceList[ch][i] ; + LLFace* facep = mFaceList[ch][i]; if( facep ) { LLDrawable* drawable = facep->getDrawable(); @@ -1712,8 +1712,8 @@ void LLViewerFetchedTexture::updateVirtualSize() { setBoostLevel(LLViewerTexture::BOOST_SELECTED); } - addTextureStats(facep->getVirtualSize()) ; - setAdditionalDecodePriority(facep->getImportanceToCamera()) ; + addTextureStats(facep->getVirtualSize()); + setAdditionalDecodePriority(facep->getImportanceToCamera()); } } } @@ -1732,26 +1732,26 @@ void LLViewerFetchedTexture::updateVirtualSize() { mMaxVirtualSizeResetCounter--; } - reorganizeFaceList() ; + reorganizeFaceList(); reorganizeVolumeList(); } S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching() { - S32 current_discard = getDiscardLevel() ; + S32 current_discard = getDiscardLevel(); if(mForceToSaveRawImage) { if(mSavedRawDiscardLevel < 0 || current_discard < 0) { - current_discard = -1 ; + current_discard = -1; } else { - current_discard = llmax(current_discard, mSavedRawDiscardLevel) ; + current_discard = llmax(current_discard, mSavedRawDiscardLevel); } } - return current_discard ; + return current_discard; } bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) @@ -1782,7 +1782,7 @@ bool LLViewerFetchedTexture::updateFetch() static LLCachedControl<S32> sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost"); if(textures_decode_disabled) { - return false ; + return false; } mFetchState = 0; @@ -1817,7 +1817,7 @@ bool LLViewerFetchedTexture::updateFetch() return false; } - S32 current_discard = getCurrentDiscardLevelForFetching() ; + S32 current_discard = getCurrentDiscardLevelForFetching(); S32 desired_discard = getDesiredDiscardLevel(); F32 decode_priority = getDecodePriority(); decode_priority = llclamp(decode_priority, 0.0f, maxDecodePriority()); @@ -1835,7 +1835,7 @@ bool LLViewerFetchedTexture::updateFetch() if (finished) { mIsFetching = FALSE; - mLastPacketTimer.reset() ; + mLastPacketTimer.reset(); } else { @@ -1849,8 +1849,8 @@ bool LLViewerFetchedTexture::updateFetch() LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - mIsFetched = TRUE ; - tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ; + mIsFetched = TRUE; + tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); } mRawDiscardLevel = fetch_discard; if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && @@ -1866,17 +1866,17 @@ bool LLViewerFetchedTexture::updateFetch() destroyRawImage(); LL_WARNS() << "oversize, setting as missing" << LL_ENDL; setIsMissingAsset(); - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; - mIsFetching = FALSE ; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; + mIsFetching = FALSE; mLastPacketTimer.reset(); } else { mIsRawImageValid = TRUE; - addToCreateTexture() ; + addToCreateTexture(); } - return TRUE ; + return TRUE; } else { @@ -1924,10 +1924,10 @@ bool LLViewerFetchedTexture::updateFetch() // LL_INFOS() << "Calling updateRequestPriority() with decode_priority = 0.0f" << LL_ENDL; // calcDecodePriority(); // } - static const F32 MAX_HOLD_TIME = 5.0f ; //seconds to wait before canceling fecthing if decode_priority is 0.f. + static const F32 MAX_HOLD_TIME = 5.0f; //seconds to wait before canceling fecthing if decode_priority is 0.f. if(decode_priority > 0.0f || mStopFetchingTimer.getElapsedTimeF32() > MAX_HOLD_TIME) { - mStopFetchingTimer.reset() ; + mStopFetchingTimer.reset(); LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority); } } @@ -1953,7 +1953,7 @@ bool LLViewerFetchedTexture::updateFetch() else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel)) { make_request = false; - switchToCachedImage() ; //use the cached raw data first + switchToCachedImage(); //use the cached raw data first } //else if (!isJustBound() && mCachedRawImageReady) //{ @@ -1965,7 +1965,7 @@ bool LLViewerFetchedTexture::updateFetch() // Load the texture progressively: we try not to rush to the desired discard too fast. // If the camera is not moving, we do not tweak the discard level notch by notch but go to the desired discard with larger boosted steps // This mitigates the "textures stay blurry" problem when loading while not killing the texture memory while moving around - S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1 ; + S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1; if (current_discard < 0) { desired_discard = llmax(desired_discard, getMaxDiscardLevel() - delta_level); @@ -2051,7 +2051,7 @@ void LLViewerFetchedTexture::clearFetchedResults() { if(mNeedsCreateTexture || mIsFetching) { - return ; + return; } cleanup(); @@ -2068,7 +2068,7 @@ void LLViewerFetchedTexture::forceToDeleteRequest() if (mHasFetcher) { mHasFetcher = FALSE; - mIsFetching = FALSE ; + mIsFetching = FALSE; } resetTextureStats(); @@ -2116,19 +2116,19 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call } else { - mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ; + mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level); } if(mPauseLoadedCallBacks) { if(!pause) { - unpauseLoadedCallbacks(src_callback_list) ; + unpauseLoadedCallbacks(src_callback_list); } } else if(pause) { - pauseLoadedCallbacks(src_callback_list) ; + pauseLoadedCallbacks(src_callback_list); } LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause); @@ -2137,21 +2137,21 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call mNeedsAux |= needs_aux; if(keep_imageraw) { - mSaveRawImage = TRUE ; + mSaveRawImage = TRUE; } if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0) { // We need aux data, but we've already loaded the image, and it didn't have any LL_WARNS() << "No aux data available for callback for image:" << getID() << LL_ENDL; } - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; } void LLViewerFetchedTexture::clearCallbackEntryList() { if(mLoadedCallbackList.empty()) { - return ; + return; } for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -2162,29 +2162,29 @@ void LLViewerFetchedTexture::clearCallbackEntryList() // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); - iter = mLoadedCallbackList.erase(iter) ; + iter = mLoadedCallbackList.erase(iter); delete entryp; } gTextureList.mCallbackList.erase(this); - mLoadedCallbackDesiredDiscardLevel = S8_MAX ; + mLoadedCallbackDesiredDiscardLevel = S8_MAX; if(needsToSaveRawImage()) { - destroySavedRawImage() ; + destroySavedRawImage(); } - return ; + return; } void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(mLoadedCallbackList.empty() || !callback_list) { - return ; + return; } - S32 desired_discard = S8_MAX ; - S32 desired_raw_discard = INVALID_DISCARD_LEVEL ; + S32 desired_discard = S8_MAX; + S32 desired_raw_discard = INVALID_DISCARD_LEVEL; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { @@ -2194,17 +2194,17 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); - iter = mLoadedCallbackList.erase(iter) ; + iter = mLoadedCallbackList.erase(iter); delete entryp; } else { ++iter; - desired_discard = llmin(desired_discard, entryp->mDesiredDiscard) ; + desired_discard = llmin(desired_discard, entryp->mDesiredDiscard); if(entryp->mNeedsImageRaw) { - desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard) ; + desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard); } } } @@ -2217,18 +2217,18 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so if(needsToSaveRawImage()) { - destroySavedRawImage() ; + destroySavedRawImage(); } } else if(needsToSaveRawImage() && mBoostLevel != LLGLTexture::BOOST_PREVIEW) { if(desired_raw_discard != INVALID_DISCARD_LEVEL) { - mDesiredSavedRawDiscardLevel = desired_raw_discard ; + mDesiredSavedRawDiscardLevel = desired_raw_discard; } else { - destroySavedRawImage() ; + destroySavedRawImage(); } } } @@ -2237,29 +2237,29 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: { if(!callback_list) { - mPauseLoadedCallBacks = FALSE ; - return ; + mPauseLoadedCallBacks = FALSE; + return; } - BOOL need_raw = FALSE ; + BOOL need_raw = FALSE; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = FALSE ; + entryp->mPaused = FALSE; if(entryp->mNeedsImageRaw) { - need_raw = TRUE ; + need_raw = TRUE; } } } - mPauseLoadedCallBacks = FALSE ; - mLastCallBackActiveTime = sCurrentTime ; + mPauseLoadedCallBacks = FALSE; + mLastCallBackActiveTime = sCurrentTime; if(need_raw) { - mSaveRawImage = TRUE ; + mSaveRawImage = TRUE; } } @@ -2267,10 +2267,10 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s { if(!callback_list) { - return ; + return; } - bool paused = true ; + bool paused = true; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) @@ -2278,25 +2278,25 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = TRUE ; + entryp->mPaused = TRUE; } else if(!entryp->mPaused) { - paused = false ; + paused = false; } } if(paused) { - mPauseLoadedCallBacks = TRUE ;//when set, loaded callback is paused. + mPauseLoadedCallBacks = TRUE;//when set, loaded callback is paused. resetTextureStats(); - mSaveRawImage = FALSE ; + mSaveRawImage = FALSE; } } bool LLViewerFetchedTexture::doLoadedCallbacks() { - static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds + static const F32 MAX_INACTIVE_TIME = 900.f; //seconds if (mNeedsCreateTexture) { @@ -2309,8 +2309,8 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() } if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching) { - clearCallbackEntryList() ; //remove all callbacks. - return false ; + clearCallbackEntryList(); //remove all callbacks. + return false; } bool res = false; @@ -2330,7 +2330,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // Remove ourself from the global list of textures with callbacks gTextureList.mCallbackList.erase(this); - return false ; + return false; } S32 gl_discard = getDiscardLevel(); @@ -2451,7 +2451,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // to satisfy the interested party, then this is the last time that // we're going to call them. - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; //llassert_always(mRawImage.notNull()); if(mNeedsAux && mAuxRawImage.isNull()) { @@ -2487,7 +2487,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() LLLoadedCallbackEntry *entryp = *curiter; if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard)) { - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE; entryp->mLastUsedDiscard = gl_discard; entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData); @@ -2521,66 +2521,66 @@ void LLViewerFetchedTexture::forceImmediateUpdate() //only immediately update a deleted texture which is now being re-used. if(!isDeleted()) { - return ; + return; } //if already called forceImmediateUpdate() if(mInImageList && mDecodePriority == LLViewerFetchedTexture::maxDecodePriority()) { - return ; + return; } - gTextureList.forceImmediateUpdate(this) ; - return ; + gTextureList.forceImmediateUpdate(this); + return; } LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level) { - llassert_always(mGLTexturep.notNull()) ; + llassert_always(mGLTexturep.notNull()); llassert_always(discard_level >= 0); llassert_always(mComponents > 0); if (mRawImage.notNull()) { //mRawImage is in use by somebody else, do not delete it. - return NULL ; + return NULL; } if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level) { if(mSavedRawDiscardLevel != discard_level) { - mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()) ; - mRawImage->copy(getSavedRawImage()) ; + mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()); + mRawImage->copy(getSavedRawImage()); } else { - mRawImage = getSavedRawImage() ; + mRawImage = getSavedRawImage(); } - mRawDiscardLevel = discard_level ; + mRawDiscardLevel = discard_level; } else { //force to fetch raw image again if cached raw image is not good enough. if(mCachedRawDiscardLevel > discard_level) { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; mRawDiscardLevel = mCachedRawDiscardLevel; } else //cached raw image is good enough, copy it. { if(mCachedRawDiscardLevel != discard_level) { - mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()) ; - mRawImage->copy(mCachedRawImage) ; + mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()); + mRawImage->copy(mCachedRawImage); } else { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; } - mRawDiscardLevel = discard_level ; + mRawDiscardLevel = discard_level; } } - mIsRawImageValid = TRUE ; + mIsRawImageValid = TRUE; sRawCount++; return mRawImage; @@ -2588,7 +2588,7 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level) bool LLViewerFetchedTexture::needsToSaveRawImage() { - return mForceToSaveRawImage || mSaveRawImage ; + return mForceToSaveRawImage || mSaveRawImage; } void LLViewerFetchedTexture::destroyRawImage() @@ -2607,9 +2607,9 @@ void LLViewerFetchedTexture::destroyRawImage() { if(needsToSaveRawImage()) { - saveRawImage() ; + saveRawImage(); } - setCachedRawImage() ; + setCachedRawImage(); } mRawImage = NULL; @@ -2625,19 +2625,19 @@ void LLViewerFetchedTexture::switchToCachedImage() { if(mCachedRawImage.notNull()) { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; if (getComponents() != mRawImage->getComponents()) { // We've changed the number of components, so we need to move any // objects using this pool to a different pool. mComponents = mRawImage->getComponents(); - mGLTexturep->setComponents(mComponents) ; + mGLTexturep->setComponents(mComponents); gTextureList.dirtyImage(this); } mIsRawImageValid = TRUE; - mRawDiscardLevel = mCachedRawDiscardLevel ; + mRawDiscardLevel = mCachedRawDiscardLevel; gTextureList.mCreateTextureList.insert(this); mNeedsCreateTexture = TRUE; } @@ -2649,9 +2649,9 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im { if(imageraw != mRawImage.get()) { - mCachedRawImage = imageraw ; - mCachedRawDiscardLevel = discard_level ; - mCachedRawImageReady = TRUE ; + mCachedRawImage = imageraw; + mCachedRawDiscardLevel = discard_level; + mCachedRawImageReady = TRUE; } } @@ -2659,56 +2659,56 @@ void LLViewerFetchedTexture::setCachedRawImage() { if(mRawImage == mCachedRawImage) { - return ; + return; } if(!mIsRawImageValid) { - return ; + return; } if(mCachedRawImageReady) { - return ; + return; } if(mCachedRawDiscardLevel < 0 || mCachedRawDiscardLevel > mRawDiscardLevel) { - S32 i = 0 ; - S32 w = mRawImage->getWidth() ; - S32 h = mRawImage->getHeight() ; + S32 i = 0; + S32 w = mRawImage->getWidth(); + S32 h = mRawImage->getHeight(); - S32 max_size = MAX_CACHED_RAW_IMAGE_AREA ; + S32 max_size = MAX_CACHED_RAW_IMAGE_AREA; if(LLGLTexture::BOOST_TERRAIN == mBoostLevel) { - max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA ; + max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA; } if(mForSculpt) { - max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA ; - mCachedRawImageReady = !mRawDiscardLevel ; + max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA; + mCachedRawImageReady = !mRawDiscardLevel; } else { - mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ; + mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)); } while(((w >> i) * (h >> i)) > max_size) { - ++i ; + ++i; } if(i) { if(!(w >> i) || !(h >> i)) { - --i ; + --i; } - mRawImage->scale(w >> i, h >> i) ; + mRawImage->scale(w >> i, h >> i); } - mCachedRawImage = mRawImage ; - mRawDiscardLevel += i ; - mCachedRawDiscardLevel = mRawDiscardLevel ; + mCachedRawImage = mRawImage; + mRawDiscardLevel += i; + mCachedRawDiscardLevel = mRawDiscardLevel; } } @@ -2718,11 +2718,11 @@ void LLViewerFetchedTexture::checkCachedRawSculptImage() { if(getDiscardLevel() != 0) { - mCachedRawImageReady = FALSE ; + mCachedRawImageReady = FALSE; } else if(isForSculptOnly()) { - resetTextureStats() ; //do not update this image any more. + resetTextureStats(); //do not update this image any more. } } } @@ -2731,45 +2731,45 @@ void LLViewerFetchedTexture::saveRawImage() { if(mRawImage.isNull() || mRawImage == mSavedRawImage || (mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= mRawDiscardLevel)) { - return ; + return; } - mSavedRawDiscardLevel = mRawDiscardLevel ; - mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents()) ; + mSavedRawDiscardLevel = mRawDiscardLevel; + mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents()); if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel) { - mForceToSaveRawImage = FALSE ; + mForceToSaveRawImage = FALSE; } - mLastReferencedSavedRawImageTime = sCurrentTime ; + mLastReferencedSavedRawImageTime = sCurrentTime; } void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time) { - mKeptSavedRawImageTime = kept_time ; - mLastReferencedSavedRawImageTime = sCurrentTime ; + mKeptSavedRawImageTime = kept_time; + mLastReferencedSavedRawImageTime = sCurrentTime; if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard) { - return ; //raw imge is ready. + return; //raw imge is ready. } if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { - mForceToSaveRawImage = TRUE ; - mDesiredSavedRawDiscardLevel = desired_discard ; + mForceToSaveRawImage = TRUE; + mDesiredSavedRawDiscardLevel = desired_discard; //copy from the cached raw image if exists. if(mCachedRawImage.notNull() && mRawImage.isNull() ) { - mRawImage = mCachedRawImage ; - mRawDiscardLevel = mCachedRawDiscardLevel ; + mRawImage = mCachedRawImage; + mRawDiscardLevel = mCachedRawDiscardLevel; - saveRawImage() ; + saveRawImage(); - mRawImage = NULL ; - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; + mRawImage = NULL; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } } } @@ -2777,38 +2777,38 @@ void LLViewerFetchedTexture::destroySavedRawImage() { if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime) { - return ; //keep the saved raw image. + return; //keep the saved raw image. } - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; - clearCallbackEntryList() ; + clearCallbackEntryList(); - mSavedRawImage = NULL ; - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; - mSavedRawDiscardLevel = -1 ; - mDesiredSavedRawDiscardLevel = -1 ; - mLastReferencedSavedRawImageTime = 0.0f ; - mKeptSavedRawImageTime = 0.f ; + mSavedRawImage = NULL; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; + mSavedRawDiscardLevel = -1; + mDesiredSavedRawDiscardLevel = -1; + mLastReferencedSavedRawImageTime = 0.0f; + mKeptSavedRawImageTime = 0.f; } LLImageRaw* LLViewerFetchedTexture::getSavedRawImage() { - mLastReferencedSavedRawImageTime = sCurrentTime ; + mLastReferencedSavedRawImageTime = sCurrentTime; - return mSavedRawImage ; + return mSavedRawImage; } BOOL LLViewerFetchedTexture::hasSavedRawImage() const { - return mSavedRawImage.notNull() ; + return mSavedRawImage.notNull(); } F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const { - return sCurrentTime - mLastReferencedSavedRawImageTime ; + return sCurrentTime - mLastReferencedSavedRawImageTime; } //---------------------------------------------------------------------------------------------- @@ -2821,13 +2821,13 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) : LLViewerFetchedTexture(id, f_type, host, usemipmaps) { - init(TRUE) ; + init(TRUE); } LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) : LLViewerFetchedTexture(url, f_type, id, usemipmaps) { - init(TRUE) ; + init(TRUE); } void LLViewerLODTexture::init(bool firstinit) @@ -2840,19 +2840,19 @@ void LLViewerLODTexture::init(bool firstinit) //virtual S8 LLViewerLODTexture::getType() const { - return LLViewerTexture::LOD_TEXTURE ; + return LLViewerTexture::LOD_TEXTURE; } BOOL LLViewerLODTexture::isUpdateFrozen() { - return LLViewerTexture::sFreezeImageScalingDown && !getDiscardLevel() ; + return LLViewerTexture::sFreezeImageScalingDown && !getDiscardLevel(); } // This is gauranteed to get called periodically for every texture //virtual void LLViewerLODTexture::processTextureStats() { - updateVirtualSize() ; + updateVirtualSize(); static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes"); @@ -2874,7 +2874,7 @@ void LLViewerLODTexture::processTextureStats() } else if (!mFullWidth || !mFullHeight) { - mDesiredDiscardLevel = getMaxDiscardLevel() ; + mDesiredDiscardLevel = getMaxDiscardLevel(); } else { @@ -2900,7 +2900,7 @@ void LLViewerLODTexture::processTextureStats() if(isLargeImage() && !isJustBound() && mAdditionalDecodePriority < 0.3f) { //if is a big image and not being used recently, nor close to the view point, do not load hi-res data. - mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerTexture::sMinLargeImageSize) ; + mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerTexture::sMinLargeImageSize); } if ((mCalculatedDiscardLevel >= 0.f) && @@ -2921,7 +2921,7 @@ void LLViewerLODTexture::processTextureStats() { discard_level += sDesiredDiscardBias; discard_level *= sDesiredDiscardScale; // scale - discard_level += sCameraMovingDiscardBias ; + discard_level += sCameraMovingDiscardBias; } discard_level = floorf(discard_level); @@ -2948,19 +2948,19 @@ void LLViewerLODTexture::processTextureStats() if(desired_discard_bias_max <= sDesiredDiscardBias && !mForceToSaveRawImage) { //needs to release texture memory urgently - scaleDown() ; + scaleDown(); } // Limit the amount of GL memory bound each frame else if ( sBoundTextureMemory > sMaxBoundTextureMem * texmem_middle_bound_scale && (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) { - scaleDown() ; + scaleDown(); } // Only allow GL to have 2x the video card memory else if ( sTotalTextureMemory > sMaxTotalTextureMem * texmem_middle_bound_scale && (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) { - scaleDown() ; + scaleDown(); } } @@ -2968,13 +2968,13 @@ void LLViewerLODTexture::processTextureStats() if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); } else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. { if(scaleDown()) { - mDesiredDiscardLevel = mCachedRawDiscardLevel ; + mDesiredDiscardLevel = mCachedRawDiscardLevel; } } } @@ -2983,17 +2983,17 @@ bool LLViewerLODTexture::scaleDown() { if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel()) { - switchToCachedImage() ; + switchToCachedImage(); LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->setStablizingTime() ; + tester->setStablizingTime(); } - return true ; + return true; } - return false ; + return false; } //---------------------------------------------------------------------------------------------- //end of LLViewerLODTexture @@ -3005,14 +3005,14 @@ bool LLViewerLODTexture::scaleDown() //static void LLViewerMediaTexture::updateClass() { - static const F32 MAX_INACTIVE_TIME = 30.f ; + static const F32 MAX_INACTIVE_TIME = 30.f; #if 0 //force to play media. - gSavedSettings.setBOOL("AudioStreamingMedia", true) ; + gSavedSettings.setBOOL("AudioStreamingMedia", true); #endif - for(media_map_t::iterator iter = sMediaMap.begin() ; iter != sMediaMap.end(); ) + for(media_map_t::iterator iter = sMediaMap.begin(); iter != sMediaMap.end(); ) { LLViewerMediaTexture* mediap = iter->second; @@ -3023,29 +3023,29 @@ void LLViewerMediaTexture::updateClass() // if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) { - media_map_t::iterator cur = iter++ ; - sMediaMap.erase(cur) ; - continue ; + media_map_t::iterator cur = iter++; + sMediaMap.erase(cur); + continue; } } - ++iter ; + ++iter; } } //static void LLViewerMediaTexture::removeMediaImplFromTexture(const LLUUID& media_id) { - LLViewerMediaTexture* media_tex = findMediaTexture(media_id) ; + LLViewerMediaTexture* media_tex = findMediaTexture(media_id); if(media_tex) { - media_tex->invalidateMediaImpl() ; + media_tex->invalidateMediaImpl(); } } //static void LLViewerMediaTexture::cleanUpClass() { - sMediaMap.clear() ; + sMediaMap.clear(); } //static @@ -3057,9 +3057,9 @@ LLViewerMediaTexture* LLViewerMediaTexture::findMediaTexture(const LLUUID& media return NULL; } - LLViewerMediaTexture* media_tex = iter->second ; - media_tex->setMediaImpl() ; - media_tex->getLastReferencedTimer()->reset() ; + LLViewerMediaTexture* media_tex = iter->second; + media_tex->setMediaImpl(); + media_tex->getLastReferencedTimer()->reset(); return media_tex; } @@ -3071,48 +3071,48 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL { sMediaMap.insert(std::make_pair(id, this)); - mGLTexturep = gl_image ; + mGLTexturep = gl_image; if(mGLTexturep.isNull()) { - generateGLTexture() ; + generateGLTexture(); } mGLTexturep->setAllowCompression(false); - mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; + mGLTexturep->setNeedsAlphaAndPickMask(FALSE); - mIsPlaying = FALSE ; + mIsPlaying = FALSE; - setMediaImpl() ; + setMediaImpl(); - setCategory(LLGLTexture::MEDIA) ; + setCategory(LLGLTexture::MEDIA); - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { - tex->setParcelMedia(this) ; + tex->setParcelMedia(this); } } //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { - tex->setParcelMedia(NULL) ; + tex->setParcelMedia(NULL); } } void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mUseMipMaps = usemipmaps ; - getLastReferencedTimer()->reset() ; - mGLTexturep->setUseMipMaps(mUseMipMaps) ; - mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; + mUseMipMaps = usemipmaps; + getLastReferencedTimer()->reset(); + mGLTexturep->setUseMipMaps(mUseMipMaps); + mGLTexturep->setNeedsAlphaAndPickMask(FALSE); } void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) @@ -3121,26 +3121,26 @@ void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) if(mGLTexturep.notNull()) { - mGLTexturep->setUseMipMaps(mipmap) ; + mGLTexturep->setUseMipMaps(mipmap); } } //virtual S8 LLViewerMediaTexture::getType() const { - return LLViewerTexture::MEDIA_TEXTURE ; + return LLViewerTexture::MEDIA_TEXTURE; } void LLViewerMediaTexture::invalidateMediaImpl() { - mMediaImplp = NULL ; + mMediaImplp = NULL; } void LLViewerMediaTexture::setMediaImpl() { if(!mMediaImplp) { - mMediaImplp = LLViewerMedia::getMediaImplFromTextureID(mID) ; + mMediaImplp = LLViewerMedia::getMediaImplFromTextureID(mID); } } @@ -3149,71 +3149,71 @@ void LLViewerMediaTexture::setMediaImpl() // because it does not check the face validity after the current frame. BOOL LLViewerMediaTexture::findFaces() { - mMediaFaceList.clear() ; + mMediaFaceList.clear(); - BOOL ret = TRUE ; + BOOL ret = TRUE; - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) { - const ll_face_list_t* face_list = tex->getFaceList(ch) ; - U32 end = tex->getNumFaces(ch) ; - for(U32 i = 0 ; i < end ; i++) + const ll_face_list_t* face_list = tex->getFaceList(ch); + U32 end = tex->getNumFaces(ch); + for(U32 i = 0; i < end; i++) { - mMediaFaceList.push_back((*face_list)[i]) ; + mMediaFaceList.push_back((*face_list)[i]); } } } if(!mMediaImplp) { - return TRUE ; + return TRUE; } //for media on a face. - const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList() ; - std::list< LLVOVolume* >::const_iterator iter = obj_list->begin() ; + const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList(); + std::list< LLVOVolume* >::const_iterator iter = obj_list->begin(); for(; iter != obj_list->end(); ++iter) { - LLVOVolume* obj = *iter ; + LLVOVolume* obj = *iter; if(obj->mDrawable.isNull()) { - ret = FALSE ; - continue ; + ret = FALSE; + continue; } - S32 face_id = -1 ; - S32 num_faces = obj->mDrawable->getNumFaces() ; + S32 face_id = -1; + S32 num_faces = obj->mDrawable->getNumFaces(); while((face_id = obj->getFaceIndexWithMediaImpl(mMediaImplp, face_id)) > -1 && face_id < num_faces) { - LLFace* facep = obj->mDrawable->getFace(face_id) ; + LLFace* facep = obj->mDrawable->getFace(face_id); if(facep) { - mMediaFaceList.push_back(facep) ; + mMediaFaceList.push_back(facep); } else { - ret = FALSE ; + ret = FALSE; } } } - return ret ; + return ret; } void LLViewerMediaTexture::initVirtualSize() { if(mIsPlaying) { - return ; + return; } - findFaces() ; + findFaces(); for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - addTextureStats((*iter)->getVirtualSize()) ; + addTextureStats((*iter)->getVirtualSize()); } } @@ -3221,77 +3221,77 @@ void LLViewerMediaTexture::addMediaToFace(LLFace* facep) { if(facep) { - facep->setHasMedia(true) ; + facep->setHasMedia(true); } if(!mIsPlaying) { - return ; //no need to add the face because the media is not in playing. + return; //no need to add the face because the media is not in playing. } - switchTexture(LLRender::DIFFUSE_MAP, facep) ; + switchTexture(LLRender::DIFFUSE_MAP, facep); } void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep) { if(!facep) { - return ; + return; } - facep->setHasMedia(false) ; + facep->setHasMedia(false); if(!mIsPlaying) { - return ; //no need to remove the face because the media is not in playing. + return; //no need to remove the face because the media is not in playing. } - mIsPlaying = FALSE ; //set to remove the media from the face. - switchTexture(LLRender::DIFFUSE_MAP, facep) ; - mIsPlaying = TRUE ; //set the flag back. + mIsPlaying = FALSE; //set to remove the media from the face. + switchTexture(LLRender::DIFFUSE_MAP, facep); + mIsPlaying = TRUE; //set the flag back. if(getTotalNumFaces() < 1) //no face referencing to this media { - stopPlaying() ; + stopPlaying(); } } //virtual void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep) { - LLViewerTexture::addFace(ch, facep) ; + LLViewerTexture::addFace(ch, facep); - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID()) ; + LLViewerTexture* tex = gTextureList.findImage(te->getID()); if(tex) { - mTextureList.push_back(tex) ;//increase the reference number by one for tex to avoid deleting it. - return ; + mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it. + return; } } //check if it is a parcel media if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) { - mTextureList.push_back(facep->getTexture()) ; //a parcel media. - return ; + mTextureList.push_back(facep->getTexture()); //a parcel media. + return; } if(te && te->getID().notNull()) //should have a texture { - LL_ERRS() << "The face does not have a valid texture before media texture." << LL_ENDL ; + LL_ERRS() << "The face does not have a valid texture before media texture." << LL_ENDL; } } //virtual void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { - LLViewerTexture::removeFace(ch, facep) ; + LLViewerTexture::removeFace(ch, facep); - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID()) ; + LLViewerTexture* tex = gTextureList.findImage(te->getID()); if(tex) { for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); @@ -3299,8 +3299,8 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { if(*iter == tex) { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } @@ -3314,7 +3314,7 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 j = 0 ; j < mNumFaces[ch] ; j++) + for(U32 j = 0; j < mNumFaces[ch]; j++) { te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use. } @@ -3322,8 +3322,8 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) if (te_list.empty()) { - mTextureList.clear() ; - return ; + mTextureList.clear(); + return; } S32 end = te_list.size(); @@ -3333,18 +3333,18 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { S32 i = 0; - for(i = 0 ; i < end ; i++) + for(i = 0; i < end; i++) { if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use. { - te_list[i] = NULL ; - break ; + te_list[i] = NULL; + break; } } if(i == end) //no hit for this texture, remove it. { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } } @@ -3356,14 +3356,14 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { if((*iter)->getID() == mID) { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } if(te && te->getID().notNull()) //should have a texture { - LL_ERRS() << "mTextureList texture reference number is corrupted." << LL_ENDL ; + LL_ERRS() << "mTextureList texture reference number is corrupted." << LL_ENDL; } } @@ -3372,9 +3372,9 @@ void LLViewerMediaTexture::stopPlaying() // Don't stop the media impl playing here -- this breaks non-inworld media (login screen, search, and media browser). // if(mMediaImplp) // { -// mMediaImplp->stop() ; +// mMediaImplp->stop(); // } - mIsPlaying = FALSE ; + mIsPlaying = FALSE; } void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) @@ -3387,29 +3387,29 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) { if(mID == facep->getTexture()->getID()) //this is a parcel media { - return ; //let the prim media win. + return; //let the prim media win. } } if(mIsPlaying) //old textures switch to the media texture { - facep->switchTexture(ch, this) ; + facep->switchTexture(ch, this); } else //switch to old textures. { - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te) { - LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ; + LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL; if(!tex && te->getID() != mID)//try parcel media. { - tex = gTextureList.findImage(mID) ; + tex = gTextureList.findImage(mID); } if(!tex) { - tex = LLViewerFetchedTexture::sDefaultImagep ; + tex = LLViewerFetchedTexture::sDefaultImagep; } - facep->switchTexture(ch, tex) ; + facep->switchTexture(ch, tex); } } } @@ -3419,36 +3419,36 @@ void LLViewerMediaTexture::setPlaying(BOOL playing) { if(!mMediaImplp) { - return ; + return; } if(!playing && !mIsPlaying) { - return ; //media is already off + return; //media is already off } if(playing == mIsPlaying && !mMediaImplp->isUpdated()) { - return ; //nothing has changed since last time. + return; //nothing has changed since last time. } - mIsPlaying = playing ; + mIsPlaying = playing; if(mIsPlaying) //is about to play this media { if(findFaces()) { //about to update all faces. - mMediaImplp->setUpdated(FALSE) ; + mMediaImplp->setUpdated(FALSE); } if(mMediaFaceList.empty())//no face pointing to this media { - stopPlaying() ; - return ; + stopPlaying(); + return; } for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - switchTexture(LLRender::DIFFUSE_MAP, *iter) ; + switchTexture(LLRender::DIFFUSE_MAP, *iter); } } else //stop playing this media @@ -3456,12 +3456,12 @@ void LLViewerMediaTexture::setPlaying(BOOL playing) U32 ch = LLRender::DIFFUSE_MAP; llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = mNumFaces[ch] ; i ; i--) + for(U32 i = mNumFaces[ch]; i; i--) { - switchTexture(ch, mFaceList[ch][i - 1]) ; //current face could be removed in this function. + switchTexture(ch, mFaceList[ch][i - 1]); //current face could be removed in this function. } } - return ; + return; } //virtual @@ -3469,13 +3469,13 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() { if(LLFrameTimer::getFrameCount() == mUpdateVirtualSizeTime) { - return mMaxVirtualSize ; + return mMaxVirtualSize; } - mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount() ; + mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount(); if(!mMaxVirtualSizeResetCounter) { - addTextureStats(0.f, FALSE) ;//reset + addTextureStats(0.f, FALSE);//reset } if(mIsPlaying) //media is playing @@ -3483,28 +3483,28 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) { llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = 0 ; i < mNumFaces[ch] ; i++) + for(U32 i = 0; i < mNumFaces[ch]; i++) { - LLFace* facep = mFaceList[ch][i] ; + LLFace* facep = mFaceList[ch][i]; if(facep->getDrawable()->isRecentlyVisible()) { - addTextureStats(facep->getVirtualSize()) ; + addTextureStats(facep->getVirtualSize()); } } } } else //media is not in playing { - findFaces() ; + findFaces(); if(!mMediaFaceList.empty()) { for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - LLFace* facep = *iter ; + LLFace* facep = *iter; if(facep->getDrawable()->isRecentlyVisible()) { - addTextureStats(facep->getVirtualSize()) ; + addTextureStats(facep->getVirtualSize()); } } } @@ -3514,10 +3514,10 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() { mMaxVirtualSizeResetCounter--; } - reorganizeFaceList() ; + reorganizeFaceList(); reorganizeVolumeList(); - return mMaxVirtualSize ; + return mMaxVirtualSize; } //---------------------------------------------------------------------------------------------- //end of LLViewerMediaTexture @@ -3528,27 +3528,27 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() //---------------------------------------------------------------------------------------------- LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWithSession(sTesterName) { - addMetric("TotalBytesLoaded") ; - addMetric("TotalBytesLoadedFromCache") ; - addMetric("TotalBytesLoadedForLargeImage") ; - addMetric("TotalBytesLoadedForSculpties") ; - addMetric("StartFetchingTime") ; - addMetric("TotalGrayTime") ; - addMetric("TotalStablizingTime") ; - addMetric("StartTimeLoadingSculpties") ; - addMetric("EndTimeLoadingSculpties") ; - - addMetric("Time") ; - addMetric("TotalBytesBound") ; - addMetric("TotalBytesBoundForLargeImage") ; - addMetric("PercentageBytesBound") ; + addMetric("TotalBytesLoaded"); + addMetric("TotalBytesLoadedFromCache"); + addMetric("TotalBytesLoadedForLargeImage"); + addMetric("TotalBytesLoadedForSculpties"); + addMetric("StartFetchingTime"); + addMetric("TotalGrayTime"); + addMetric("TotalStablizingTime"); + addMetric("StartTimeLoadingSculpties"); + addMetric("EndTimeLoadingSculpties"); + + addMetric("Time"); + addMetric("TotalBytesBound"); + addMetric("TotalBytesBoundForLargeImage"); + addMetric("PercentageBytesBound"); - mTotalBytesLoaded = 0 ; - mTotalBytesLoadedFromCache = 0 ; - mTotalBytesLoadedForLargeImage = 0 ; - mTotalBytesLoadedForSculpties = 0 ; + mTotalBytesLoaded = (S32Bytes)0; + mTotalBytesLoadedFromCache = (S32Bytes)0; + mTotalBytesLoadedForLargeImage = (S32Bytes)0; + mTotalBytesLoadedForSculpties = (S32Bytes)0; - reset() ; + reset(); } LLTexturePipelineTester::~LLTexturePipelineTester() @@ -3558,222 +3558,222 @@ LLTexturePipelineTester::~LLTexturePipelineTester() void LLTexturePipelineTester::update() { - mLastTotalBytesUsed = mTotalBytesUsed ; - mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage ; - mTotalBytesUsed = 0 ; - mTotalBytesUsedForLargeImage = 0 ; + mLastTotalBytesUsed = mTotalBytesUsed; + mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage; + mTotalBytesUsed = (S32Bytes)0; + mTotalBytesUsedForLargeImage = (S32Bytes)0; if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty { if(mPause) { //start a new fetching session - reset() ; - mStartFetchingTime = LLImageGL::sLastFrameTime ; - mPause = FALSE ; + reset(); + mStartFetchingTime = LLImageGL::sLastFrameTime; + mPause = FALSE; } //update total gray time if(mUsingDefaultTexture) { - mUsingDefaultTexture = FALSE ; - mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime ; + mUsingDefaultTexture = FALSE; + mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime; } //update the stablizing timer. - updateStablizingTime() ; + updateStablizingTime(); - outputTestResults() ; + outputTestResults(); } else if(!mPause) { //stop the current fetching session - mPause = TRUE ; - outputTestResults() ; - reset() ; + mPause = TRUE; + outputTestResults(); + reset(); } } void LLTexturePipelineTester::reset() { - mPause = TRUE ; + mPause = TRUE; - mUsingDefaultTexture = FALSE ; - mStartStablizingTime = 0.0f ; - mEndStablizingTime = 0.0f ; + mUsingDefaultTexture = FALSE; + mStartStablizingTime = 0.0f; + mEndStablizingTime = 0.0f; - mTotalBytesUsed = 0 ; - mTotalBytesUsedForLargeImage = 0 ; - mLastTotalBytesUsed = 0 ; - mLastTotalBytesUsedForLargeImage = 0 ; + mTotalBytesUsed = (S32Bytes)0; + mTotalBytesUsedForLargeImage = (S32Bytes)0; + mLastTotalBytesUsed = (S32Bytes)0; + mLastTotalBytesUsedForLargeImage = (S32Bytes)0; - mStartFetchingTime = 0.0f ; + mStartFetchingTime = 0.0f; - mTotalGrayTime = 0.0f ; - mTotalStablizingTime = 0.0f ; + mTotalGrayTime = 0.0f; + mTotalStablizingTime = 0.0f; - mStartTimeLoadingSculpties = 1.0f ; - mEndTimeLoadingSculpties = 0.0f ; + mStartTimeLoadingSculpties = 1.0f; + mEndTimeLoadingSculpties = 0.0f; } //virtual void LLTexturePipelineTester::outputTestRecord(LLSD *sd) { std::string currentLabel = getCurrentLabelName(); - (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ; - (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ; - (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ; - (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ; + (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded.value(); + (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache.value(); + (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage.value(); + (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties.value(); - (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ; - (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ; - (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ; + (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime; + (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime; + (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime; - (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ; - (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ; + (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties; + (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties; - (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime ; - (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ; - (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ; - (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ; + (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime; + (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed.value(); + (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage.value(); + (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded); } void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep) { - U32 mem_size = (U32)imagep->getTextureMemory() ; - mTotalBytesUsed += mem_size ; + U32Bytes mem_size = imagep->getTextureMemory(); + mTotalBytesUsed += mem_size; - if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size / (U32)imagep->getComponents())) + if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size.value() / (U32)imagep->getComponents())) { - mTotalBytesUsedForLargeImage += mem_size ; + mTotalBytesUsedForLargeImage += mem_size; } } void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) { - U32 data_size = (U32)raw_imagep->getDataSize() ; - mTotalBytesLoaded += data_size ; + U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize(); + mTotalBytesLoaded += data_size; if(from_cache) { - mTotalBytesLoadedFromCache += data_size ; + mTotalBytesLoadedFromCache += data_size; } - if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size / (U32)raw_imagep->getComponents())) + if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size.value() / (U32)raw_imagep->getComponents())) { - mTotalBytesLoadedForLargeImage += data_size ; + mTotalBytesLoadedForLargeImage += data_size; } if(imagep->forSculpt()) { - mTotalBytesLoadedForSculpties += data_size ; + mTotalBytesLoadedForSculpties += data_size; if(mStartTimeLoadingSculpties > mEndTimeLoadingSculpties) { - mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime ; + mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime; } - mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime ; + mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime; } } void LLTexturePipelineTester::updateGrayTextureBinding() { - mUsingDefaultTexture = TRUE ; + mUsingDefaultTexture = TRUE; } void LLTexturePipelineTester::setStablizingTime() { if(mStartStablizingTime <= mStartFetchingTime) { - mStartStablizingTime = LLImageGL::sLastFrameTime ; + mStartStablizingTime = LLImageGL::sLastFrameTime; } - mEndStablizingTime = LLImageGL::sLastFrameTime ; + mEndStablizingTime = LLImageGL::sLastFrameTime; } void LLTexturePipelineTester::updateStablizingTime() { if(mStartStablizingTime > mStartFetchingTime) { - F32 t = mEndStablizingTime - mStartStablizingTime ; + F32 t = mEndStablizingTime - mStartStablizingTime; if(t > F_ALMOST_ZERO && (t - mTotalStablizingTime) < F_ALMOST_ZERO) { //already stablized - mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime ; + mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime; //cancel the timer - mStartStablizingTime = 0.f ; - mEndStablizingTime = 0.f ; + mStartStablizingTime = 0.f; + mEndStablizingTime = 0.f; } else { - mTotalStablizingTime = t ; + mTotalStablizingTime = t; } } - mTotalStablizingTime = 0.f ; + mTotalStablizingTime = 0.f; } //virtual void LLTexturePipelineTester::compareTestSessions(std::ofstream* os) { - LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp) ; - LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp) ; + LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp); + LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp); if(!base_sessionp || !current_sessionp) { - LL_ERRS() << "type of test session does not match!" << LL_ENDL ; + LL_ERRS() << "type of test session does not match!" << LL_ENDL; } //compare and output the comparison - *os << llformat("%s\n", getTesterName().c_str()) ; - *os << llformat("AggregateResults\n") ; + *os << llformat("%s\n", getTesterName().c_str()); + *os << llformat("AggregateResults\n"); - compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime) ; - compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime) ; + compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime); + compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime); compareTestResults(os, "TotalStablizingTime", base_sessionp->mTotalStablizingTime, current_sessionp->mTotalStablizingTime); - compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties) ; - compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties) ; + compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties); + compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties); - compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded) ; - compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache) ; - compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage) ; - compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties) ; + compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded); + compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache); + compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage); + compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties); - *os << llformat("InstantResults\n") ; - S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter) ; - for(S32 i = 0 ; i < size ; i++) + *os << llformat("InstantResults\n"); + S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter); + for(S32 i = 0; i < size; i++) { - *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime); compareTestResults(os, "AverageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); compareTestResults(os, "AverageBytesUsedForLargeImagePerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); compareTestResults(os, "AveragePercentageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } if(size < base_sessionp->mInstantPerformanceListCounter) { - for(S32 i = size ; i < base_sessionp->mInstantPerformanceListCounter ; i++) + for(S32 i = size; i < base_sessionp->mInstantPerformanceListCounter; i++) { - *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime); - *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; - *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); + *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); + *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } } else if(size < current_sessionp->mInstantPerformanceListCounter) { - for(S32 i = size ; i < current_sessionp->mInstantPerformanceListCounter ; i++) + for(S32 i = size; i < current_sessionp->mInstantPerformanceListCounter; i++) { - *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime); - *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; - *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); + *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); + *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } } } @@ -3781,144 +3781,144 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os) //virtual LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log) { - LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession() ; + LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession(); if(!sessionp) { - return NULL ; + return NULL; } - F32 total_fetching_time = 0.f ; - F32 total_gray_time = 0.f ; - F32 total_stablizing_time = 0.f ; - F32 total_loading_sculpties_time = 0.f ; - - F32 start_fetching_time = -1.f ; - F32 start_fetching_sculpties_time = 0.f ; - - F32 last_time = 0.0f ; - S32 frame_count = 0 ; - - sessionp->mInstantPerformanceListCounter = 0 ; - sessionp->mInstantPerformanceList.resize(128) ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; + F32 total_fetching_time = 0.f; + F32 total_gray_time = 0.f; + F32 total_stablizing_time = 0.f; + F32 total_loading_sculpties_time = 0.f; + + F32 start_fetching_time = -1.f; + F32 start_fetching_sculpties_time = 0.f; + + F32 last_time = 0.0f; + S32 frame_count = 0; + + sessionp->mInstantPerformanceListCounter = 0; + sessionp->mInstantPerformanceList.resize(128); + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; //load a session std::string currentLabel = getCurrentLabelName(); - BOOL in_log = (*log).has(currentLabel) ; + BOOL in_log = (*log).has(currentLabel); while (in_log) { - LLSD::String label = currentLabel ; + LLSD::String label = currentLabel; if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size()) { - sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128) ; + sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128); } //time - F32 start_time = (*log)[label]["StartFetchingTime"].asReal() ; - F32 cur_time = (*log)[label]["Time"].asReal() ; + F32 start_time = (*log)[label]["StartFetchingTime"].asReal(); + F32 cur_time = (*log)[label]["Time"].asReal(); if(start_time - start_fetching_time > F_ALMOST_ZERO) //fetching has paused for a while { - sessionp->mTotalFetchingTime += total_fetching_time ; - sessionp->mTotalGrayTime += total_gray_time ; - sessionp->mTotalStablizingTime += total_stablizing_time ; + sessionp->mTotalFetchingTime += total_fetching_time; + sessionp->mTotalGrayTime += total_gray_time; + sessionp->mTotalStablizingTime += total_stablizing_time; - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time ; - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time ; + sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; + sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; - start_fetching_time = start_time ; - total_fetching_time = 0.0f ; - total_gray_time = 0.f ; - total_stablizing_time = 0.f ; - total_loading_sculpties_time = 0.f ; + start_fetching_time = start_time; + total_fetching_time = 0.0f; + total_gray_time = 0.f; + total_stablizing_time = 0.f; + total_loading_sculpties_time = 0.f; } else { - total_fetching_time = cur_time - start_time ; - total_gray_time = (*log)[label]["TotalGrayTime"].asReal() ; - total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal() ; + total_fetching_time = cur_time - start_time; + total_gray_time = (*log)[label]["TotalGrayTime"].asReal(); + total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal(); - total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal() ; + total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal(); if(start_fetching_sculpties_time < 0.f && total_loading_sculpties_time > 0.f) { - start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal() ; + start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal(); } } //total loaded bytes - sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger() ; - sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger() ; - sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger() ; - sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger() ; + sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger(); + sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger(); + sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger(); + sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger(); //instant metrics sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond += - (*log)[label]["TotalBytesBound"].asInteger() ; + (*log)[label]["TotalBytesBound"].asInteger(); sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond += - (*log)[label]["TotalBytesBoundForLargeImage"].asInteger() ; + (*log)[label]["TotalBytesBoundForLargeImage"].asInteger(); sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond += - (*log)[label]["PercentageBytesBound"].asReal() ; - frame_count++ ; + (*log)[label]["PercentageBytesBound"].asReal(); + frame_count++; if(cur_time - last_time >= 1.0f) { - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time ; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time; - frame_count = 0 ; - last_time = cur_time ; - sessionp->mInstantPerformanceListCounter++ ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; + frame_count = 0; + last_time = cur_time; + sessionp->mInstantPerformanceListCounter++; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; } // Next label - incrementCurrentCount() ; + incrementCurrentCount(); currentLabel = getCurrentLabelName(); - in_log = (*log).has(currentLabel) ; + in_log = (*log).has(currentLabel); } - sessionp->mTotalFetchingTime += total_fetching_time ; - sessionp->mTotalGrayTime += total_gray_time ; - sessionp->mTotalStablizingTime += total_stablizing_time ; + sessionp->mTotalFetchingTime += total_fetching_time; + sessionp->mTotalGrayTime += total_gray_time; + sessionp->mTotalStablizingTime += total_stablizing_time; if(sessionp->mStartTimeLoadingSculpties < 0.f) { - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time ; + sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; } - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time ; + sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; return sessionp; } LLTexturePipelineTester::LLTextureTestSession::LLTextureTestSession() { - reset() ; + reset(); } LLTexturePipelineTester::LLTextureTestSession::~LLTextureTestSession() { } void LLTexturePipelineTester::LLTextureTestSession::reset() { - mTotalFetchingTime = 0.0f ; + mTotalFetchingTime = 0.0f; - mTotalGrayTime = 0.0f ; - mTotalStablizingTime = 0.0f ; + mTotalGrayTime = 0.0f; + mTotalStablizingTime = 0.0f; - mStartTimeLoadingSculpties = 0.0f ; - mTotalTimeLoadingSculpties = 0.0f ; + mStartTimeLoadingSculpties = 0.0f; + mTotalTimeLoadingSculpties = 0.0f; - mTotalBytesLoaded = 0 ; - mTotalBytesLoadedFromCache = 0 ; - mTotalBytesLoadedForLargeImage = 0 ; - mTotalBytesLoadedForSculpties = 0 ; + mTotalBytesLoaded = 0; + mTotalBytesLoadedFromCache = 0; + mTotalBytesLoadedForLargeImage = 0; + mTotalBytesLoadedForSculpties = 0; - mInstantPerformanceListCounter = 0 ; + mInstantPerformanceListCounter = 0; } //---------------------------------------------------------------------------------------------- //end of LLTexturePipelineTester diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 9a00ccd8c6..b12b988513 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -38,8 +38,8 @@ #include <map> #include <list> -extern const S32Mibibytes gMinVideoRam; -extern const S32Mibibytes gMaxVideoRam; +extern const S32Megabytes gMinVideoRam; +extern const S32Megabytes gMaxVideoRam; class LLImageGL ; class LLImageRaw; @@ -207,8 +207,8 @@ public: static F32 sDesiredDiscardScale; static S32Bytes sBoundTextureMemory; static S32Bytes sTotalTextureMemory; - static S32Mibibytes sMaxBoundTextureMem; - static S32Mibibytes sMaxTotalTextureMem; + static S32Megabytes sMaxBoundTextureMem; + static S32Megabytes sMaxTotalTextureMem; static S32Bytes sMaxDesiredTextureMem ; static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; @@ -690,18 +690,18 @@ private: private: BOOL mUsingDefaultTexture; //if set, some textures are still gray. - U32 mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. - U32 mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. - U32 mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame. - U32 mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256. + U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. + U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. + U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame. + U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256. // //data size // - U32 mTotalBytesLoaded ; //total bytes fetched by texture pipeline - U32 mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache - U32 mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256. - U32 mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties + U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline + U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache + U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256. + U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties // //time diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index f4dc04bd51..21da915f97 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -85,11 +85,11 @@ void LLViewerTextureList::init() mInitialized = TRUE ; sNumImages = 0; mUpdateStats = TRUE; - mMaxResidentTexMemInMegaBytes = 0; - mMaxTotalTextureMemInMegaBytes = 0 ; + mMaxResidentTexMemInMegaBytes = (U32Bytes)0; + mMaxTotalTextureMemInMegaBytes = (U32Bytes)0; // Update how much texture RAM we're allowed to use. - updateMaxResidentTexMem(S32Mibibytes(0)); // 0 = use current + updateMaxResidentTexMem(S32Megabytes(0)); // 0 = use current doPreloadImages(); } @@ -662,7 +662,7 @@ void LLViewerTextureList::updateImages(F32 max_time) } cleared = FALSE; - LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED)); + LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED).value()); { using namespace LLStatViewer; @@ -1231,23 +1231,23 @@ const S32 MIN_VIDEO_RAM = 32; const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons. // Returns min setting for TextureMemory (in MB) -S32Mibibytes LLViewerTextureList::getMinVideoRamSetting() +S32Megabytes LLViewerTextureList::getMinVideoRamSetting() { - S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped(); + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); //min texture mem sets to 64M if total physical mem is more than 1.5GB - return (system_ram > S32Mibibytes(1500)) ? S32Mibibytes(64) : gMinVideoRam ; + return (system_ram > S32Megabytes(1500)) ? S32Megabytes(64) : gMinVideoRam ; } //static // Returns max setting for TextureMemory (in MB) -S32Mibibytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) +S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) { - S32Mibibytes max_texmem; + S32Megabytes max_texmem; if (gGLManager.mVRAM != 0) { // Treat any card with < 32 MB (shudder) as having 32 MB // - it's going to be swapping constantly regardless - S32Mibibytes max_vram(gGLManager.mVRAM); + S32Megabytes max_vram(gGLManager.mVRAM); if(gGLManager.mIsATI) { @@ -1264,21 +1264,21 @@ S32Mibibytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) { if (!get_recommended) { - max_texmem = 512; + max_texmem = (S32Megabytes)512; } else if (gSavedSettings.getBOOL("NoHardwareProbe")) //did not do hardware detection at startup { - max_texmem = 512; + max_texmem = (S32Megabytes)512; } else { - max_texmem = 128; + max_texmem = (S32Megabytes)128; } LL_WARNS() << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << LL_ENDL; } - S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped(); // In MB + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); // In MB //LL_INFOS() << "*** DETECTED " << system_ram << " MB of system memory." << LL_ENDL; if (get_recommended) max_texmem = llmin(max_texmem, system_ram/2); @@ -1290,25 +1290,25 @@ S32Mibibytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) return max_texmem; } -const S32Mibibytes VIDEO_CARD_FRAMEBUFFER_MEM(12); -const S32Mibibytes MIN_MEM_FOR_NON_TEXTURE(512); -void LLViewerTextureList::updateMaxResidentTexMem(S32Mibibytes mem) +const S32Megabytes VIDEO_CARD_FRAMEBUFFER_MEM(12); +const S32Megabytes MIN_MEM_FOR_NON_TEXTURE(512); +void LLViewerTextureList::updateMaxResidentTexMem(S32Megabytes mem) { // Initialize the image pipeline VRAM settings - S32Mibibytes cur_mem(gSavedSettings.getS32("TextureMemory")); + S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory")); F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - S32Mibibytes default_mem(getMaxVideoRamSetting(true)); // recommended default - if (mem == 0) + S32Megabytes default_mem(getMaxVideoRamSetting(true)); // recommended default + if (mem == (S32Bytes)0) { - mem = cur_mem > 0 ? cur_mem : default_mem; + mem = cur_mem > (S32Bytes)0 ? cur_mem : default_mem; } - else if (mem < 0) + else if (mem < (S32Bytes)0) { mem = default_mem; } // limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise - mem = llmin(mem, S32Mibibytes(mem_multiplier * (F32Mibibytes)default_mem)); + mem = llmin(mem, S32Megabytes(mem_multiplier * (F32Megabytes)default_mem)); mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting()); if (mem != cur_mem) @@ -1320,23 +1320,23 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32Mibibytes mem) // TODO: set available resident texture mem based on use by other subsystems // currently max(12MB, VRAM/4) assumed... - S32Mibibytes vb_mem = mem; - S32Mibibytes fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); + S32Megabytes vb_mem = mem; + S32Megabytes fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); mMaxResidentTexMemInMegaBytes = (vb_mem - fb_mem) ; //in MB mMaxTotalTextureMemInMegaBytes = mMaxResidentTexMemInMegaBytes * 2; - if (mMaxResidentTexMemInMegaBytes > 640) + if (mMaxResidentTexMemInMegaBytes > (S32Megabytes)640) { mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes / 4); } //system mem - S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped(); + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); //minimum memory reserved for non-texture use. //if system_raw >= 1GB, reserve at least 512MB for non-texture use; //otherwise reserve half of the system_ram for non-texture use. - S32Mibibytes min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ; + S32Megabytes min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ; if (mMaxTotalTextureMemInMegaBytes > system_ram - min_non_texture_mem) { @@ -1364,16 +1364,16 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d char ip_string[256]; u32_to_ip_string(msg->getSenderIP(),ip_string); - U32 received_size ; + U32Bytes received_size ; if (msg->getReceiveCompressedSize()) { - received_size = msg->getReceiveCompressedSize() ; + received_size = (U32Bytes)msg->getReceiveCompressedSize() ; } else { - received_size = msg->getReceiveSize() ; + received_size = (U32Bytes)msg->getReceiveSize() ; } - add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, F64Bytes(received_size)); + add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, received_size); add(LLStatViewer::TEXTURE_PACKETS, 1); U8 codec; @@ -1437,14 +1437,14 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d char ip_string[256]; u32_to_ip_string(msg->getSenderIP(),ip_string); - U32 received_size ; + U32Bytes received_size ; if (msg->getReceiveCompressedSize()) { - received_size = msg->getReceiveCompressedSize() ; + received_size = (U32Bytes)msg->getReceiveCompressedSize() ; } else { - received_size = msg->getReceiveSize() ; + received_size = (U32Bytes)msg->getReceiveSize() ; } add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, F64Bytes(received_size)); @@ -1511,24 +1511,6 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void ** } } -/////////////////////////////////////////////////////////////////////////////// - -//static -const LLUnitImplicit<F32, LLUnits::Mibibytes> SIXTEEN_MEG(16); -S32Bytes LLViewerTextureList::calcMaxTextureRAM() -{ - // Decide the maximum amount of RAM we should allow the user to allocate to texture cache - LLMemoryInfo memory_info; - LLUnitImplicit<F32, LLUnits::Mibibytes> available_memory = memory_info.getPhysicalMemoryClamped(); - - // as originally written, this code was a no-op. Not sure of the side effect of making it actually work - /*clamp_rescale(available_memory.value(), - (SIXTEEN_MEG * 16), - (F32Mibibytes)U32_MAX, - (SIXTEEN_MEG * 4), - (F32Mibibytes)(U32_MAX >> 1));*/ - return available_memory; -} /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 9817fea811..835d750d94 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -71,7 +71,6 @@ public: static BOOL createUploadFile(const std::string& filename, const std::string& out_filename, const U8 codec); static LLPointer<LLImageJ2C> convertToUploadFile(LLPointer<LLImageRaw> raw_image); static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data ); - static S32Bytes calcMaxTextureRAM(); static void receiveImageHeader(LLMessageSystem *msg, void **user_data); static void receiveImagePacket(LLMessageSystem *msg, void **user_data); @@ -101,11 +100,11 @@ public: void setUpdateStats(BOOL b) { mUpdateStats = b; } - S32Mibibytes getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } - S32Mibibytes getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} + S32Megabytes getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } + S32Megabytes getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} S32 getNumImages() { return mImageList.size(); } - void updateMaxResidentTexMem(S32Mibibytes mem); + void updateMaxResidentTexMem(S32Megabytes mem); void doPreloadImages(); void doPrefetchImages(); @@ -113,8 +112,8 @@ public: void clearFetchingRequests(); void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level); - static S32Mibibytes getMinVideoRamSetting(); - static S32Mibibytes getMaxVideoRamSetting(bool get_recommended = false); + static S32Megabytes getMinVideoRamSetting(); + static S32Megabytes getMaxVideoRamSetting(bool get_recommended = false); private: void updateImagesDecodePriorities(); @@ -200,8 +199,8 @@ private: BOOL mInitialized ; BOOL mUpdateStats; - S32Mibibytes mMaxResidentTexMemInMegaBytes; - S32Mibibytes mMaxTotalTextureMemInMegaBytes; + S32Megabytes mMaxResidentTexMemInMegaBytes; + S32Megabytes mMaxTotalTextureMemInMegaBytes; LLFrameTimer mForceDecodeTimer; private: diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1e60b59932..5509c6e0e5 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -736,9 +736,9 @@ public: U32 old_y = ypos ; for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++) { - if(gTotalTextureBytesPerBoostLevel[i] > 0) + if(gTotalTextureBytesPerBoostLevel[i] > (S32Bytes)0) { - addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, F32Mibibytes(gTotalTextureBytesPerBoostLevel[i]).value())); + addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, F32Megabytes(gTotalTextureBytesPerBoostLevel[i]).value())); ypos += y_inc; } } diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index 9b55bbf277..895ceed880 100755 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -52,19 +52,19 @@ LLVLManager::~LLVLManager() mPacketData.clear(); } -void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size) +void LLVLManager::addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size) { if (LAND_LAYER_CODE == vl_datap->mType) { - mLandBits += mesg_size * 8; + mLandBits += mesg_size; } else if (WIND_LAYER_CODE == vl_datap->mType) { - mWindBits += mesg_size * 8; + mWindBits += mesg_size; } else if (CLOUD_LAYER_CODE == vl_datap->mType) { - mCloudBits += mesg_size * 8; + mCloudBits += mesg_size; } else { @@ -112,25 +112,25 @@ void LLVLManager::unpackData(const S32 num_packets) void LLVLManager::resetBitCounts() { - mLandBits = mWindBits = mCloudBits = 0; + mLandBits = mWindBits = mCloudBits = (S32Bits)0; } -S32 LLVLManager::getLandBits() const +U32Bits LLVLManager::getLandBits() const { return mLandBits; } -S32 LLVLManager::getWindBits() const +U32Bits LLVLManager::getWindBits() const { return mWindBits; } -S32 LLVLManager::getCloudBits() const +U32Bits LLVLManager::getCloudBits() const { return mCloudBits; } -S32 LLVLManager::getTotalBytes() const +S32Bytes LLVLManager::getTotalBytes() const { return mLandBits + mWindBits + mCloudBits; } diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h index 0733aebaae..5e7fadc522 100755 --- a/indra/newview/llvlmanager.h +++ b/indra/newview/llvlmanager.h @@ -39,15 +39,15 @@ class LLVLManager public: ~LLVLManager(); - void addLayerData(LLVLData *vl_datap, const S32 mesg_size); + void addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size); void unpackData(const S32 num_packets = 10); - S32 getTotalBytes() const; + S32Bytes getTotalBytes() const; - S32 getLandBits() const; - S32 getWindBits() const; - S32 getCloudBits() const; + U32Bits getLandBits() const; + U32Bits getWindBits() const; + U32Bits getCloudBits() const; void resetBitCounts(); @@ -55,9 +55,9 @@ public: protected: std::vector<LLVLData *> mPacketData; - U32 mLandBits; - U32 mWindBits; - U32 mCloudBits; + U32Bits mLandBits; + U32Bits mWindBits; + U32Bits mCloudBits; }; class LLVLData diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5971da95ce..724ba3c85e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4175,9 +4175,9 @@ std::string LLVOAvatar::bakedTextureOriginInfo() return result; } -S32 LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids) +S32Bytes LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids) { - S32 result = 0; + S32Bytes result(0); for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); @@ -4242,12 +4242,12 @@ void LLVOAvatar::collectTextureUUIDs(std::set<LLUUID>& ids) void LLVOAvatar::releaseOldTextures() { - S32 current_texture_mem = 0; + S32Bytes current_texture_mem; // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" std::set<LLUUID> baked_texture_ids; collectBakedTextureUUIDs(baked_texture_ids); - S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + S32Bytes new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); std::set<LLUUID> local_texture_ids; collectLocalTextureUUIDs(local_texture_ids); @@ -4256,7 +4256,7 @@ void LLVOAvatar::releaseOldTextures() std::set<LLUUID> new_texture_ids; new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); - S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + S32Bytes new_total_mem = totalTextureMemForUUIDS(new_texture_ids); //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << LL_ENDL; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2c86ed63d1..b600d2a8f1 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -128,29 +128,29 @@ protected: public: /*virtual*/ void updateGL(); /*virtual*/ LLVOAvatar* asAvatar(); - virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, - const EObjectUpdateType update_type, - LLDataPacker *dp); - virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, + void **user_data, + U32 block_num, + const EObjectUpdateType update_type, + LLDataPacker *dp); + virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); /*virtual*/ BOOL updateLOD(); - BOOL updateJointLODs(); - void updateLODRiggedAttachments( void ); + BOOL updateJointLODs(); + void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - S32 totalTextureMemForUUIDS(std::set<LLUUID>& ids); - bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; - bool allLocalTexturesCompletelyDownloaded() const; - bool allBakedTexturesCompletelyDownloaded() const; - void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, - S32 &both_count, S32 &neither_count); - std::string bakedTextureOriginInfo(); - void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const; - void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const; - void collectTextureUUIDs(std::set<LLUUID>& ids); - void releaseOldTextures(); + S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids); + bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; + bool allLocalTexturesCompletelyDownloaded() const; + bool allBakedTexturesCompletelyDownloaded() const; + void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, + S32 &both_count, S32 &neither_count); + std::string bakedTextureOriginInfo(); + void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const; + void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const; + void collectTextureUUIDs(std::set<LLUUID>& ids); + void releaseOldTextures(); /*virtual*/ void updateTextures(); - LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); + LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index db6d2d6fe9..e36bed3e5b 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -142,7 +142,7 @@ struct LocalTextureData //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -S32 LLVOAvatarSelf::sScratchTexBytes = 0; +S32Bytes LLVOAvatarSelf::sScratchTexBytes(0); std::map< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames; @@ -3067,13 +3067,13 @@ void LLVOAvatarSelf::deleteScratchTextures() stop_glerror(); } - if( sScratchTexBytes ) + if( sScratchTexBytes.value() ) { - LL_DEBUGS() << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << LL_ENDL; + LL_DEBUGS() << "Clearing Scratch Textures " << (S32Kilobytes)sScratchTexBytes << LL_ENDL; delete_and_clear(sScratchTexNames); LLImageGL::sGlobalTextureMemory -= sScratchTexBytes; - sScratchTexBytes = 0; + sScratchTexBytes = S32Bytes(0); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index be98f8dfa9..9e9e2b61d7 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -276,7 +276,7 @@ public: public: static void deleteScratchTextures(); private: - static S32 sScratchTexBytes; + static S32Bytes sScratchTexBytes; static std::map< LLGLenum, LLGLuint*> sScratchTexNames; /** Textures diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 1f346b2928..e226583097 100755 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -46,7 +46,7 @@ const F32 MAX_PART_LIFETIME = 120.f; -extern LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime; +extern U64MicrosecondsImplicit gFrameTime; LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL; S32 LLVOPartGroup::sVBSlotFree[]; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 9d727dafbe..2c160754a6 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -727,7 +727,7 @@ void LLWorld::updateNetStats() regionp->updateNetStats(); bits += regionp->mBitsReceived; packets += llfloor( regionp->mPacketsReceived ); - regionp->mBitsReceived = 0.f; + regionp->mBitsReceived = (F32Bits)0.f; regionp->mPacketsReceived = 0.f; } @@ -977,12 +977,12 @@ LLViewerTexture* LLWorld::getDefaultWaterTexture() return mDefaultWaterTexturep; } -void LLWorld::setSpaceTimeUSec(const LLUnitImplicit<U64, LLUnits::Microseconds> space_time_usec) +void LLWorld::setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec) { mSpaceTimeUSec = space_time_usec; } -LLUnitImplicit<U64, LLUnits::Microseconds> LLWorld::getSpaceTimeUSec() const +U64MicrosecondsImplicit LLWorld::getSpaceTimeUSec() const { return mSpaceTimeUSec; } diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index c74ac3fa6f..287e41d323 100755 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -141,8 +141,8 @@ public: void waterHeightRegionInfo(std::string const& sim_name, F32 water_height); void shiftRegions(const LLVector3& offset); - void setSpaceTimeUSec(const LLUnitImplicit<U64, LLUnits::Microseconds> space_time_usec); - LLUnitImplicit<U64, LLUnits::Microseconds> getSpaceTimeUSec() const; + void setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec); + U64MicrosecondsImplicit getSpaceTimeUSec() const; void getInfo(LLSD& info); U32 getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;} @@ -189,7 +189,7 @@ private: S32 mLastPacketsOut; S32 mLastPacketsLost; U32 mNumOfActiveCachedObjects; - LLUnitImplicit<U64, LLUnits::Microseconds> mSpaceTimeUSec; + U64MicrosecondsImplicit mSpaceTimeUSec; BOOL mClassicCloudsEnabled; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6754918149..a64747742f 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3015,7 +3015,7 @@ void LLPipeline::updateGeom(F32 max_dtime) S32 count = 0; - max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, LLUnitImplicit<F32, LLUnits::Seconds>(max_dtime)); + max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, F32SecondsImplicit(max_dtime)); LLSpatialGroup* last_group = NULL; LLSpatialBridge* last_bridge = NULL; |