aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:54 -0500
committerJacek Antonelli2008-08-15 23:45:54 -0500
commitd0b03a62fd799317d5da0bd56615739ce3b5b052 (patch)
tree8bc79bbbb52e18294f62810d9fa66ce136f90e2d /linden/indra/llrender
parentSecond Life viewer sources 1.20.8 (diff)
downloadmeta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.zip
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.gz
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.bz2
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.xz
Second Life viewer sources 1.20.9
Diffstat (limited to 'linden/indra/llrender')
-rw-r--r--linden/indra/llrender/llimagegl.cpp23
-rw-r--r--linden/indra/llrender/llimagegl.h3
2 files changed, 19 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;
diff --git a/linden/indra/llrender/llimagegl.h b/linden/indra/llrender/llimagegl.h
index 3f231ee..99a6e49 100644
--- a/linden/indra/llrender/llimagegl.h
+++ b/linden/indra/llrender/llimagegl.h
@@ -207,6 +207,9 @@ public:
207#else 207#else
208 BOOL getMissed() const { return FALSE; }; 208 BOOL getMissed() const { return FALSE; };
209#endif 209#endif
210
211private://paranoia error check
212 static BOOL sRefCheck ;
210}; 213};
211 214
212#endif // LL_LLIMAGEGL_H 215#endif // LL_LLIMAGEGL_H