MAINT-775: Fix for particle index pool corruption on teleport. (And removed alternative workaround) https://bitbucket.org/davep/viewer-development/changeset/04fdf7945708

This commit is contained in:
Shyotl
2012-07-20 11:29:11 -05:00
parent c9e0a6c533
commit 531af998fb
5 changed files with 20 additions and 53 deletions

View File

@@ -49,7 +49,6 @@
#include "llviewerregion.h"
#include "pipeline.h"
#include "llspatialpartition.h"
#include "llviewerobjectlist.h"
const F32 MAX_PART_LIFETIME = 120.f;
@@ -59,8 +58,7 @@ LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
S32 LLVOPartGroup::sVBSlotFree[];
S32* LLVOPartGroup::sVBSlotCursor = NULL;
//static
void LLVOPartGroup::restoreGL()
void LLVOPartGroup::initClass()
{
for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
{
@@ -68,7 +66,11 @@ void LLVOPartGroup::restoreGL()
}
sVBSlotCursor = sVBSlotFree;
}
//static
void LLVOPartGroup::restoreGL()
{
sVB = new LLVertexBuffer(VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
U32 count = LL_MAX_PARTICLE_COUNT;
sVB->allocateBuffer(count*4, count*6, true);
@@ -120,32 +122,6 @@ void LLVOPartGroup::restoreGL()
//static
void LLVOPartGroup::destroyGL()
{
//Just iterate over all particle faces and mark their vbo index as 'uninitialized' since sVBSlotFree & sVBSlotCursor will be clobbered.
for (int i=0; i<gObjectList.getNumObjects(); i++)
{
LLViewerObject *obj = gObjectList.getObject(i);
if(obj && obj->mDrawable)
{
if (obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES ||
obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES
#if ENABLE_CLASSIC_CLOUDS
|| obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS
#endif
)
{
for (S32 j = 0; j < obj->mDrawable->getNumFaces(); ++j)
{
LLFace* facep = obj->mDrawable->getFace(j);
if(facep)
facep->setIndicesIndex(0xFFFFFFFF);
}
}
}
}
for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
{
sVBSlotFree[i] = i;
}
sVB = NULL;
}
@@ -160,7 +136,6 @@ S32 LLVOPartGroup::findAvailableVBSlot()
S32 ret = *sVBSlotCursor;
sVBSlotCursor++;
return ret;
}
@@ -654,7 +629,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
LLFace* facep = *i;
LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
if (facep->getIndicesStart() == 0xFFFFFFFF)
if (!facep->isState(LLFace::PARTICLE))
{ //set the indices of this face
S32 idx = LLVOPartGroup::findAvailableVBSlot();
if (idx >= 0)
@@ -663,6 +638,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
facep->setIndicesIndex(idx*6);
facep->setVertexBuffer(LLVOPartGroup::sVB);
facep->setPoolType(LLDrawPool::POOL_ALPHA);
facep->setState(LLFace::PARTICLE);
}
else
{