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:
@@ -83,6 +83,7 @@
|
||||
#include "llvector4a.h"
|
||||
#include "llfont.h"
|
||||
#include "llvocache.h"
|
||||
#include "llvopartgroup.h"
|
||||
#include "llfloaterteleporthistory.h"
|
||||
|
||||
#include "llweb.h"
|
||||
@@ -602,6 +603,10 @@ bool LLAppViewer::init()
|
||||
|
||||
// initialize SSE options
|
||||
LLVector4a::initClass();
|
||||
|
||||
//initialize particle index pool
|
||||
LLVOPartGroup::initClass();
|
||||
|
||||
// Need to do this initialization before we do anything else, since anything
|
||||
// that touches files should really go through the lldir API
|
||||
gDirUtilp->initAppDirs("SecondLife");
|
||||
|
||||
@@ -169,19 +169,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
|
||||
mGeomCount = 0;
|
||||
mGeomIndex = 0;
|
||||
mIndicesCount = 0;
|
||||
if (drawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES ||
|
||||
drawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES
|
||||
#if ENABLE_CLASSIC_CLOUDS
|
||||
|| drawablep->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS
|
||||
#endif
|
||||
)
|
||||
{ //indicate to LLParticlePartition that this particle is uninitialized
|
||||
mIndicesIndex = 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIndicesIndex = 0;
|
||||
}
|
||||
|
||||
//special value to indicate uninitialized position
|
||||
mIndicesIndex = 0xFFFFFFFF;
|
||||
|
||||
mIndexInTex = 0;
|
||||
mTexture = NULL;
|
||||
mTEOffset = -1;
|
||||
@@ -214,17 +205,10 @@ void LLFace::destroy()
|
||||
mTexture->removeFace(this) ;
|
||||
}
|
||||
|
||||
if (mDrawablep.notNull() &&
|
||||
(mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES ||
|
||||
mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES
|
||||
#if ENABLE_CLASSIC_CLOUDS
|
||||
|| mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS
|
||||
#endif
|
||||
) &&
|
||||
mIndicesIndex != 0xFFFFFFFF)
|
||||
if (isState(LLFace::PARTICLE))
|
||||
{
|
||||
LLVOPartGroup::freeVBSlot(getGeomIndex()/4);
|
||||
mIndicesIndex = 0xFFFFFFFF;
|
||||
clearState(LLFace::PARTICLE);
|
||||
}
|
||||
|
||||
if (mDrawPoolp)
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
USE_FACE_COLOR = 0x0010,
|
||||
TEXTURE_ANIM = 0x0020,
|
||||
RIGGED = 0x0040,
|
||||
PARTICLE = 0x0080,
|
||||
};
|
||||
|
||||
static void initClass();
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];
|
||||
static S32* sVBSlotCursor;
|
||||
|
||||
static void initClass();
|
||||
static void restoreGL();
|
||||
static void destroyGL();
|
||||
static S32 findAvailableVBSlot();
|
||||
|
||||
Reference in New Issue
Block a user