llcommon merge. Added LLUnits.

This commit is contained in:
Shyotl
2016-04-06 01:31:20 -05:00
parent 0fa7848b19
commit 0841479ccc
66 changed files with 1895 additions and 621 deletions

View File

@@ -279,7 +279,7 @@ BOOL gUseWireframe = FALSE;
LLVFS* gStaticVFS = NULL;
LLMemoryInfo gSysMemory;
U64 gMemoryAllocated = 0; // updated in display_stats() in llviewerdisplay.cpp
U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp
std::string gLastVersionChannel;
@@ -955,9 +955,8 @@ bool LLAppViewer::init()
// get RAM data from XML
std::stringstream minRAMString(LLNotificationTemplates::instance().getGlobalString("UnsupportedRAMAmount"));
U64 minRAM = 0;
U64Bytes minRAM;
minRAMString >> minRAM;
minRAM = minRAM * 1024 * 1024;
if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
{
@@ -1037,7 +1036,7 @@ void LLAppViewer::initMaxHeapSize()
//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") ;
//This is all a bunch of CRAP. We run LAA on windows. 64bit windows supports LAA out of the box. 32bit does not, unless PAE is on.
#if LL_WINDOWS
@@ -1051,7 +1050,7 @@ void LLAppViewer::initMaxHeapSize()
if(fnIsWow64Process && fnIsWow64Process(GetCurrentProcess(), &bWow64Process) && bWow64Process)
{
max_heap_size_gb = 3.7f;
max_heap_size_gb = F32Gigabytes(3.7f);
}
else if(ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management"), &hKey))
{
@@ -1060,7 +1059,7 @@ void LLAppViewer::initMaxHeapSize()
if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("PhysicalAddressExtension"), NULL, NULL, (LPBYTE)&dwResult, &dwSize))
{
if(dwResult)
max_heap_size_gb = 3.7f;
max_heap_size_gb = F32Gigabytes(3.7f);
}
RegCloseKey(hKey);
}
@@ -2694,8 +2693,8 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB());
gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value());
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

View File

@@ -333,7 +333,7 @@ extern BOOL gUseWireframe;
extern LLVFS *gStaticVFS;
extern LLMemoryInfo gSysMemory;
extern U64 gMemoryAllocated;
extern U64Bytes gMemoryAllocated;
extern std::string gLastVersionChannel;

View File

@@ -676,7 +676,7 @@ void LLFeatureManager::applyBaseMasks()
maskFeatures(gpustr);
// now mask cpu type ones
if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024)
if (gSysMemory.getPhysicalMemoryClamped() <= U32Megabytes(256))
{
maskFeatures("RAM256MB");
}

View File

@@ -233,7 +233,7 @@ LLFloaterAbout::LLFloaterAbout()
else
support.append(" None\n"); */
U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024;
U32Megabytes memory = gSysMemory.getPhysicalMemoryKB();
// Moved hack adjustment to Windows memory size into llsys.cpp
std::string mem_text = llformat("Memory: %u MB\n", memory );

View File

@@ -472,9 +472,13 @@ void LLPanelDisplay::refreshEnabledState()
mWindowSizeLabel->setVisible(!isFullScreen);
mCtrlWindowSize->setVisible(!isFullScreen);
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier);
// Hardware tab
getChild<LLUICtrl>("GrapicsCardTextureMemory")->setMinValue(LLViewerTextureList::getMinVideoRamSetting());
getChild<LLUICtrl>("GrapicsCardTextureMemory")->setMaxValue(LLViewerTextureList::getMaxVideoRamSetting());
getChild<LLUICtrl>("GrapicsCardTextureMemory")->setMinValue(min_tex_mem.value());
getChild<LLUICtrl>("GrapicsCardTextureMemory")->setMaxValue(max_tex_mem.value());
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") ||
!gGLManager.mHasVertexBufferObject)

View File

@@ -619,11 +619,25 @@ class LLVolumeGeometryManager: public LLGeometryManager
DISTANCE_SORT
} eSortType;
LLVolumeGeometryManager();
virtual ~LLVolumeGeometryManager();
virtual void rebuildGeom(LLSpatialGroup* group);
virtual void rebuildMesh(LLSpatialGroup* group);
virtual void getGeometry(LLSpatialGroup* group);
void genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE);
void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
private:
void allocateFaces(U32 pMaxFaceCount);
void freeFaces();
static int32_t sInstanceCount;
static LLFace** sFullbrightFaces;
static LLFace** sBumpFaces;
static LLFace** sSimpleFaces;
static LLFace** sNormFaces;
static LLFace** sSpecFaces;
static LLFace** sNormSpecFaces;
static LLFace** sAlphaFaces;
};
//spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp)

View File

@@ -129,8 +129,8 @@ public:
// debug
S32 getNumReads() { return mReaders.size(); }
S32 getNumWrites() { return mWriters.size(); }
S64 getUsage() { return mTexturesSizeTotal; }
S64 getMaxUsage() { return sCacheMaxTexturesSize; }
S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); }
S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); }
U32 getEntries() { return mHeaderEntriesInfo.mEntries; }
U32 getMaxEntries() { return sCacheMaxEntries; };
BOOL isInCache(const LLUUID& id) ;
@@ -202,7 +202,7 @@ private:
typedef std::map<LLUUID,S32> size_map_t;
size_map_t mTexturesSizeMap;
S64 mTexturesSizeTotal;
LLAtomic32<BOOL> mDoPurge;
LLAtomic32<bool> mDoPurge;
typedef std::map<S32, Entry> idx_entry_map_t;
idx_entry_map_t mUpdatedEntryMap;

View File

@@ -316,11 +316,11 @@ private:
U8 mImageCodec;
LLViewerAssetStats::duration_t mMetricsStartTime;
unsigned int mHttpReplySize; // Actual received data size
unsigned int mHttpReplyOffset; // Actual received data offset
U32 mHttpReplySize, // Actual received data size
mHttpReplyOffset; // Actual received data offset
// State history
U32 mCacheReadCount;
U32 mCacheWriteCount;
U32 mCacheReadCount,
mCacheWriteCount;
};
//////////////////////////////////////////////////////////////////////////////
@@ -425,7 +425,7 @@ public:
worker->setGetStatus(mStatus, mReason);
LL_WARNS() << "CURL GET FAILED, status:" << mStatus << " reason:" << mReason << LL_ENDL;
}
S32 data_size = worker->callbackHttpGet(mReplyOffset, mReplyLength, channels, buffer, partial, success);
S32BytesImplicit data_size = worker->callbackHttpGet(mReplyOffset, mReplyLength, channels, buffer, partial, success);
if(log_texture_traffic && data_size > 0)
{

View File

@@ -407,7 +407,7 @@ void LLTextureBar::draw()
default:;
};
std::string num_str = llformat("%4dx%4d (%+d) %7d %s", mImagep->getWidth(), mImagep->getHeight(),
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0, boost_lvl.c_str());
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory().value() : 0, boost_lvl.c_str());
LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
LLFontGL::LEFT, LLFontGL::TOP);
}
@@ -564,18 +564,18 @@ private:
void LLGLTexMemBar::draw()
{
S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes);
S32 max_bound_mem = LLViewerTexture::sMaxBoundTextureMemInMegaBytes;
S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sTotalTextureMemoryInBytes);
S32 max_total_mem = LLViewerTexture::sMaxTotalTextureMemInMegaBytes;
S32Megabytes bound_mem = LLViewerTexture::sBoundTextureMemory;
S32Megabytes max_bound_mem = LLViewerTexture::sMaxBoundTextureMemory;
S32Megabytes total_mem = LLViewerTexture::sTotalTextureMemory;
S32Megabytes max_total_mem = LLViewerTexture::sMaxTotalTextureMem;
F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
F32 cache_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getUsage()) ;
F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ;
S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
S32 v_offset = 0;
F32 total_texture_downloaded = (F32)gTotalTextureBytes / (1024 * 1024);
F32 total_object_downloaded = (F32)gTotalObjectBytes / (1024 * 1024);
U32 total_http_requests = LLAppViewer::getTextureFetch()->getTotalNumHTTPRequests() ;
F32 cache_usage = LLAppViewer::getTextureCache()->getUsage().valueInUnits<LLUnits::Megabytes>();
F32 cache_max_usage = LLAppViewer::getTextureCache()->getMaxUsage().valueInUnits<LLUnits::Megabytes>();
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;
F32Bytes total_object_downloaded = gTotalObjectData;
U32 total_http_requests = LLAppViewer::getTextureFetch()->getTotalNumHTTPRequests();
//----------------------------------------------------------------------------
LLGLSUIDefault gls_ui;
LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
@@ -588,10 +588,10 @@ void LLGLTexMemBar::draw()
global_raw_memory = *AIAccess<S32>(LLImageRaw::sGlobalRawMemory);
}
text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB FBO: %d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d",
total_mem,
max_total_mem,
bound_mem,
max_bound_mem,
total_mem.value(),
max_total_mem.value(),
bound_mem.value(),
max_bound_mem.value(),
LLRenderTarget::sBytesAllocated/(1024*1024),
global_raw_memory >> 20, discard_bias,
cache_usage, cache_max_usage, total_texture_downloaded, total_object_downloaded, total_http_requests);
@@ -890,7 +890,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()
@@ -1317,7 +1317,7 @@ void LLTextureSizeView::drawTextureCategoryGraph()
for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
{
U32 k = LLViewerTexture::getIndexFromCategory(i) ;
mTextureSizeBar[i]->setTop(LLImageGL::sTextureMemByCategory[k] >> 20, LLImageGL::sTextureMemByCategoryBound[k] >> 20, size_bar_scale) ;
mTextureSizeBar[i]->setTop(LLImageGL::sTextureMemByCategory[k].value() >> 20, LLImageGL::sTextureMemByCategoryBound[k].value() >> 20, size_bar_scale) ;
mTextureSizeBar[i]->draw() ;
}
LLImageGL::resetCurTexSizebar();
@@ -1335,7 +1335,7 @@ F32 LLTextureSizeView::drawTextureCategoryDistributionGraph()
S32 count = 0 ;
for(U32 i = 0 ; i < LLImageGL::sTextureMemByCategory.size() ; i++)
{
S32 tmp = LLImageGL::sTextureMemByCategory[i] >> 20 ;
S32 tmp = LLImageGL::sTextureMemByCategory[i].value() >> 20 ;
if(tmp > count)
{
count = tmp ;

View File

@@ -325,7 +325,7 @@ static bool handleMaxPartCountChanged(const LLSD& newvalue)
static bool handleVideoMemoryChanged(const LLSD& newvalue)
{
gTextureList.updateMaxResidentTexMem(newvalue.asInteger());
gTextureList.updateMaxResidentTexMem(S32Megabytes(newvalue.asInteger()));
return true;
}

View File

@@ -236,9 +236,9 @@ void display_stats()
F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
{
gMemoryAllocated = LLMemory::getCurrentRSS();
U32 memory = (U32)(gMemoryAllocated / (1024*1024));
LL_INFOS() << llformat("MEMORY: %d MB", memory) << LL_ENDL;
gMemoryAllocated = (U64Bytes)LLMemory::getCurrentRSS();
U32Megabytes memory = gMemoryAllocated;
LL_INFOS() << llformat("MEMORY: %d MB", memory.value()) << LL_ENDL;
LL_INFOS() << "THREADS: "<< LLThread::getCount() << LL_ENDL;
LL_INFOS() << "MALLOC: " << SGMemStat::getPrintableStat() <<LL_ENDL;
LLMemory::logMemoryInfo(TRUE) ;

View File

@@ -2809,7 +2809,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
LLSD args;
args["SUBJECT"] = subj;
args["MESSAGE"] = mes;
LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).timestamp(timestamp));
LLDate notice_date = LLDate(timestamp).notNull() ? LLDate(timestamp) : LLDate::now();
LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).timestamp(notice_date));
}
// Also send down the old path for now.
@@ -5162,18 +5163,18 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
// *TODO: Remove this dependency, or figure out a better way to handle
// this hack.
extern U32 gObjectBits;
extern U32Bits gObjectData;
void process_object_update(LLMessageSystem *mesgsys, void **user_data)
{
// Update the data counters
if (mesgsys->getReceiveCompressedSize())
{
gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
}
else
{
gObjectBits += mesgsys->getReceiveSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveSize();
}
// Update the object...
@@ -5185,11 +5186,11 @@ void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data
// Update the data counters
if (mesgsys->getReceiveCompressedSize())
{
gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
}
else
{
gObjectBits += mesgsys->getReceiveSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveSize();
}
// Update the object...
@@ -5201,11 +5202,11 @@ void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data)
// Update the data counters
if (mesgsys->getReceiveCompressedSize())
{
gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
}
else
{
gObjectBits += mesgsys->getReceiveSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveSize();
}
// Update the object...
@@ -5217,11 +5218,11 @@ void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_
{
if (mesgsys->getReceiveCompressedSize())
{
gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
}
else
{
gObjectBits += mesgsys->getReceiveSize() * 8;
gObjectData += (U32Bytes)mesgsys->getReceiveSize();
}
gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED);

View File

@@ -451,8 +451,8 @@ void output_statistics(void*)
LL_INFOS() << "Number of orphans: " << gObjectList.getOrphanCount() << LL_ENDL;
LL_INFOS() << "Number of dead objects: " << gObjectList.mNumDeadObjects << LL_ENDL;
LL_INFOS() << "Num images: " << gTextureList.getNumImages() << LL_ENDL;
LL_INFOS() << "Texture usage: " << LLImageGL::sGlobalTextureMemoryInBytes << LL_ENDL;
LL_INFOS() << "Texture working set: " << LLImageGL::sBoundTextureMemoryInBytes << LL_ENDL;
LL_INFOS() << "Texture usage: " << LLImageGL::sGlobalTextureMemory.value() << LL_ENDL;
LL_INFOS() << "Texture working set: " << LLImageGL::sBoundTextureMemory.value() << LL_ENDL;
LL_INFOS() << "Raw usage: " << global_raw_memory << LL_ENDL;
LL_INFOS() << "Formatted usage: " << LLImageFormatted::sGlobalFormattedMemory << LL_ENDL;
LL_INFOS() << "Zombie Viewer Objects: " << LLViewerObject::getNumZombieObjects() << LL_ENDL;
@@ -570,19 +570,25 @@ void output_statistics(void*)
}
U32 gTotalLandIn = 0, gTotalLandOut = 0;
U32 gTotalWaterIn = 0, gTotalWaterOut = 0;
U32 gTotalLandIn = 0,
gTotalLandOut = 0,
gTotalWaterIn = 0,
gTotalWaterOut = 0;
F32 gAveLandCompression = 0.f, gAveWaterCompression = 0.f;
F32 gBestLandCompression = 1.f, gBestWaterCompression = 1.f;
F32 gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f;
F32 gAveLandCompression = 0.f,
gAveWaterCompression = 0.f,
gBestLandCompression = 1.f,
gBestWaterCompression = 1.f,
gWorstLandCompression = 0.f,
gWorstWaterCompression = 0.f;
U32 gTotalWorldBytes = 0, gTotalObjectBytes = 0, gTotalTextureBytes = 0, gSimPingCount = 0;
U32 gObjectBits = 0;
F32 gAvgSimPing = 0.f;
U32 gTotalTextureBytesPerBoostLevel[LLGLTexture::MAX_GL_IMAGE_CATEGORY] = {0};
U32Bytes gTotalWorldData,
gTotalObjectData,
gTotalTextureData;
U32 gSimPingCount = 0;
U32Bits gObjectData;
F32Milliseconds gAvgSimPing(0.f);
U32Bytes gTotalTextureBytesPerBoostLevel[LLGLTexture::MAX_GL_IMAGE_CATEGORY] = {U32Bytes(0)};
extern U32 gVisCompared;
extern U32 gVisTested;
@@ -591,8 +597,8 @@ LLFrameTimer gTextureTimer;
void update_statistics()
{
gTotalWorldBytes += gVLManager.getTotalBytes();
gTotalObjectBytes += gObjectBits / 8;
gTotalWorldData += U32Bytes(gVLManager.getTotalBytes());
gTotalObjectData += gObjectData;
LLViewerStats& stats = LLViewerStats::instance();
@@ -634,7 +640,7 @@ void update_statistics()
if (cdp)
{
stats.mSimPingStat.addValue(cdp->getPingDelay());
gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);
gAvgSimPing = F32Milliseconds(((gAvgSimPing.value() * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1));
gSimPingCount++;
}
else
@@ -643,11 +649,11 @@ void update_statistics()
}
stats.mFPSStat.addValue(1);
F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
stats.mLayersKBitStat.addValue(layer_bits/1024.f);
stats.mObjectKBitStat.addValue(gObjectBits/1024.f);
F64Bits layer_bits = F64Bits(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
stats.mLayersKBitStat.addValue((F32)layer_bits.valueInUnits<LLUnits::Kilobits>());
stats.mObjectKBitStat.addValue(gObjectData.valueInUnits<LLUnits::Kilobits>());
stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending());
stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET) / 1024);
gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
@@ -675,7 +681,7 @@ void update_statistics()
// Reset all of these values.
gVLManager.resetBitCounts();
gObjectBits = 0;
gObjectData = (U32Bytes)0;
// gDecodedBits = 0;
// Only update texture stats periodically so that they are less noisy
@@ -685,10 +691,10 @@ void update_statistics()
if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
{
stats.mHTTPTextureKBitStat.addValue(AICurlInterface::getHTTPBandwidth()/125.f);
stats.mUDPTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f);
stats.mUDPTextureKBitStat.addValue(LLViewerTextureList::sTextureBits.valueInUnits<LLUnits::Kilobits>());
stats.mTexturePacketsStat.addValue(LLViewerTextureList::sTexturePackets);
gTotalTextureBytes += LLViewerTextureList::sTextureBits / 8;
LLViewerTextureList::sTextureBits = 0;
gTotalTextureData += U32Bits(LLViewerTextureList::sTextureBits);
LLViewerTextureList::sTextureBits = U32Bits(0);
LLViewerTextureList::sTexturePackets = 0;
texture_stats_timer.reset();
}
@@ -792,14 +798,14 @@ void send_stats()
gSimFrames = (F32) gFrameCount;
agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars;
agent["ping"] = gAvgSimPing;
agent["ping"] = gAvgSimPing.value();
agent["meters_traveled"] = gAgent.getDistanceTraveled();
agent["regions_visited"] = gAgent.getRegionsVisited();
agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
LLSD &system = body["system"];
system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value();
system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
system["cpu"] = gSysCPU.getCPUString();
unsigned char MACAddress[MAC_ADDRESS_BYTES];
@@ -823,9 +829,9 @@ void send_stats()
LLSD &download = body["downloads"];
download["world_kbytes"] = gTotalWorldBytes / 1024.0;
download["object_kbytes"] = gTotalObjectBytes / 1024.0;
download["texture_kbytes"] = gTotalTextureBytes / 1024.0;
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"];
@@ -886,7 +892,10 @@ void send_stats()
body["MinimalSkin"] = false;
LLViewerStats::getInstance()->addToMessage(body);
LLHTTPClient::post(url, body, new ViewerStatsResponder);
LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
LLHTTPClient::post(url, body, new ViewerStatsResponder());
}
LLViewerStats::PhaseMap::PhaseMap()

View File

@@ -321,7 +321,7 @@ void update_statistics();
void send_stats();
extern LLFrameTimer gTextureTimer;
extern U32 gTotalTextureBytes;
extern U32 gTotalObjectBytes;
extern U32 gTotalTextureBytesPerBoostLevel[] ;
extern U32Bytes gTotalTextureData;
extern U32Bytes gTotalObjectData;
extern U32Bytes gTotalTextureBytesPerBoostLevel[] ;
#endif // LL_LLVIEWERSTATS_H

View File

@@ -63,6 +63,11 @@
#include "lltexturecache.h"
///////////////////////////////////////////////////////////////////////////////
// extern
const S32Megabytes gMinVideoRam(32);
const S32Megabytes gMaxVideoRam(1024);
// statics
LLPointer<LLViewerTexture> LLViewerTexture::sNullImagep = NULL;
LLPointer<LLViewerTexture> LLViewerTexture::sBlackImagep = NULL;
@@ -83,12 +88,12 @@ S32 LLViewerTexture::sAuxCount = 0;
LLFrameTimer LLViewerTexture::sEvaluationTimer;
F32 LLViewerTexture::sDesiredDiscardBias = 0.f;
F32 LLViewerTexture::sDesiredDiscardScale = 1.1f;
S32 LLViewerTexture::sBoundTextureMemoryInBytes = 0;
S32 LLViewerTexture::sTotalTextureMemoryInBytes = 0;
S32 LLViewerTexture::sMaxBoundTextureMemInMegaBytes = 0;
S32 LLViewerTexture::sMaxTotalTextureMemInMegaBytes = 0;
S32 LLViewerTexture::sMaxDesiredTextureMemInBytes = 0 ;
S8 LLViewerTexture::sCameraMovingDiscardBias = 0 ;
S32Bytes LLViewerTexture::sBoundTextureMemory;
S32Bytes LLViewerTexture::sTotalTextureMemory;
S32Megabytes LLViewerTexture::sMaxBoundTextureMemory;
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 ;
@@ -450,8 +455,9 @@ bool LLViewerTexture::isMemoryForTextureLow()
timer.reset() ;
LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK);
const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB
static const S32Megabytes MIN_FREE_TEXTURE_MEMORY(5); //MB
static const S32Megabytes MIN_FREE_MAIN_MEMORY(100); //MB
bool low_mem = false ;
if (gGLManager.mHasATIMemInfo)
@@ -459,7 +465,7 @@ bool LLViewerTexture::isMemoryForTextureLow()
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 ;
}
@@ -467,7 +473,7 @@ bool LLViewerTexture::isMemoryForTextureLow()
if(!low_mem) //check main memory, only works for windows.
{
LLMemory::updateMemoryInfo() ;
if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
if(LLMemory::getAvailableMemKB() < MIN_FREE_TEXTURE_MEMORY)
{
low_mem = true ;
}
@@ -511,17 +517,17 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
LLViewerMediaTexture::updateClass() ;
}
sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes
sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes
sMaxBoundTextureMemInMegaBytes = gTextureList.getMaxResidentTexMem();//in MB
sMaxTotalTextureMemInMegaBytes = gTextureList.getMaxTotalTextureMem() ;//in MB
sMaxDesiredTextureMemInBytes = MEGA_BYTES_TO_BYTES(sMaxTotalTextureMemInMegaBytes) ; //in Bytes, by default and when total used texture memory is small.
sBoundTextureMemory = LLImageGL::sBoundTextureMemory;
sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;
sMaxBoundTextureMemory = S32Megabytes(gTextureList.getMaxResidentTexMem());
sMaxTotalTextureMem = S32Megabytes(gTextureList.getMaxTotalTextureMem());
sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small.
if (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) >= sMaxBoundTextureMemInMegaBytes ||
BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) >= sMaxTotalTextureMemInMegaBytes)
if (sBoundTextureMemory >= sMaxBoundTextureMemory ||
sTotalTextureMemory >= sMaxTotalTextureMem)
{
//when texture memory overflows, lower down the threashold to release the textures more aggressively.
sMaxDesiredTextureMemInBytes = llmin((S32)(sMaxDesiredTextureMemInBytes * 0.75f) , MEGA_BYTES_TO_BYTES(MAX_VIDEO_RAM_IN_MEGA_BYTES)) ;//512 MB
//when texture memory overflows, lower down the threshold to release the textures more aggressively.
sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
// If we are using more texture memory than we should,
// scale up the desired discard level
@@ -537,8 +543,8 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
sEvaluationTimer.reset();
}
else if (sDesiredDiscardBias > 0.0f &&
BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < sMaxBoundTextureMemInMegaBytes * texmem_lower_bound_scale &&
BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < sMaxTotalTextureMemInMegaBytes * texmem_lower_bound_scale)
sBoundTextureMemory < sMaxBoundTextureMemory * texmem_lower_bound_scale &&
sTotalTextureMemory < sMaxTotalTextureMem * texmem_lower_bound_scale)
{
// If we are using less texture memory than we should,
// scale down the desired discard level
@@ -549,15 +555,14 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
}
}
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, desired_discard_bias_min, desired_discard_bias_max);
//LLViewerTexture::sUseTextureAtlas = gSavedSettings.getBOOL("EnableTextureAtlas") ;
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 = (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < 0.75f * sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale) &&
(BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < 0.75f * sMaxTotalTextureMemInMegaBytes * texmem_middle_bound_scale) ;
LLViewerTexture::sFreezeImageScalingDown = (sBoundTextureMemory < 0.75f * sMaxBoundTextureMemory * texmem_middle_bound_scale) &&
(sTotalTextureMemory < 0.75f * sMaxTotalTextureMem * texmem_middle_bound_scale);
}
//end of static functions
@@ -1156,7 +1161,7 @@ void LLViewerFetchedTexture::dump()
// ONLY called from LLViewerFetchedTextureList
void LLViewerFetchedTexture::destroyTexture()
{
if(LLImageGL::sGlobalTextureMemoryInBytes < sMaxDesiredTextureMemInBytes * 0.95f)//not ready to release unused memory.
if(LLImageGL::sGlobalTextureMemory < sMaxDesiredTextureMem * 0.95f)//not ready to release unused memory.
{
return ;
}
@@ -3049,13 +3054,13 @@ void LLViewerLODTexture::processTextureStats()
scaleDown() ;
}
// Limit the amount of GL memory bound each frame
else if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale &&
else if ( sBoundTextureMemory > sMaxBoundTextureMemory * texmem_middle_bound_scale &&
(!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel))
{
scaleDown() ;
}
// Only allow GL to have 2x the video card memory
else if ( BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) > sMaxTotalTextureMemInMegaBytes*texmem_middle_bound_scale &&
else if ( sTotalTextureMemory > sMaxTotalTextureMem * texmem_middle_bound_scale &&
(!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel))
{
scaleDown() ;
@@ -3639,10 +3644,10 @@ LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWi
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() ;
}
@@ -3656,8 +3661,8 @@ void LLTexturePipelineTester::update()
{
mLastTotalBytesUsed = mTotalBytesUsed ;
mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage ;
mTotalBytesUsed = 0 ;
mTotalBytesUsedForLargeImage = 0 ;
mTotalBytesUsed = (S32Bytes)0;
mTotalBytesUsedForLargeImage = (S32Bytes)0;
if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty
{
@@ -3698,10 +3703,10 @@ void LLTexturePipelineTester::reset()
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 ;
@@ -3716,59 +3721,59 @@ void LLTexturePipelineTester::reset()
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;
}
}

View File

@@ -41,8 +41,9 @@
#include <map>
#include <list>
#define MIN_VIDEO_RAM_IN_MEGA_BYTES 32
#define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons.
extern const S32Megabytes gMinVideoRam;
extern const S32Megabytes gMaxVideoRam;
class LLImageGL ;
class LLImageRaw;
@@ -210,11 +211,11 @@ public:
static LLFrameTimer sEvaluationTimer;
static F32 sDesiredDiscardBias;
static F32 sDesiredDiscardScale;
static S32 sBoundTextureMemoryInBytes;
static S32 sTotalTextureMemoryInBytes;
static S32 sMaxBoundTextureMemInMegaBytes;
static S32 sMaxTotalTextureMemInMegaBytes;
static S32 sMaxDesiredTextureMemInBytes ;
static S32Bytes sBoundTextureMemory;
static S32Bytes sTotalTextureMemory;
static S32Megabytes sMaxBoundTextureMemory;
static S32Megabytes sMaxTotalTextureMem;
static S32Bytes sMaxDesiredTextureMem ;
static S8 sCameraMovingDiscardBias;
static F32 sCameraMovingBias;
static S32 sMaxSculptRez ;

View File

@@ -72,7 +72,7 @@
void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL;
U32 LLViewerTextureList::sTextureBits = 0;
U32Bits LLViewerTextureList::sTextureBits(0);
U32 LLViewerTextureList::sTexturePackets = 0;
S32 LLViewerTextureList::sNumImages = 0;
@@ -95,8 +95,8 @@ void LLViewerTextureList::init()
mInitialized = TRUE ;
sNumImages = 0;
mUpdateStats = TRUE;
mMaxResidentTexMemInMegaBytes = 0;
mMaxTotalTextureMemInMegaBytes = 0 ;
mMaxResidentTexMemInMegaBytes = (U32Bytes)0;
mMaxTotalTextureMemInMegaBytes = (U32Bytes)0;
if (gNoRender)
{
// Don't initialize GL stuff if we're not rendering.
@@ -104,7 +104,7 @@ void LLViewerTextureList::init()
}
// Update how much texture RAM we're allowed to use.
updateMaxResidentTexMem(0); // 0 = use current
updateMaxResidentTexMem(S32Megabytes(0)); // 0 = use current
doPreloadImages();
}
@@ -706,8 +706,8 @@ void LLViewerTextureList::updateImages(F32 max_time)
}
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
LLViewerStats::getInstance()->mGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes));
LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes));
LLViewerStats::getInstance()->mGLTexMemStat.addValue((F32)LLImageGL::sGlobalTextureMemory.valueInUnits<LLUnits::Megabytes>());
LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)LLImageGL::sBoundTextureMemory.valueInUnits<LLUnits::Megabytes>());
LLViewerStats::getInstance()->mRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(global_raw_memory));
LLViewerStats::getInstance()->mFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory));
@@ -960,12 +960,10 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
static const bool SKIP_LOW_PRIO = gSavedSettings.getBOOL("TextureFetchUpdateSkipLowPriority"); // default: false
size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*MAX_HIGH_PRIO_COUNT*gFrameIntervalSeconds)+1, MAX_HIGH_PRIO_COUNT);
//Old: size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*40.f*gFrameIntervalSeconds)+1, MAX_HIGH_PRIO_COUNT);
max_priority_count = llmin(max_priority_count, mImageList.size());
size_t total_update_count = mUUIDMap.size();
size_t max_update_count = llmin((S32) (MAX_UPDATE_COUNT*MAX_UPDATE_COUNT*gFrameIntervalSeconds)+1, MAX_UPDATE_COUNT);
//Old: size_t max_priority_count = llmin((S32) (MAX_UPDATE_COUNT*40.f*gFrameIntervalSeconds)+1, MAX_UPDATE_COUNT);
max_update_count = llmin(max_update_count, total_update_count);
// MAX_HIGH_PRIO_COUNT high priority entries
@@ -1218,20 +1216,16 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
}
// Returns min setting for TextureMemory (in MB)
S32 LLViewerTextureList::getMinVideoRamSetting()
S32Megabytes LLViewerTextureList::getMinVideoRamSetting()
{
S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped());
if (system_ram > 2000)
return 128;
else if (system_ram > 1000)
return 64;
else
return MIN_VIDEO_RAM_IN_MEGA_BYTES;
S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped();
//min texture mem sets to 64M if total physical mem is more than 1.5GB
return (system_ram > S32Megabytes(1500)) ? S32Megabytes(64) : gMinVideoRam ;
}
//static
// Returns max setting for TextureMemory (in MB)
S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, float mem_multiplier)
{
#if LL_LINUX
if (gGLManager.mIsIntel && gGLManager.mGLVersion >= 3.f && !gGLManager.mVRAM)
@@ -1239,12 +1233,12 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
gGLManager.mVRAM = 512;
}
#endif
S32 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
S32 max_vram = gGLManager.mVRAM;
S32Megabytes max_vram(gGLManager.mVRAM);
max_vram = llmax(max_vram, getMinVideoRamSetting());
max_texmem = max_vram;
if (!get_recommended)
@@ -1252,72 +1246,81 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
}
else
{
if (get_recommended)
max_texmem = 128;
if (!get_recommended)
{
max_texmem = (S32Megabytes)512;
}
else if (gSavedSettings.getBOOL("NoHardwareProbe")) //did not do hardware detection at startup
{
max_texmem = (S32Megabytes)512;
}
else
max_texmem = 512;
{
max_texmem = (S32Megabytes)128;
}
LL_WARNS() << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << LL_ENDL;
}
S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(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, (S32)(system_ram/2));
max_texmem = llmin(max_texmem, system_ram/2);
else
max_texmem = llmin(max_texmem, (S32)(system_ram));
max_texmem = llmin(max_texmem, system_ram);
max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES);
// limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise
max_texmem = llmin(max_texmem, (S32Megabytes) (mem_multiplier * max_texmem));
max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam);
return max_texmem;
}
const S32 VIDEO_CARD_FRAMEBUFFER_MEM = 12; // MB
const S32 MIN_MEM_FOR_NON_TEXTURE = 512 ; //MB
void LLViewerTextureList::updateMaxResidentTexMem(S32 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
S32 cur_mem = gSavedSettings.getS32("TextureMemory");
S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory"));
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32 default_mem = getMaxVideoRamSetting(true); // recommended default
if (mem == 0)
S32Megabytes default_mem = getMaxVideoRamSetting(true, mem_multiplier); // 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, (S32) (mem_multiplier * (F32) default_mem));
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting());
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting(false, mem_multiplier));
if (mem != cur_mem)
{
gSavedSettings.setS32("TextureMemory", mem);
gSavedSettings.setS32("TextureMemory", mem.value());
return; //listener will re-enter this function
}
// TODO: set available resident texture mem based on use by other subsystems
// currently max(12MB, VRAM/4) assumed...
S32 vb_mem = mem;
S32 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 >> 2);
mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes / 4);
}
//system mem
S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB
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.
S32 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)
{
@@ -1345,17 +1348,17 @@ 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() ;
}
// Only used for statistics and texture console.
gTextureList.sTextureBits += received_size * 8;
gTextureList.sTextureBits += received_size;
gTextureList.sTexturePackets++;
U8 codec;
@@ -1419,16 +1422,16 @@ 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() ;
}
gTextureList.sTextureBits += received_size * 8;
gTextureList.sTextureBits += received_size;
gTextureList.sTexturePackets++;
//llprintline("Start decode, image header...");
@@ -1494,24 +1497,6 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
///////////////////////////////////////////////////////////////////////////////
//static
const U32 SIXTEEN_MEG = 0x1000000;
S32 LLViewerTextureList::calcMaxTextureRAM()
{
// Decide the maximum amount of RAM we should allow the user to allocate to texture cache
LLMemoryInfo memory_info;
U32 available_memory = memory_info.getPhysicalMemoryClamped();
clamp_rescale((F32)available_memory,
(F32)(SIXTEEN_MEG * 16),
(F32)U32_MAX,
(F32)(SIXTEEN_MEG * 4),
(F32)(U32_MAX >> 1));
return available_memory;
}
///////////////////////////////////////////////////////////////////////////////
// explicitly cleanup resources, as this is a singleton class with process
// lifetime so ability to perform std::map operations in destructor is not
// guaranteed.

View File

@@ -71,7 +71,6 @@ public:
static BOOL verifyUploadFile(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 S32 calcMaxTextureRAM();
static void receiveImageHeader(LLMessageSystem *msg, void **user_data);
static void receiveImagePacket(LLMessageSystem *msg, void **user_data);
@@ -101,19 +100,19 @@ public:
void setUpdateStats(BOOL b) { mUpdateStats = b; }
S32 getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; }
S32 getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;}
S32Megabytes getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; }
S32Megabytes getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;}
S32 getNumImages() { return mImageList.size(); }
void updateMaxResidentTexMem(S32 mem);
void updateMaxResidentTexMem(S32Megabytes mem);
void doPreloadImages();
void doPrefetchImages();
void clearFetchingRequests();
static S32 getMinVideoRamSetting();
static S32 getMaxVideoRamSetting(bool get_recommended = false);
static S32Megabytes getMinVideoRamSetting();
static S32Megabytes getMaxVideoRamSetting(bool get_recommended, float mem_multiplier);
private:
void updateImagesDecodePriorities();
@@ -195,12 +194,12 @@ private:
BOOL mInitialized ;
BOOL mUpdateStats;
S32 mMaxResidentTexMemInMegaBytes;
S32 mMaxTotalTextureMemInMegaBytes;
S32Megabytes mMaxResidentTexMemInMegaBytes;
S32Megabytes mMaxTotalTextureMemInMegaBytes;
LLFrameTimer mForceDecodeTimer;
public:
static U32 sTextureBits;
static U32Bits sTextureBits;
static U32 sTexturePackets;
private:

View File

@@ -5356,7 +5356,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
gGL.resetVertexBuffers();
LL_INFOS() << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemoryInBytes << " bytes" << LL_ENDL;
LL_INFOS() << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemory << " bytes" << LL_ENDL;
}
}

View File

@@ -5169,9 +5169,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);
@@ -5236,12 +5236,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);
@@ -5250,7 +5250,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;

View File

@@ -184,7 +184,7 @@ public:
void updateLODRiggedAttachments( void );
void updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer);
/*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
S32 totalTextureMemForUUIDS(std::set<LLUUID>& ids);
S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids);
bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
bool allLocalTexturesCompletelyDownloaded() const;
bool allBakedTexturesCompletelyDownloaded() const;

View File

@@ -157,7 +157,7 @@ typedef LLHTTPClient::ResponderIgnore LLHoverHeightResponder;
//-----------------------------------------------------------------------------
// Static Data
//-----------------------------------------------------------------------------
S32 LLVOAvatarSelf::sScratchTexBytes = 0;
S32Bytes LLVOAvatarSelf::sScratchTexBytes(0);
LLMap< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
LLMap< LLGLenum, F32*> LLVOAvatarSelf::sScratchTexLastBindTime;
@@ -3215,8 +3215,8 @@ void LLVOAvatarSelf::deleteScratchTextures()
{
if(gAuditTexture)
{
S32 total_tex_size = sScratchTexBytes ;
S32 tex_size = SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT ;
S32Bytes total_tex_size = sScratchTexBytes ;
S32Bytes tex_size(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT) ;
if( sScratchTexNames.checkData( GL_LUMINANCE ) )
{
@@ -3249,7 +3249,7 @@ void LLVOAvatarSelf::deleteScratchTextures()
total_tex_size -= 4 * tex_size ;
}
//others
while(total_tex_size > 0)
while(total_tex_size > S32Bytes(0))
{
LLImageGL::decTextureCounter(tex_size, 4, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
total_tex_size -= 4 * tex_size ;
@@ -3264,14 +3264,14 @@ 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 << "KB" << LL_ENDL;
sScratchTexNames.deleteAllData();
sScratchTexLastBindTime.deleteAllData();
LLImageGL::sGlobalTextureMemoryInBytes -= sScratchTexBytes;
sScratchTexBytes = 0;
LLImageGL::sGlobalTextureMemory -= sScratchTexBytes;
sScratchTexBytes = S32Bytes(0);
}
}

View File

@@ -273,7 +273,7 @@ public:
public:
static void deleteScratchTextures();
private:
static S32 sScratchTexBytes;
static S32Bytes sScratchTexBytes;
static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
static LLMap< LLGLenum, F32*> sScratchTexLastBindTime;

View File

@@ -4001,7 +4001,8 @@ U32 LLVOVolume::getPartitionType() const
}
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp)
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp),
LLVolumeGeometryManager()
{
mLODPeriod = 32;
mDepthMask = FALSE;
@@ -4012,7 +4013,8 @@ LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
}
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp)
: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp),
LLVolumeGeometryManager()
{
mDepthMask = FALSE;
mLODPeriod = 32;
@@ -4073,6 +4075,70 @@ bool can_batch_texture(const LLFace* facep)
return true;
}
const static U32 MAX_FACE_COUNT = 4096U;
int32_t LLVolumeGeometryManager::sInstanceCount = 0;
LLFace** LLVolumeGeometryManager::sFullbrightFaces = NULL;
LLFace** LLVolumeGeometryManager::sBumpFaces = NULL;
LLFace** LLVolumeGeometryManager::sSimpleFaces = NULL;
LLFace** LLVolumeGeometryManager::sNormFaces = NULL;
LLFace** LLVolumeGeometryManager::sSpecFaces = NULL;
LLFace** LLVolumeGeometryManager::sNormSpecFaces = NULL;
LLFace** LLVolumeGeometryManager::sAlphaFaces = NULL;
LLVolumeGeometryManager::LLVolumeGeometryManager()
: LLGeometryManager()
{
llassert(sInstanceCount >= 0);
if (sInstanceCount == 0)
{
allocateFaces(MAX_FACE_COUNT);
}
++sInstanceCount;
}
LLVolumeGeometryManager::~LLVolumeGeometryManager()
{
llassert(sInstanceCount > 0);
--sInstanceCount;
if (sInstanceCount <= 0)
{
freeFaces();
sInstanceCount = 0;
}
}
void LLVolumeGeometryManager::allocateFaces(U32 pMaxFaceCount)
{
sFullbrightFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sBumpFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sSimpleFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sNormFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sSpecFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sNormSpecFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
sAlphaFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
}
void LLVolumeGeometryManager::freeFaces()
{
ll_aligned_free<64>(sFullbrightFaces);
ll_aligned_free<64>(sBumpFaces);
ll_aligned_free<64>(sSimpleFaces);
ll_aligned_free<64>(sNormFaces);
ll_aligned_free<64>(sSpecFaces);
ll_aligned_free<64>(sNormSpecFaces);
ll_aligned_free<64>(sAlphaFaces);
sFullbrightFaces = NULL;
sBumpFaces = NULL;
sSimpleFaces = NULL;
sNormFaces = NULL;
sSpecFaces = NULL;
sNormSpecFaces = NULL;
sAlphaFaces = NULL;
}
static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face");
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
@@ -4427,16 +4493,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
group->clearDrawMap();
mFaceList.clear();
const U32 MAX_FACE_COUNT = 4096;
static LLFace** fullbright_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** bump_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** simple_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** norm_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64);
static LLFace** spec_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64);
static LLFace** normspec_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64);
static LLFace** alpha_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
U32 fullbright_count = 0;
U32 bump_count = 0;
@@ -4931,7 +4987,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //can be treated as alpha mask
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -4942,7 +4998,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
if (alpha_count < MAX_FACE_COUNT)
{
alpha_faces[alpha_count++] = facep;
sAlphaFaces[alpha_count++] = facep;
}
}
}
@@ -4967,14 +5023,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
if (normspec_count < MAX_FACE_COUNT)
{
normspec_faces[normspec_count++] = facep;
sNormSpecFaces[normspec_count++] = facep;
}
}
else
{ //has normal map (needs texcoord1 and tangent)
if (norm_count < MAX_FACE_COUNT)
{
norm_faces[norm_count++] = facep;
sNormFaces[norm_count++] = facep;
}
}
}
@@ -4982,14 +5038,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //has specular map but no normal map, needs texcoord2
if (spec_count < MAX_FACE_COUNT)
{
spec_faces[spec_count++] = facep;
sSpecFaces[spec_count++] = facep;
}
}
else
{ //has neither specular map nor normal map, only needs texcoord0
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
sSimpleFaces[simple_count++] = facep;
}
}
}
@@ -4997,14 +5053,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal + tangent
if (bump_count < MAX_FACE_COUNT)
{
bump_faces[bump_count++] = facep;
sBumpFaces[bump_count++] = facep;
}
}
else if (te->getShiny() || !te->getFullbright())
{ //needs normal
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -5012,7 +5068,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
facep->setState(LLFace::FULLBRIGHT);
if (fullbright_count < MAX_FACE_COUNT)
{
fullbright_faces[fullbright_count++] = facep;
sFullbrightFaces[fullbright_count++] = facep;
}
}
}
@@ -5022,7 +5078,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal + tangent
if (bump_count < MAX_FACE_COUNT)
{
bump_faces[bump_count++] = facep;
sBumpFaces[bump_count++] = facep;
}
}
else if ((te->getShiny() && LLPipeline::sRenderBump) ||
@@ -5030,7 +5086,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -5038,7 +5094,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
facep->setState(LLFace::FULLBRIGHT);
if (fullbright_count < MAX_FACE_COUNT)
{
fullbright_faces[fullbright_count++] = facep;
sFullbrightFaces[fullbright_count++] = facep;
}
}
}
@@ -5051,7 +5107,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (type == LLDrawPool::POOL_ALPHA)
{
cur_type = &alpha_faces;
cur_type = &sAlphaFaces;
cur_count = &alpha_count;
if (te->getColor().mV[3] > 0.f)
@@ -5066,30 +5122,30 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (mat->getSpecularID().notNull())
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
cur_type = &normspec_faces;
cur_type = &sNormSpecFaces;
cur_count = &normspec_count;
}
else
{ //has normal map (needs texcoord1 and tangent)
cur_type = &norm_faces;
cur_type = &sNormFaces;
cur_count = &norm_count;
}
}
else if (mat->getSpecularID().notNull())
{ //has specular map but no normal map, needs texcoord2
cur_type = &spec_faces;
cur_type = &sSpecFaces;
cur_count = &spec_count;
}
}
}
else if(type == LLDrawPool::POOL_ALPHA_MASK)
{
cur_type = &simple_faces;
cur_type = &sSimpleFaces;
cur_count = &simple_count;
}
else if(type == LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK)
{
cur_type = &fullbright_faces;
cur_type = &sFullbrightFaces;
cur_count = &fullbright_count;
}
else
@@ -5103,30 +5159,30 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal + tangent
if(te->getBumpmap() > 0 && te->getBumpmap() < 18)
{
cur_type = &bump_faces;
cur_type = &sBumpFaces;
cur_count = &bump_count;
}
else if(te->getShiny())
{
cur_type = &simple_faces;
cur_type = &sSimpleFaces;
cur_count = &simple_count;
}
}
else if (type == LLDrawPool::POOL_SIMPLE)
{ //needs normal + tangent
cur_type = &simple_faces;
cur_type = &sSimpleFaces;
cur_count = &simple_count;
}
else if (type == LLDrawPool::POOL_FULLBRIGHT)
{ //doesn't need normal...
if(LLPipeline::sRenderBump && te->getShiny()) //unless it's shiny..
{
cur_type = &simple_faces;
cur_type = &sSimpleFaces;
cur_count = &simple_count;
}
else
{
cur_type = &fullbright_faces;
cur_type = &sFullbrightFaces;
cur_count = &fullbright_count;
}
}
@@ -5140,23 +5196,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (mat->getSpecularID().notNull())
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
cur_type = &normspec_faces;
cur_type = &sNormSpecFaces;
cur_count = &normspec_count;
}
else
{ //has normal map (needs texcoord1 and tangent)
cur_type = &norm_faces;
cur_type = &sNormFaces;
cur_count = &norm_count;
}
}
else if (mat->getSpecularID().notNull())
{ //has specular map but no normal map, needs texcoord2
cur_type = &spec_faces;
cur_type = &sSpecFaces;
cur_count = &spec_count;
}
else
{ //has neither specular map nor normal map, only needs texcoord0
cur_type = &simple_faces;
cur_type = &sSimpleFaces;
cur_count = &simple_count;
}
}
@@ -5218,13 +5274,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if(emissive)
additional_flags |= LLVertexBuffer::MAP_EMISSIVE;
genDrawInfo(group, simple_mask | additional_flags, simple_faces, simple_count, FALSE, batch_textures);
genDrawInfo(group, fullbright_mask | additional_flags, fullbright_faces, fullbright_count, FALSE, batch_textures);
genDrawInfo(group, alpha_mask | additional_flags, alpha_faces, alpha_count, TRUE, batch_textures);
genDrawInfo(group, bump_mask | additional_flags, bump_faces, bump_count, FALSE);
genDrawInfo(group, norm_mask | additional_flags, norm_faces, norm_count, FALSE);
genDrawInfo(group, spec_mask | additional_flags, spec_faces, spec_count, FALSE);
genDrawInfo(group, normspec_mask | additional_flags, normspec_faces, normspec_count, FALSE);
genDrawInfo(group, simple_mask | additional_flags, sSimpleFaces, simple_count, FALSE, batch_textures);
genDrawInfo(group, fullbright_mask | additional_flags, sFullbrightFaces, fullbright_count, FALSE, batch_textures);
genDrawInfo(group, alpha_mask | additional_flags, sAlphaFaces, alpha_count, TRUE, batch_textures);
genDrawInfo(group, bump_mask | additional_flags, sBumpFaces, bump_count, FALSE);
genDrawInfo(group, norm_mask | additional_flags, sNormFaces, norm_count, FALSE);
genDrawInfo(group, spec_mask | additional_flags, sSpecFaces, spec_count, FALSE);
genDrawInfo(group, normspec_mask | additional_flags, sNormSpecFaces, normspec_count, FALSE);
if (!LLPipeline::sDelayVBUpdate)
{

View File

@@ -2830,7 +2830,7 @@ void LLPipeline::updateGeom(F32 max_dtime)
S32 count = 0;
max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, max_dtime);
max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, F32SecondsImplicit(max_dtime));
LLSpatialGroup* last_group = NULL;
LLSpatialBridge* last_bridge = NULL;