diff options
Diffstat (limited to 'indra/llrender')
| -rwxr-xr-x[-rw-r--r--] | indra/llrender/llimagegl.cpp | 166 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/llrender/llimagegl.h | 37 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 8 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 3 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 1 | 
5 files changed, 29 insertions, 186 deletions
| diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 78591ddd38..2c13fead97 100644..100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -43,7 +43,6 @@  const F32 MIN_TEXTURE_LIFETIME = 10.f;  //statics -LLGLuint LLImageGL::sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS] = { 0 };  U32 LLImageGL::sUniqueCount				= 0;  U32 LLImageGL::sBindCount				= 0; @@ -65,19 +64,10 @@ std::set<LLImageGL*> LLImageGL::sImageList;  //****************************************************************************************************  //-----------------------  //debug use -BOOL gAuditTexture = FALSE ; -#define MAX_TEXTURE_LOG_SIZE 22 //2048 * 2048 -std::vector<S32> LLImageGL::sTextureLoadedCounter(MAX_TEXTURE_LOG_SIZE + 1) ; -std::vector<S32> LLImageGL::sTextureBoundCounter(MAX_TEXTURE_LOG_SIZE + 1) ; -std::vector<S32> LLImageGL::sTextureCurBoundCounter(MAX_TEXTURE_LOG_SIZE + 1) ;  S32 LLImageGL::sCurTexSizeBar = -1 ;  S32 LLImageGL::sCurTexPickSize = -1 ; -LLPointer<LLImageGL> LLImageGL::sHighlightTexturep = NULL; -S32 LLImageGL::sMaxCatagories = 1 ; +S32 LLImageGL::sMaxCategories = 1 ; -std::vector<S32> LLImageGL::sTextureMemByCategory; -std::vector<S32> LLImageGL::sTextureMemByCategoryBound ; -std::vector<S32> LLImageGL::sTextureCurMemByCategoryBound ;  //------------------------  //****************************************************************************************************  //End for texture auditing use only @@ -175,49 +165,11 @@ BOOL is_little_endian()  //static   void LLImageGL::initClass(S32 num_catagories)   { -	sMaxCatagories = num_catagories ; - -	sTextureMemByCategory.resize(sMaxCatagories); -	sTextureMemByCategoryBound.resize(sMaxCatagories) ; -	sTextureCurMemByCategoryBound.resize(sMaxCatagories) ;  }  //static   void LLImageGL::cleanupClass()   {	 -	sTextureMemByCategory.clear() ; -	sTextureMemByCategoryBound.clear() ; -	sTextureCurMemByCategoryBound.clear() ; -} - -//static  -void LLImageGL::setHighlightTexture(S32 category)  -{ -	const S32 dim = 128; -	sHighlightTexturep = new LLImageGL() ; -	LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3); -	U8* data = image_raw->getData(); -	for (S32 i = 0; i<dim; i++) -	{ -		for (S32 j = 0; j<dim; j++) -		{ -			const S32 border = 2; -			if (i<border || j<border || i>=(dim-border) || j>=(dim-border)) -			{ -				*data++ = 0xff; -				*data++ = 0xff; -				*data++ = 0xff; -			} -			else -			{ -				*data++ = 0xff; -				*data++ = 0xff; -				*data++ = 0x00; -			} -		} -	} -	sHighlightTexturep->createGLTexture(0, image_raw, 0, TRUE, category); -	image_raw = NULL;  }  //static @@ -285,31 +237,11 @@ void LLImageGL::updateStats(F32 current_time)  	sLastFrameTime = current_time;  	sBoundTextureMemoryInBytes = sCurBoundTextureMemory;  	sCurBoundTextureMemory = 0; - -	if(gAuditTexture) -	{ -		for(U32 i = 0 ; i < sTextureCurBoundCounter.size() ; i++) -		{ -			sTextureBoundCounter[i] = sTextureCurBoundCounter[i] ; -			sTextureCurBoundCounter[i] = 0 ; -		} -		for(U32 i = 0 ; i < sTextureCurMemByCategoryBound.size() ; i++) -		{ -			sTextureMemByCategoryBound[i] = sTextureCurMemByCategoryBound[i] ; -			sTextureCurMemByCategoryBound[i] = 0 ; -		} -	}  }  //static  S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category)  { -	if(gAuditTexture && ncomponents > 0 && category > -1) -	{ -		sTextureCurBoundCounter[getTextureCounterIndex(mem / ncomponents)]++ ; -		sTextureCurMemByCategoryBound[category] += mem ; -	} -	  	LLImageGL::sCurBoundTextureMemory += mem ;  	return LLImageGL::sCurBoundTextureMemory;  } @@ -1284,7 +1216,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S  		return TRUE ;  	} -	setCategory(category) ; +	setCategory(category);   	const U8* rawdata = imageraw->getData();  	return createGLTexture(discard_level, rawdata, FALSE, usename);  } @@ -1362,11 +1294,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_  	{  		sGlobalTextureMemoryInBytes -= mTextureMemory; -		if(gAuditTexture) -		{ -			decTextureCounter(mTextureMemory, mComponents, mCategory) ; -		} -  		LLImageGL::deleteTextures(1, &old_name);  		stop_glerror(); @@ -1376,10 +1303,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_  	sGlobalTextureMemoryInBytes += mTextureMemory;  	mTexelsInGLTexture = getWidth() * getHeight() ; -	if(gAuditTexture) -	{ -		incTextureCounter(mTextureMemory, mComponents, mCategory) ; -	}  	// mark this as bound at this point, so we don't throw it out immediately  	mLastBindTime = sLastFrameTime;  	return TRUE; @@ -1536,22 +1459,29 @@ void LLImageGL::destroyGLTexture()  	{  		if(mTextureMemory)  		{ -			if(gAuditTexture) -			{ -				decTextureCounter(mTextureMemory, mComponents, mCategory) ; -			}  			sGlobalTextureMemoryInBytes -= mTextureMemory;  			mTextureMemory = 0;  		}  		LLImageGL::deleteTextures(1, &mTexName);			 -		mTexName = 0;  		mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. +		mTexName = 0;		  		mGLTextureCreated = FALSE ; -	} +	}	  } - +//force to invalidate the gl texture, most likely a sculpty texture +void LLImageGL::forceToInvalidateGLTexture() +{ +	if (mTexName != 0) +	{ +		destroyGLTexture(); +	} +	else +	{ +		mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. +	} +}  //---------------------------------------------------------------------------- @@ -1969,70 +1899,6 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)  	return res;  } -void LLImageGL::setCategory(S32 category)  -{ -#if 0 //turn this off temporarily because it is not in use now. -	if(!gAuditTexture) -	{ -		return ; -	} -	if(mCategory != category) -	{		 -		if(mCategory > -1) -		{ -			sTextureMemByCategory[mCategory] -= mTextureMemory ; -		} -		if(category > -1 && category < sMaxCatagories) -		{ -			sTextureMemByCategory[category] += mTextureMemory ;		 -			mCategory = category; -		} -		else -		{ -			mCategory = -1 ; -		} -	} -#endif -} - -//for debug use  -//val is a "power of two" number -S32 LLImageGL::getTextureCounterIndex(U32 val)  -{ -	//index range is [0, MAX_TEXTURE_LOG_SIZE]. -	if(val < 2) -	{ -		return 0 ; -	} -	else if(val >= (1 << MAX_TEXTURE_LOG_SIZE)) -	{ -		return MAX_TEXTURE_LOG_SIZE ; -	} -	else -	{ -		S32 ret = 0 ; -		while(val >>= 1) -		{ -			++ret; -		} -		return ret ; -	} -} - -//static -void LLImageGL::incTextureCounter(U32 val, S32 ncomponents, S32 category)  -{ -	sTextureLoadedCounter[getTextureCounterIndex(val)]++ ; -	sTextureMemByCategory[category] += (S32)val * ncomponents ; -} - -//static -void LLImageGL::decTextureCounter(U32 val, S32 ncomponents, S32 category)  -{ -	sTextureLoadedCounter[getTextureCounterIndex(val)]-- ; -	sTextureMemByCategory[category] += (S32)val * ncomponents ; -} -  void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size)  {  	sCurTexSizeBar = index ; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 2cfb15b0d9..e515d6b324 100644..100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -102,8 +102,8 @@ public:  	static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels);  	BOOL createGLTexture() ; -	BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE,  -		S32 category = sMaxCatagories - 1); +	BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, +		S32 category = sMaxCategories-1);  	BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0);  	void setImage(const LLImageRaw* imageraw);  	void setImage(const U8* data_in, BOOL data_hasmips = FALSE); @@ -114,6 +114,7 @@ public:  	// Read back a raw image for this discard level, if it exists  	BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const;  	void destroyGLTexture(); +	void forceToInvalidateGLTexture();  	void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);  	void setComponents(S8 ncomponents) { mComponents = ncomponents; } @@ -234,8 +235,6 @@ public:  	static S32 sCount;  	static F32 sLastFrameTime; -	 -	static LLGLuint sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS]; // Currently bound texture ID  	// Global memory statistics  	static S32 sGlobalTextureMemoryInBytes;		// Tracks main memory texmem @@ -257,9 +256,10 @@ public:  public:  	static void initClass(S32 num_catagories) ;  	static void cleanupClass() ; -private: -	static S32 sMaxCatagories ; +private: +	static S32 sMaxCategories; +	  	//the flag to allow to call readBackRaw(...).  	//can be removed if we do not use that function at all.  	static BOOL sAllowReadBackRaw ; @@ -269,39 +269,22 @@ private:  //****************************************************************************************************  private:  	S32 mCategory ; -public:		 -	void setCategory(S32 category) ; -	S32  getCategory()const {return mCategory ;} - +public: +	void setCategory(S32 category) {mCategory = category;} +	S32  getCategory()const {return mCategory;} +	  	//for debug use: show texture size distribution   	//---------------------------------------- -	static LLPointer<LLImageGL> sHighlightTexturep; //default texture to replace normal textures -	static std::vector<S32> sTextureLoadedCounter ; -	static std::vector<S32> sTextureBoundCounter ; -	static std::vector<S32> sTextureCurBoundCounter ;  	static S32 sCurTexSizeBar ;  	static S32 sCurTexPickSize ; -	static void setHighlightTexture(S32 category) ; -	static S32 getTextureCounterIndex(U32 val) ; -	static void incTextureCounter(U32 val, S32 ncomponents, S32 category) ; -	static void decTextureCounter(U32 val, S32 ncomponents, S32 category) ;  	static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ;  	static void resetCurTexSizebar(); -	//---------------------------------------- -	//for debug use: show texture category distribution  -	//----------------------------------------		 -	 -	static std::vector<S32> sTextureMemByCategory; -	static std::vector<S32> sTextureMemByCategoryBound ; -	static std::vector<S32> sTextureCurMemByCategoryBound ; -	//----------------------------------------	  //****************************************************************************************************  //End of definitions for texture auditing use only  //****************************************************************************************************  }; -extern BOOL gAuditTexture;  #endif // LL_LLIMAGEGL_H diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index b0ddacbb05..93bac4c779 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -246,14 +246,6 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)  	}  	//in audit, replace the selected texture by the default one. -	if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0) -	{ -		if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize) -		{ -			gl_tex->updateBindStats(gl_tex->mTextureMemory); -			return bind(LLImageGL::sHighlightTexturep.get()); -		} -	}  	if ((mCurrTexture != gl_tex->getTexName()) || forceBind)  	{  		activate(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 7d384450e6..5a6e6cab3e 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1062,8 +1062,9 @@ void LLShaderMgr::initAttribsAndUniforms()  	mReservedUniforms.push_back("proj_shadow_res");  	mReservedUniforms.push_back("depth_cutoff");  	mReservedUniforms.push_back("norm_cutoff"); +	mReservedUniforms.push_back("shadow_target_width"); -	llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_NORM_CUTOFF+1); +	llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH+1);  	mReservedUniforms.push_back("tc_scale");  	mReservedUniforms.push_back("rcp_screen_res"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index e28bda6de2..f792faa8f0 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -130,6 +130,7 @@ public:  		DEFERRED_PROJ_SHADOW_RES,  		DEFERRED_DEPTH_CUTOFF,  		DEFERRED_NORM_CUTOFF, +		DEFERRED_SHADOW_TARGET_WIDTH,  		FXAA_TC_SCALE,  		FXAA_RCP_SCREEN_RES, | 
