FIRE-11745 / MAINT-3178: Fix particles using textures containing alpha flash white at certain camera angles by partially undoing 6317cce88ffc (particle index accounting); Found by Shyotl Kuhr (Singularity viewer)

Mon, 05 Jan 2015 15:14:02 +0100

author
Ansariel
date
Mon, 05 Jan 2015 15:14:02 +0100
changeset 43099
9ecea804a06d
parent 43098
46b49a03f1d3
child 43100
09d07fa095d5

FIRE-11745 / MAINT-3178: Fix particles using textures containing alpha flash white at certain camera angles by partially undoing 6317cce88ffc (particle index accounting); Found by Shyotl Kuhr (Singularity viewer)

indra/newview/llviewerpartsim.cpp file | annotate | diff | revisions
indra/newview/llvopartgroup.cpp file | annotate | diff | revisions
indra/newview/llvopartgroup.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/llviewerpartsim.cpp	Mon Jan 05 13:02:24 2015 +0100
     1.2 +++ b/indra/newview/llviewerpartsim.cpp	Mon Jan 05 15:14:02 2015 +0100
     1.3 @@ -664,7 +664,8 @@
     1.4  	static LLFrameTimer update_timer;
     1.5  
     1.6  	//reset VBO cursor
     1.7 -	LLVOPartGroup::sVBSlotCursor = 0;
     1.8 +	// <FS> Fix particle flashing
     1.9 +	//LLVOPartGroup::sVBSlotCursor = 0;
    1.10  
    1.11  	const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
    1.12  
     2.1 --- a/indra/newview/llvopartgroup.cpp	Mon Jan 05 13:02:24 2015 +0100
     2.2 +++ b/indra/newview/llvopartgroup.cpp	Mon Jan 05 15:14:02 2015 +0100
     2.3 @@ -49,11 +49,22 @@
     2.4  extern U64MicrosecondsImplicit gFrameTime;
     2.5  
     2.6  LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
     2.7 -S32 LLVOPartGroup::sVBSlotCursor = 0;
     2.8 +// <FS> Fix particle flashing
     2.9 +//S32 LLVOPartGroup::sVBSlotCursor = 0;
    2.10 +S32 LLVOPartGroup::sVBSlotFree[];
    2.11 +S32* LLVOPartGroup::sVBSlotCursor = NULL;
    2.12 +// </FS>
    2.13  
    2.14  void LLVOPartGroup::initClass()
    2.15  {
    2.16 -	
    2.17 +	// <FS> Fix particle flashing
    2.18 +	for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
    2.19 +	{
    2.20 +		sVBSlotFree[i] = i;
    2.21 +	}
    2.22 +
    2.23 +	sVBSlotCursor = sVBSlotFree;
    2.24 +	// </FS>
    2.25  }
    2.26  
    2.27  //static
    2.28 @@ -118,12 +129,21 @@
    2.29  //static
    2.30  S32 LLVOPartGroup::findAvailableVBSlot()
    2.31  {
    2.32 -	if (sVBSlotCursor >= LL_MAX_PARTICLE_COUNT)
    2.33 +	// <FS> Fix particle flashing
    2.34 +	//if (sVBSlotCursor >= LL_MAX_PARTICLE_COUNT)
    2.35 +	if (sVBSlotCursor >= sVBSlotFree + LL_MAX_PARTICLE_COUNT)
    2.36 +	// </FS>
    2.37  	{ //no more available slots
    2.38  		return -1;
    2.39  	}
    2.40  
    2.41 -	return sVBSlotCursor++;
    2.42 +	// <FS> Fix particle flashing
    2.43 +	//return sVBSlotCursor++;
    2.44 +	S32 ret = *sVBSlotCursor;
    2.45 +	sVBSlotCursor++;
    2.46 +
    2.47 +	return ret;
    2.48 +	// </FS>
    2.49  }
    2.50  
    2.51  bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
    2.52 @@ -138,12 +158,27 @@
    2.53  	}*/
    2.54  
    2.55  	//allocated (not in free list)
    2.56 -	return false;
    2.57 +	// <FS> Fix particle flashing
    2.58 +	//return false;
    2.59 +
    2.60 +	while (start < end)
    2.61 +	{
    2.62 +		if (*start == idx)
    2.63 +		{ //not allocated (in free list)
    2.64 +			return false;
    2.65 +		}
    2.66 +		++start;
    2.67 +	}
    2.68 +
    2.69 +	//allocated (not in free list)
    2.70 +	return true;
    2.71 +	// </FS>
    2.72  }
    2.73  
    2.74  //static
    2.75  void LLVOPartGroup::freeVBSlot(S32 idx)
    2.76  {
    2.77 +	// <FS> Fix particle flashing
    2.78  	/*llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
    2.79  	//llassert(sVBSlotCursor > sVBSlotFree);
    2.80  	//llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
    2.81 @@ -153,6 +188,16 @@
    2.82  		sVBSlotCursor--;
    2.83  		*sVBSlotCursor = idx;
    2.84  	}*/
    2.85 +	llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
    2.86 +	//llassert(sVBSlotCursor > sVBSlotFree);
    2.87 +	//llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
    2.88 +
    2.89 +	if (sVBSlotCursor > sVBSlotFree)
    2.90 +	{
    2.91 +		sVBSlotCursor--;
    2.92 +		*sVBSlotCursor = idx;
    2.93 +	}
    2.94 +	// </FS>
    2.95  }
    2.96  
    2.97  LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
    2.98 @@ -864,7 +909,10 @@
    2.99  		LLFace* facep = *i;
   2.100  		LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
   2.101  
   2.102 +		// <FS> Fix particle flashing
   2.103  		//if (!facep->isState(LLFace::PARTICLE))
   2.104 +		if (!facep->isState(LLFace::PARTICLE))
   2.105 +		// </FS>
   2.106  		{ //set the indices of this face
   2.107  			S32 idx = LLVOPartGroup::findAvailableVBSlot();
   2.108  			if (idx >= 0)
   2.109 @@ -873,7 +921,10 @@
   2.110  				facep->setIndicesIndex(idx*6);
   2.111  				facep->setVertexBuffer(LLVOPartGroup::sVB);
   2.112  				facep->setPoolType(LLDrawPool::POOL_ALPHA);
   2.113 +				// <FS> Fix particle flashing
   2.114  				//facep->setState(LLFace::PARTICLE);
   2.115 +				facep->setState(LLFace::PARTICLE);
   2.116 +				// </FS>
   2.117  			}
   2.118  			else
   2.119  			{
     3.1 --- a/indra/newview/llvopartgroup.h	Mon Jan 05 13:02:24 2015 +0100
     3.2 +++ b/indra/newview/llvopartgroup.h	Mon Jan 05 15:14:02 2015 +0100
     3.3 @@ -42,7 +42,11 @@
     3.4  
     3.5  	//vertex buffer for holding all particles
     3.6  	static LLPointer<LLVertexBuffer> sVB;
     3.7 -	static S32 sVBSlotCursor;
     3.8 +	// <FS> Fix particle flashing
     3.9 +	//static S32 sVBSlotCursor;
    3.10 +	static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];
    3.11 +	static S32* sVBSlotCursor;
    3.12 +	// </FS>
    3.13  
    3.14  	static void initClass();
    3.15  	static void restoreGL();

mercurial