for SH-3937: interesting: implement the new cache probe logic
parent
03b7fb589a
commit
50b32cf2bd
|
|
@ -328,22 +328,6 @@ void LLViewerObject::deleteTEImages()
|
|||
mTEImages = NULL;
|
||||
}
|
||||
|
||||
//if enabled, add this object to vo cache tree when removed from rendering.
|
||||
void LLViewerObject::EnableToCacheTree(bool enabled)
|
||||
{
|
||||
if(mDrawable.notNull() && mDrawable->getEntry() && mDrawable->getEntry()->hasVOCacheEntry())
|
||||
{
|
||||
if(enabled)
|
||||
{
|
||||
((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->addState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
|
||||
}
|
||||
else
|
||||
{
|
||||
((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->clearState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::markDead()
|
||||
{
|
||||
if (!mDead)
|
||||
|
|
|
|||
|
|
@ -137,8 +137,7 @@ public:
|
|||
BOOL isDead() const {return mDead;}
|
||||
BOOL isOrphaned() const { return mOrphaned; }
|
||||
BOOL isParticleSource() const;
|
||||
void EnableToCacheTree(bool enabled);
|
||||
|
||||
|
||||
virtual LLVOAvatar* asAvatar();
|
||||
|
||||
static void initVOClasses();
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
LLTimer update_timer;
|
||||
BOOL justCreated = FALSE;
|
||||
S32 msg_size = 0;
|
||||
bool remove_from_cache = false; //remove from object cache if it is a full-update or terse update
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
|
|
@ -455,38 +456,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data);
|
||||
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i);
|
||||
compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length);
|
||||
#if 0
|
||||
if (compressed)
|
||||
{
|
||||
if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
|
||||
{
|
||||
U32 flags = 0;
|
||||
mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
|
||||
|
||||
if(!(flags & FLAGS_TEMPORARY_ON_REZ))
|
||||
{
|
||||
//bCached = true;
|
||||
|
||||
compressed_dp.unpackU32(local_id, "LocalID");
|
||||
|
||||
//-------------
|
||||
compressed_dp.unpackUUID(fullid, "ID");
|
||||
//if(fullid == LLUUID("1e5183db-8f28-47f1-abe0-23de9f9042b7"))
|
||||
{
|
||||
llinfos << fullid << llendl;
|
||||
}
|
||||
//-------------
|
||||
|
||||
U32 crc;
|
||||
compressed_dp.unpackU32(crc, "CRC");
|
||||
/*LLViewerRegion::eCacheUpdateResult result = */regionp->cacheFullUpdate(local_id, crc, compressed_dp);
|
||||
//recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size);
|
||||
|
||||
continue; //do not creat LLViewerObject for cacheable object, object cache will do the job.
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
|
||||
{
|
||||
U32 flags = 0;
|
||||
|
|
@ -506,6 +476,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
}
|
||||
else
|
||||
{
|
||||
remove_from_cache = true;
|
||||
compressed_dp.unpackU32(local_id, "LocalID");
|
||||
getUUIDFromLocal(fullid,
|
||||
local_id,
|
||||
|
|
@ -535,6 +506,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
}
|
||||
else // OUT_FULL only?
|
||||
{
|
||||
remove_from_cache = true;
|
||||
mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i);
|
||||
mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
|
||||
msg_size += sizeof(LLUUID);
|
||||
|
|
@ -542,6 +514,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
// llinfos << "Full Update, obj " << local_id << ", global ID" << fullid << "from " << mesgsys->getSender() << llendl;
|
||||
}
|
||||
objectp = findObject(fullid);
|
||||
|
||||
if(remove_from_cache)
|
||||
{
|
||||
objectp = regionp->forceToRemoveFromCache(local_id, objectp);
|
||||
}
|
||||
|
||||
// This looks like it will break if the local_id of the object doesn't change
|
||||
// upon boundary crossing, but we check for region id matching later...
|
||||
|
|
@ -618,11 +595,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
|
|||
recorder.objectUpdateFailure(local_id, update_type, msg_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
justCreated = TRUE;
|
||||
mNumNewObjects++;
|
||||
}
|
||||
|
||||
|
||||
if (objectp->isDead())
|
||||
{
|
||||
llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl;
|
||||
|
|
@ -1371,7 +1348,7 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled)
|
||||
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
|
||||
{
|
||||
// Don't ever kill gAgentAvatarp, just force it to the agent's region
|
||||
// unless region is NULL which is assumed to mean you are logging out.
|
||||
|
|
@ -1386,7 +1363,6 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled)
|
|||
|
||||
if (objectp)
|
||||
{
|
||||
objectp->EnableToCacheTree(cache_enabled); //enable to add to VO cache tree if set.
|
||||
objectp->markDead(); // does the right thing if object already dead
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -2113,6 +2089,15 @@ S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const
|
|||
|
||||
void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port)
|
||||
{
|
||||
if(childp->getRegion())
|
||||
{
|
||||
LLVOCacheEntry* entry = childp->getRegion()->getCacheEntry(childp->getLocalID());
|
||||
if(entry != NULL && !entry->isTouched())
|
||||
{
|
||||
return; //object cache will take care of this.
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ORPHAN_SPAM
|
||||
llinfos << "Orphaning object " << childp->getID() << " with parent " << parent_id << llendl;
|
||||
#endif
|
||||
|
|
@ -2168,6 +2153,12 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
|
|||
return;
|
||||
}
|
||||
|
||||
//search object cache to get orphans
|
||||
if(objectp->getRegion())
|
||||
{
|
||||
objectp->getRegion()->findOrphans(objectp->getLocalID());
|
||||
}
|
||||
|
||||
// See if we are a parent of an orphan.
|
||||
// Note: This code is fairly inefficient but it should happen very rarely.
|
||||
// It can be sped up if this is somehow a performance issue...
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
|
||||
|
||||
BOOL killObject(LLViewerObject *objectp, bool cache_enabled = false);
|
||||
BOOL killObject(LLViewerObject *objectp);
|
||||
void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
|
||||
void killAllObjects();
|
||||
void removeDrawable(LLDrawable* drawablep);
|
||||
|
|
|
|||
|
|
@ -460,7 +460,11 @@ void LLViewerRegion::saveObjectCache()
|
|||
|
||||
if(LLVOCache::hasInstance())
|
||||
{
|
||||
LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty) ;
|
||||
//NOTE: !!!!!!!!!!
|
||||
//set this to be true when support full region cache probe!!!!
|
||||
BOOL full_region_cache_probe = FALSE;
|
||||
|
||||
LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ;
|
||||
mCacheDirty = FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -744,11 +748,13 @@ void LLViewerRegion::dirtyHeights()
|
|||
void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry)
|
||||
{
|
||||
U32 state = LLVOCacheEntry::INACTIVE;
|
||||
bool in_vo_tree = false;
|
||||
|
||||
if(old_entry)
|
||||
{
|
||||
old_entry->copyTo(new_entry);
|
||||
state = old_entry->getState();
|
||||
state = old_entry->getState();
|
||||
in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL);
|
||||
killCacheEntry(old_entry);
|
||||
}
|
||||
|
||||
|
|
@ -763,7 +769,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry
|
|||
{
|
||||
mImpl->mWaitingSet.insert(new_entry);
|
||||
}
|
||||
else if(old_entry && new_entry->getEntry())
|
||||
else if(!old_entry || in_vo_tree)
|
||||
{
|
||||
addToVOCacheTree(new_entry);
|
||||
}
|
||||
|
|
@ -880,7 +886,7 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group)
|
|||
mImpl->mVisibleGroups.insert(group);
|
||||
}
|
||||
|
||||
void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced)
|
||||
void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry)
|
||||
{
|
||||
if(!sVOCacheCullingEnabled)
|
||||
{
|
||||
|
|
@ -895,10 +901,6 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced)
|
|||
{
|
||||
return;
|
||||
}
|
||||
if(!forced && !entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE))
|
||||
{
|
||||
return; //can not add to vo cache tree.
|
||||
}
|
||||
|
||||
mImpl->mVOCachePartition->addEntry(entry->getEntry());
|
||||
}
|
||||
|
|
@ -1039,6 +1041,17 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
|
|||
{
|
||||
LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry();
|
||||
|
||||
if(vo_entry->getParentID() > 0) //is a child
|
||||
{
|
||||
LLVOCacheEntry* parent = getCacheEntry(vo_entry->getParentID());
|
||||
|
||||
//make sure the parent is active
|
||||
if(!parent || !parent->isState(LLVOCacheEntry::ACTIVE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate);
|
||||
mImpl->mWaitingList.insert(vo_entry);
|
||||
}
|
||||
|
|
@ -1140,7 +1153,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
|
|||
}
|
||||
for(S32 i = 0; i < delete_list.size(); i++)
|
||||
{
|
||||
gObjectList.killObject(delete_list[i]->getVObj(), true);
|
||||
gObjectList.killObject(delete_list[i]->getVObj());
|
||||
}
|
||||
delete_list.clear();
|
||||
|
||||
|
|
@ -1194,6 +1207,28 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry)
|
|||
return obj;
|
||||
}
|
||||
|
||||
//remove from object cache if the object receives a full-update or terse update
|
||||
LLViewerObject* LLViewerRegion::forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp)
|
||||
{
|
||||
LLVOCacheEntry* entry = getCacheEntry(local_id);
|
||||
if (!entry)
|
||||
{
|
||||
return objectp; //not in the cache, do nothing.
|
||||
}
|
||||
if(!objectp) //object not created
|
||||
{
|
||||
entry->setTouched(FALSE); //mark this entry invalid
|
||||
|
||||
//create a new object before delete it from cache.
|
||||
objectp = gObjectList.processObjectUpdateFromCache(entry, this);
|
||||
}
|
||||
|
||||
//remove from cache.
|
||||
killCacheEntry(entry);
|
||||
|
||||
return objectp;
|
||||
}
|
||||
|
||||
// As above, but forcibly do the update.
|
||||
void LLViewerRegion::forceUpdate()
|
||||
{
|
||||
|
|
@ -1647,15 +1682,32 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
|
|||
mSimulatorFeatures = sim_features;
|
||||
}
|
||||
|
||||
void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry)
|
||||
//this is called when the parent is not cacheable.
|
||||
//move all orphan children out of cache and insert to rendering octree.
|
||||
void LLViewerRegion::findOrphans(U32 parent_id)
|
||||
{
|
||||
std::map<U32, OrphanList>::iterator iter = mOrphanMap.find(parent_id);
|
||||
if(iter != mOrphanMap.end())
|
||||
{
|
||||
std::set<U32>* children = mOrphanMap[parent_id].getChildList();
|
||||
for(std::set<U32>::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter)
|
||||
{
|
||||
forceToRemoveFromCache(*child_iter, NULL);
|
||||
}
|
||||
|
||||
mOrphanMap.erase(parent_id);
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
|
||||
{
|
||||
if(entry != NULL && !entry->getEntry())
|
||||
{
|
||||
entry->setOctreeEntry(NULL);
|
||||
}
|
||||
else
|
||||
else if(entry->getGroup() != NULL)
|
||||
{
|
||||
return; //not new entry, no post processing.
|
||||
return; //already in octree, no post processing.
|
||||
}
|
||||
|
||||
LLVector3 pos;
|
||||
|
|
@ -1667,11 +1719,13 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry)
|
|||
|
||||
if(parent_id > 0) //has parent
|
||||
{
|
||||
entry->setParentID(parent_id);
|
||||
|
||||
//1, find parent, update position
|
||||
LLVOCacheEntry* parent = getCacheEntry(parent_id);
|
||||
|
||||
//2, if can not, put into the orphan lists: a parents list and a children list
|
||||
if(!parent)
|
||||
//2, if can not, put into the orphan list.
|
||||
if(!parent || !parent->getGroup())
|
||||
{
|
||||
std::map<U32, OrphanList>::iterator iter = mOrphanMap.find(parent_id);
|
||||
if(iter != mOrphanMap.end())
|
||||
|
|
@ -1680,6 +1734,24 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry)
|
|||
}
|
||||
else
|
||||
{
|
||||
//check if the parent is an uncacheable object
|
||||
if(!parent)
|
||||
{
|
||||
LLUUID parent_uuid;
|
||||
LLViewerObjectList::getUUIDFromLocal(parent_uuid,
|
||||
parent_id,
|
||||
getHost().getAddress(),
|
||||
getHost().getPort());
|
||||
LLViewerObject *parent_objp = gObjectList.findObject(parent_uuid);
|
||||
if(parent_objp)
|
||||
{
|
||||
//parent is not cacheable, remove child from the cache.
|
||||
forceToRemoveFromCache(entry->getLocalID(), NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//otherwise insert to the orphan list
|
||||
OrphanList o_list(entry->getLocalID());
|
||||
mOrphanMap[parent_id] = o_list;
|
||||
}
|
||||
|
|
@ -1688,13 +1760,14 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry)
|
|||
}
|
||||
else
|
||||
{
|
||||
//update the child position to the region space.
|
||||
entry->updateBoundingInfo(parent);
|
||||
}
|
||||
}
|
||||
|
||||
if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE))
|
||||
{
|
||||
addToVOCacheTree(entry, true);
|
||||
addToVOCacheTree(entry);
|
||||
}
|
||||
|
||||
if(!parent_id) //a potential parent
|
||||
|
|
@ -1709,6 +1782,7 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry)
|
|||
LLVOCacheEntry* child = getCacheEntry(*child_iter);
|
||||
if(child)
|
||||
{
|
||||
//update the child position to the region space.
|
||||
child->updateBoundingInfo(entry);
|
||||
addToVOCacheTree(child);
|
||||
}
|
||||
|
|
@ -1758,7 +1832,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
|
|||
entry = new_entry;
|
||||
|
||||
mImpl->mCacheMap[local_id] = entry;
|
||||
postProcesNewEntry(entry);
|
||||
decodeBoundingInfo(entry);
|
||||
}
|
||||
|
||||
result = CACHE_UPDATE_CHANGED;
|
||||
|
|
@ -1773,7 +1847,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
|
|||
|
||||
mImpl->mCacheMap[local_id] = entry;
|
||||
|
||||
postProcesNewEntry(entry);
|
||||
decodeBoundingInfo(entry);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -1784,6 +1858,10 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec
|
|||
eCacheUpdateResult result = cacheFullUpdate(dp);
|
||||
|
||||
LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()];
|
||||
if(!entry)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if(objectp->mDrawable.notNull() && !entry->getEntry())
|
||||
{
|
||||
|
|
@ -1853,8 +1931,8 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss
|
|||
{
|
||||
return true;
|
||||
}
|
||||
//addVisibleCacheEntry(entry);
|
||||
addToVOCacheTree(entry, true);
|
||||
|
||||
decodeBoundingInfo(entry);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -320,9 +320,13 @@ public:
|
|||
eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp);
|
||||
eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp);
|
||||
LLVOCacheEntry* getCacheEntryForOctree(U32 local_id);
|
||||
LLVOCacheEntry* getCacheEntry(U32 local_id);
|
||||
bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type);
|
||||
void requestCacheMisses();
|
||||
void addCacheMissFull(const U32 local_id);
|
||||
//remove from object cache if the object receives a full-update or terse update
|
||||
LLViewerObject* forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp);
|
||||
void findOrphans(U32 parent_id);
|
||||
|
||||
void dumpCache();
|
||||
|
||||
|
|
@ -348,10 +352,9 @@ public:
|
|||
void getNeighboringRegionsStatus( std::vector<S32>& regions );
|
||||
|
||||
private:
|
||||
void addToVOCacheTree(LLVOCacheEntry* entry, bool forced = false);
|
||||
void addToVOCacheTree(LLVOCacheEntry* entry);
|
||||
LLViewerObject* addNewObject(LLVOCacheEntry* entry);
|
||||
void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list);
|
||||
LLVOCacheEntry* getCacheEntry(U32 local_id);
|
||||
void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list);
|
||||
void removeFromVOCacheTree(LLVOCacheEntry* entry);
|
||||
void replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry);
|
||||
void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry
|
||||
|
|
@ -361,7 +364,7 @@ private:
|
|||
F32 updateVisibleEntries(F32 max_time); //update visible entries
|
||||
|
||||
void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight);
|
||||
void postProcesNewEntry(LLVOCacheEntry* entry);
|
||||
void decodeBoundingInfo(LLVOCacheEntry* entry);
|
||||
public:
|
||||
struct CompareDistance
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &
|
|||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mSceneContrib(0.f)
|
||||
mSceneContrib(0.f),
|
||||
mTouched(TRUE),
|
||||
mParentID(0)
|
||||
{
|
||||
mBuffer = new U8[dp.getBufferSize()];
|
||||
mDP.assignBuffer(mBuffer, dp.getBufferSize());
|
||||
|
|
@ -77,7 +79,9 @@ LLVOCacheEntry::LLVOCacheEntry()
|
|||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mSceneContrib(0.f)
|
||||
mSceneContrib(0.f),
|
||||
mTouched(TRUE),
|
||||
mParentID(0)
|
||||
{
|
||||
mDP.assignBuffer(mBuffer, 0);
|
||||
}
|
||||
|
|
@ -88,7 +92,9 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
|
|||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mSceneContrib(0.f)
|
||||
mSceneContrib(0.f),
|
||||
mTouched(FALSE),
|
||||
mParentID(0)
|
||||
{
|
||||
S32 size = -1;
|
||||
BOOL success;
|
||||
|
|
@ -114,36 +120,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
|
|||
success = check_read(apr_file, &mCRCChangeCount, sizeof(S32));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
success = check_read(apr_file, &mState, sizeof(U32));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
F32 ext[8];
|
||||
success = check_read(apr_file, (void*)ext, sizeof(F32) * 8);
|
||||
|
||||
LLVector4a exts[2];
|
||||
exts[0].load4a(ext);
|
||||
exts[1].load4a(&ext[4]);
|
||||
|
||||
setSpatialExtents(exts[0], exts[1]);
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
LLVector4 pos;
|
||||
success = check_read(apr_file, (void*)pos.mV, sizeof(LLVector4));
|
||||
|
||||
LLVector4a pos_;
|
||||
pos_.load4a(pos.mV);
|
||||
setPositionGroup(pos_);
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
F32 rad;
|
||||
success = check_read(apr_file, &rad, sizeof(F32));
|
||||
setBinRadius(rad);
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
success = check_read(apr_file, &size, sizeof(S32));
|
||||
|
||||
|
|
@ -229,9 +205,7 @@ void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry)
|
|||
|
||||
void LLVOCacheEntry::setState(U32 state)
|
||||
{
|
||||
mState &= 0xffff0000; //clear the low 16 bits
|
||||
state &= 0x0000ffff; //clear the high 16 bits;
|
||||
mState |= state;
|
||||
mState = state;
|
||||
|
||||
if(getState() == ACTIVE)
|
||||
{
|
||||
|
|
@ -298,6 +272,7 @@ LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP()
|
|||
|
||||
void LLVOCacheEntry::recordHit()
|
||||
{
|
||||
setTouched();
|
||||
mHitCount++;
|
||||
}
|
||||
|
||||
|
|
@ -338,33 +313,6 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
|
|||
success = check_write(apr_file, (void*)&mCRCChangeCount, sizeof(S32));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
U32 state = mState & 0xffff0000; //only store the high 16 bits.
|
||||
success = check_write(apr_file, (void*)&state, sizeof(U32));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
const LLVector4a* exts = getSpatialExtents() ;
|
||||
LLVector4 ext(exts[0][0], exts[0][1], exts[0][2], exts[0][3]);
|
||||
success = check_write(apr_file, ext.mV, sizeof(LLVector4));
|
||||
if(success)
|
||||
{
|
||||
ext.set(exts[1][0], exts[1][1], exts[1][2], exts[1][3]);
|
||||
success = check_write(apr_file, ext.mV, sizeof(LLVector4));
|
||||
}
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
const LLVector4a pos_ = getPositionGroup() ;
|
||||
LLVector4 pos(pos_[0], pos_[1], pos_[2], pos_[3]);
|
||||
success = check_write(apr_file, pos.mV, sizeof(LLVector4));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
F32 rad = getBinRadius();
|
||||
success = check_write(apr_file, (void*)&rad, sizeof(F32));
|
||||
}
|
||||
if(success)
|
||||
{
|
||||
S32 size = mDP.getBufferSize();
|
||||
success = check_write(apr_file, (void*)&size, sizeof(S32));
|
||||
|
|
@ -958,7 +906,7 @@ void LLVOCache::purgeEntries(U32 size)
|
|||
mNumEntries = mHandleEntryMap.size() ;
|
||||
}
|
||||
|
||||
void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache)
|
||||
void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe)
|
||||
{
|
||||
if(!mEnabled)
|
||||
{
|
||||
|
|
@ -1031,7 +979,10 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
|
|||
|
||||
for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter)
|
||||
{
|
||||
success = iter->second->writeToFile(&apr_file) ;
|
||||
if(!full_region_cache_probe || iter->second->isTouched())
|
||||
{
|
||||
success = iter->second->writeToFile(&apr_file) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class LLCamera;
|
|||
class LLVOCacheEntry : public LLViewerOctreeEntryData
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum //low 16-bit state
|
||||
{
|
||||
INACTIVE = 0x00000000, //not visible
|
||||
IN_QUEUE = 0x00000001, //in visible queue, object to be created
|
||||
|
|
@ -49,11 +49,6 @@ public:
|
|||
ACTIVE = 0x00000004 //object created, and in rendering pipeline.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ADD_TO_CACHE_TREE = 0x00010000, //has parent
|
||||
};
|
||||
|
||||
struct CompareVOCacheEntry
|
||||
{
|
||||
bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs)
|
||||
|
|
@ -84,12 +79,10 @@ public:
|
|||
LLVOCacheEntry();
|
||||
|
||||
void setState(U32 state);
|
||||
void clearState(U32 state) {mState &= ~state;}
|
||||
void addState(U32 state) {mState |= state;}
|
||||
bool isState(U32 state) {return (mState & 0xffff) == state;}
|
||||
//void clearState(U32 state) {mState &= ~state;}
|
||||
bool isState(U32 state) {return mState == state;}
|
||||
bool hasState(U32 state) {return mState & state;}
|
||||
U32 getState() const {return (mState & 0xffff);}
|
||||
U32 getFullState() const {return mState;}
|
||||
U32 getState() const {return mState;}
|
||||
|
||||
U32 getLocalID() const { return mLocalID; }
|
||||
U32 getCRC() const { return mCRC; }
|
||||
|
|
@ -111,6 +104,9 @@ public:
|
|||
void copyTo(LLVOCacheEntry* new_entry); //copy variables
|
||||
/*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry);
|
||||
|
||||
void setParentID(U32 id) {mParentID = id;}
|
||||
U32 getParentID() const {return mParentID;}
|
||||
|
||||
void addChild(LLVOCacheEntry* entry);
|
||||
LLVOCacheEntry* getChild(S32 i) {return mChildrenList[i];}
|
||||
S32 getNumOfChildren() {return mChildrenList.size();}
|
||||
|
|
@ -119,6 +115,9 @@ public:
|
|||
//called from processing object update message
|
||||
void setBoundingInfo(const LLVector3& pos, const LLVector3& scale);
|
||||
void updateBoundingInfo(LLVOCacheEntry* parent);
|
||||
|
||||
void setTouched(BOOL touched = TRUE) {mTouched = touched;}
|
||||
BOOL isTouched() const {return mTouched;}
|
||||
|
||||
public:
|
||||
typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t;
|
||||
|
|
@ -127,6 +126,7 @@ public:
|
|||
|
||||
protected:
|
||||
U32 mLocalID;
|
||||
U32 mParentID;
|
||||
U32 mCRC;
|
||||
S32 mHitCount;
|
||||
S32 mDupeCount;
|
||||
|
|
@ -139,6 +139,8 @@ protected:
|
|||
S32 mRepeatedVisCounter; //number of repeatedly visible within a short time.
|
||||
U32 mState; //high 16 bits reserved for special use.
|
||||
std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set.
|
||||
|
||||
BOOL mTouched; //if set, this entry is valid, otherwise it is invalid.
|
||||
};
|
||||
|
||||
class LLVOCachePartition : public LLViewerOctreePartition
|
||||
|
|
@ -199,7 +201,7 @@ public:
|
|||
void removeCache(ELLPath location) ;
|
||||
|
||||
void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ;
|
||||
void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) ;
|
||||
void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe);
|
||||
void removeEntry(U64 handle) ;
|
||||
|
||||
void setReadOnly(BOOL read_only) {mReadOnly = read_only;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue