FIRE-11744; Backout for now as it causes performance issues.
parent
b104e7612c
commit
bc1155aa11
|
|
@ -166,8 +166,6 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
|
|||
mBoundingSphereRadius = 0.0f ;
|
||||
|
||||
mHasMedia = FALSE ;
|
||||
|
||||
mParticleGeneration = 0; // <FS:ND/> Default = no particle
|
||||
}
|
||||
|
||||
void LLFace::destroy()
|
||||
|
|
@ -185,14 +183,9 @@ void LLFace::destroy()
|
|||
}
|
||||
}
|
||||
|
||||
// <FS:ND> Make sure we released any allocated VB index if this was a particle
|
||||
// if (isState(LLFace::PARTICLE))
|
||||
if (isState(LLFace::PARTICLE) || mParticleGeneration )
|
||||
// </FS:ND>
|
||||
if (isState(LLFace::PARTICLE))
|
||||
{
|
||||
LLVOPartGroup::freeVBSlot(getGeomIndex()/4,mParticleGeneration);
|
||||
mParticleGeneration = 0;
|
||||
|
||||
LLVOPartGroup::freeVBSlot(getGeomIndex()/4);
|
||||
clearState(LLFace::PARTICLE);
|
||||
}
|
||||
|
||||
|
|
@ -421,16 +414,8 @@ void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align)
|
|||
llassert(verify());
|
||||
}
|
||||
|
||||
// <FS:ND> Pass another flag to mark this index as from LLVOPartGroup, in that case it needs to be freed with LLVOPartGroup::LLVOPartGroup
|
||||
// void LLFace::setGeomIndex(U16 idx)
|
||||
void LLFace::setGeomIndex(U16 idx, U32 aParticleGeneration )
|
||||
// </FS:ND>
|
||||
void LLFace::setGeomIndex(U16 idx)
|
||||
{
|
||||
if( mParticleGeneration && mGeomIndex != idx )
|
||||
LLVOPartGroup::freeVBSlot(getGeomIndex()/4,mParticleGeneration);
|
||||
|
||||
mParticleGeneration = aParticleGeneration;
|
||||
|
||||
if (mGeomIndex != idx)
|
||||
{
|
||||
mGeomIndex = idx;
|
||||
|
|
|
|||
|
|
@ -207,11 +207,7 @@ public:
|
|||
BOOL verify(const U32* indices_array = NULL) const;
|
||||
void printDebugInfo() const;
|
||||
|
||||
// <FS:ND> Pass another flag to mark this index as from LLVOPartGroup, in that case it needs to be freed with LLVOPartGroup::LLVOPartGroup
|
||||
// void setGeomIndex(U16 idx);
|
||||
void setGeomIndex(U16 idx, U32 aParticleGeneration = 0);
|
||||
// </FS:ND>
|
||||
|
||||
void setGeomIndex(U16 idx);
|
||||
void setIndicesIndex(S32 idx);
|
||||
void setDrawInfo(LLDrawInfo* draw_info);
|
||||
|
||||
|
|
@ -363,9 +359,6 @@ public:
|
|||
lhs->getTexture() < rhs->getTexture();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
U32 mParticleGeneration;
|
||||
};
|
||||
|
||||
#endif // LL_LLFACE_H
|
||||
|
|
|
|||
|
|
@ -284,36 +284,16 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
|
|||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
LLViewerRegion *regionp = getRegion();
|
||||
S32 end = (S32) mParticles.size();
|
||||
|
||||
// <FS:ND> Instead of walking the current particles back to front, we first make a copy, then sort by adress and refill mParticles as needed.
|
||||
mParticlesTemp.swap( mParticles );
|
||||
mParticles.erase( mParticles.begin(), mParticles.end() );
|
||||
std::sort( mParticlesTemp.begin(), mParticlesTemp.end() );
|
||||
|
||||
// for (S32 i = 0 ; i < (S32)mParticles.size(); )
|
||||
for (S32 i = 0 ; i < (S32)mParticlesTemp.size(); ++i )
|
||||
// </FS:ND>
|
||||
for (S32 i = 0 ; i < (S32)mParticles.size();)
|
||||
{
|
||||
// LLVector3 a(0.f, 0.f, 0.f); // <FS:ND/> Unused
|
||||
LLViewerPart* part = mParticlesTemp[i] ;
|
||||
LLVector3 a(0.f, 0.f, 0.f);
|
||||
LLViewerPart* part = mParticles[i] ;
|
||||
|
||||
dt = lastdt + mSkippedTime - part->mSkipOffset;
|
||||
part->mSkipOffset = 0.f;
|
||||
|
||||
// Update current time
|
||||
const F32 cur_time = part->mLastUpdateTime + dt;
|
||||
|
||||
// <FS:ND> Bail out as soon as possible to avoid all the complicated work down.
|
||||
if( cur_time > part->mMaxAge || LLViewerPart::LL_PART_DEAD_MASK == part->mFlags )
|
||||
{
|
||||
if (part->mVPCallback)
|
||||
(*part->mVPCallback)(*part, dt);
|
||||
|
||||
delete part ;
|
||||
continue;
|
||||
}
|
||||
// </FS:ND>
|
||||
|
||||
const F32 frac = cur_time / part->mMaxAge;
|
||||
|
||||
// "Drift" the object based on the source object
|
||||
|
|
@ -417,34 +397,26 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
|
|||
part->mLastUpdateTime = cur_time;
|
||||
|
||||
|
||||
// <FS:ND> We did that above
|
||||
// Kill dead particles (either flagged dead, or too old)
|
||||
// if ((part->mLastUpdateTime > part->mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part->mFlags))
|
||||
// {
|
||||
// mParticles[i] = mParticles.back() ;
|
||||
// mParticles.pop_back() ;
|
||||
// delete part ;
|
||||
// }
|
||||
// else
|
||||
// </FS:ND>
|
||||
if ((part->mLastUpdateTime > part->mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part->mFlags))
|
||||
{
|
||||
mParticles[i] = mParticles.back() ;
|
||||
mParticles.pop_back() ;
|
||||
delete part ;
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale);
|
||||
if (!posInGroup(part->mPosAgent, desired_size))
|
||||
{
|
||||
// Transfer particles between groups
|
||||
LLViewerPartSim::getInstance()->put(part) ;
|
||||
|
||||
// <FS:ND> No need for any transfer, just to not add to mParticles.
|
||||
// mParticles[i] = mParticles.back() ;
|
||||
// mParticles.pop_back() ;
|
||||
// </FS:ND>
|
||||
mParticles[i] = mParticles.back() ;
|
||||
mParticles.pop_back() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// <FS:ND> Keep current particle in this group.
|
||||
// i++ ;
|
||||
mParticles.push_back( part );
|
||||
// </FS:ND>
|
||||
i++ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -920,76 +892,3 @@ void LLViewerPartSim::clearParticlesByOwnerID(const LLUUID& task_id)
|
|||
}
|
||||
}
|
||||
|
||||
// <FS:ND> Object pool for LLViewerPart
|
||||
U8 *sParts;
|
||||
U8 *sPartsEnd;
|
||||
U32 sFree[ LL_MAX_PARTICLE_COUNT/32 ];
|
||||
U32 sPartSize;
|
||||
|
||||
S32 findFreeIndex()
|
||||
{
|
||||
for( int i = 0; i < LL_MAX_PARTICLE_COUNT/32; ++i )
|
||||
{
|
||||
if( sFree[i] )
|
||||
{
|
||||
U32 val = sFree[i];
|
||||
U32 mask = 1;
|
||||
int j(0);
|
||||
for( j = 0; j < 32; ++j )
|
||||
{
|
||||
if( mask & val )
|
||||
{
|
||||
mask = ~mask;
|
||||
break;
|
||||
}
|
||||
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
sFree[ i ] = val & mask;
|
||||
return i*32+j;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void* LLViewerPart::operator new(size_t size)
|
||||
{
|
||||
if( !sParts )
|
||||
{
|
||||
sPartSize = sizeof( LLViewerPart );
|
||||
sPartSize += 0xF;
|
||||
sPartSize &= ~0xF;
|
||||
sParts = reinterpret_cast<U8*>( ll_aligned_malloc<16>( sPartSize * LL_MAX_PARTICLE_COUNT ) );
|
||||
for( int i = 0; i < LL_MAX_PARTICLE_COUNT/32; ++i )
|
||||
sFree[ i ] = 0xFFFFFFFF;
|
||||
|
||||
sPartsEnd = sParts + sPartSize * LL_MAX_PARTICLE_COUNT;
|
||||
}
|
||||
|
||||
S32 i = findFreeIndex();
|
||||
if( i < 0 )
|
||||
return new char[ size ];
|
||||
|
||||
return reinterpret_cast< void* >( sParts + sPartSize*i );
|
||||
}
|
||||
|
||||
void LLViewerPart::operator delete(void* ptr)
|
||||
{
|
||||
if( ptr < sParts || ptr >= sPartsEnd )
|
||||
{
|
||||
delete [] (char*)ptr;
|
||||
return;
|
||||
}
|
||||
|
||||
U32 diff = static_cast<U32>( reinterpret_cast<U8*>(ptr) - sParts );
|
||||
diff /= sPartSize;
|
||||
|
||||
U32 i = (diff & ~0x0000001F) / 32;
|
||||
U32 j = diff & 0x0000001F;
|
||||
|
||||
U32 mask = 1 << j;
|
||||
|
||||
sFree[ i ] |= mask;
|
||||
}
|
||||
// </FS:ND>
|
||||
|
|
|
|||
|
|
@ -81,10 +81,6 @@ public:
|
|||
|
||||
|
||||
static U32 sNextPartID;
|
||||
// <FS:ND> Object pool for LLViewerPart
|
||||
void* operator new(size_t size);
|
||||
void operator delete(void* ptr);
|
||||
// </FS:ND>
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -112,7 +108,6 @@ public:
|
|||
|
||||
typedef std::vector<LLViewerPart*> part_list_t;
|
||||
part_list_t mParticles;
|
||||
part_list_t mParticlesTemp; // <FS:ND/> Temporary list for iteration in updateParticles
|
||||
|
||||
const LLVector3 &getCenterAgent() const { return mCenterAgent; }
|
||||
S32 getCount() const { return (S32) mParticles.size(); }
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ extern U64MicrosecondsImplicit gFrameTime;
|
|||
|
||||
LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
|
||||
S32 LLVOPartGroup::sVBSlotCursor = 0;
|
||||
U32 sFreeIndex[LL_MAX_PARTICLE_COUNT/32] = {0};
|
||||
U32 sIndexGeneration = 1;
|
||||
|
||||
void LLVOPartGroup::initClass()
|
||||
{
|
||||
|
|
@ -61,11 +59,6 @@ void LLVOPartGroup::initClass()
|
|||
//static
|
||||
void LLVOPartGroup::restoreGL()
|
||||
{
|
||||
sIndexGeneration += 2;
|
||||
|
||||
for( int i = 0; i < LL_MAX_PARTICLE_COUNT/32; ++i )
|
||||
sFreeIndex[i] = 0xFFFFFFFF;
|
||||
|
||||
|
||||
//TODO: optimize out binormal mask here. Specular and normal coords as well.
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW_ARB);
|
||||
|
|
@ -125,37 +118,12 @@ void LLVOPartGroup::destroyGL()
|
|||
//static
|
||||
S32 LLVOPartGroup::findAvailableVBSlot()
|
||||
{
|
||||
for( int i = 0; i < LL_MAX_PARTICLE_COUNT/32; ++i )
|
||||
{
|
||||
if( sFreeIndex[i] != 0 )
|
||||
{
|
||||
U32 val = sFreeIndex[i];
|
||||
U32 mask = 1;
|
||||
int j(0);
|
||||
for( j = 0; j < 32; ++j )
|
||||
{
|
||||
if( mask & val )
|
||||
{
|
||||
mask = ~mask;
|
||||
break;
|
||||
}
|
||||
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
sFreeIndex[ i ] = val & mask;
|
||||
return i*32+j;
|
||||
}
|
||||
if (sVBSlotCursor >= LL_MAX_PARTICLE_COUNT)
|
||||
{ //no more available slots
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
// if (sVBSlotCursor >= LL_MAX_PARTICLE_COUNT)
|
||||
// { //no more available slots
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// return sVBSlotCursor++;
|
||||
return sVBSlotCursor++;
|
||||
}
|
||||
|
||||
bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
|
||||
|
|
@ -174,8 +142,7 @@ bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
|
|||
}
|
||||
|
||||
//static
|
||||
// void LLVOPartGroup::freeVBSlot(S32 idx)
|
||||
void LLVOPartGroup::freeVBSlot(S32 idx, U32 generation )
|
||||
void LLVOPartGroup::freeVBSlot(S32 idx)
|
||||
{
|
||||
/*llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
|
||||
//llassert(sVBSlotCursor > sVBSlotFree);
|
||||
|
|
@ -186,16 +153,6 @@ void LLVOPartGroup::freeVBSlot(S32 idx, U32 generation )
|
|||
sVBSlotCursor--;
|
||||
*sVBSlotCursor = idx;
|
||||
}*/
|
||||
|
||||
if( sIndexGeneration != generation || idx < 0 || idx >= LL_MAX_PARTICLE_COUNT )
|
||||
return;
|
||||
|
||||
U32 i = (idx & ~0x0000001F) / 32;
|
||||
U32 j = idx & 0x0000001F;
|
||||
|
||||
U32 mask = 1 << j;
|
||||
|
||||
sFreeIndex[ i ] |= mask;
|
||||
}
|
||||
|
||||
LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
||||
|
|
@ -912,11 +869,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
S32 idx = LLVOPartGroup::findAvailableVBSlot();
|
||||
if (idx >= 0)
|
||||
{
|
||||
// <FS:ND> Face needs to release the index when it gets destroyed.
|
||||
// facep->setGeomIndex(idx*4);
|
||||
facep->setGeomIndex(idx*4, sIndexGeneration);
|
||||
// <FS:ND>
|
||||
|
||||
facep->setGeomIndex(idx*4);
|
||||
facep->setIndicesIndex(idx*6);
|
||||
facep->setVertexBuffer(LLVOPartGroup::sVB);
|
||||
facep->setPoolType(LLDrawPool::POOL_ALPHA);
|
||||
|
|
|
|||
|
|
@ -48,9 +48,7 @@ public:
|
|||
static void restoreGL();
|
||||
static void destroyGL();
|
||||
static S32 findAvailableVBSlot();
|
||||
|
||||
// static void freeVBSlot(S32 idx);
|
||||
static void freeVBSlot(S32 idx, U32 generation);
|
||||
static void freeVBSlot(S32 idx);
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue