aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llrender/llimagegl.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp
index fd934b9..454a5bb 100644
--- a/linden/indra/llrender/llimagegl.cpp
+++ b/linden/indra/llrender/llimagegl.cpp
@@ -61,6 +61,8 @@ S32 LLImageGL::sCount = 0;
61BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; 61BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
62F32 LLImageGL::sLastFrameTime = 0.f; 62F32 LLImageGL::sLastFrameTime = 0.f;
63 63
64BOOL LLImageGL::sRefCheck = TRUE ;
65
64std::set<LLImageGL*> LLImageGL::sImageList; 66std::set<LLImageGL*> LLImageGL::sImageList;
65 67
66//---------------------------------------------------------------------------- 68//----------------------------------------------------------------------------
@@ -276,7 +278,10 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps)
276 setSize(0, 0, 0); 278 setSize(0, 0, 0);
277 sImageList.insert(this); 279 sImageList.insert(this);
278 sCount++; 280 sCount++;
281
282 sRefCheck = FALSE ;
279 createGLTexture(0, imageraw); 283 createGLTexture(0, imageraw);
284 sRefCheck = TRUE ;
280} 285}
281 286
282LLImageGL::~LLImageGL() 287LLImageGL::~LLImageGL()
@@ -333,17 +338,19 @@ void LLImageGL::cleanup()
333 338
334//---------------------------------------------------------------------------- 339//----------------------------------------------------------------------------
335 340
341//this function is used to check the size of a texture image.
342//so dim should be a positive number
336static bool check_power_of_two(S32 dim) 343static bool check_power_of_two(S32 dim)
337{ 344{
338 while(dim > 1) 345 if(dim < 0)
339 { 346 {
340 if (dim & 1) 347 return false ;
341 {
342 return false;
343 }
344 dim >>= 1;
345 } 348 }
346 return true; 349 if(!dim)//0 is a power-of-two number
350 {
351 return true ;
352 }
353 return !(dim & (dim - 1)) ;
347} 354}
348 355
349//static 356//static
@@ -420,6 +427,8 @@ void LLImageGL::dump()
420 427
421BOOL LLImageGL::bindTextureInternal(const S32 stage) const 428BOOL LLImageGL::bindTextureInternal(const S32 stage) const
422{ 429{
430 llassert_always(!sRefCheck || (getNumRefs() > 0 && getNumRefs() < 100000)) ;
431
423 if (gGLManager.mIsDisabled) 432 if (gGLManager.mIsDisabled)
424 { 433 {
425 llwarns << "Trying to bind a texture while GL is disabled!" << llendl; 434 llwarns << "Trying to bind a texture while GL is disabled!" << llendl;