aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lldrawpoolbump.cpp
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/newview/lldrawpoolbump.cpp
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 '')
-rw-r--r--linden/indra/newview/lldrawpoolbump.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp
index 303b8d5..c7c19d9 100644
--- a/linden/indra/newview/lldrawpoolbump.cpp
+++ b/linden/indra/newview/lldrawpoolbump.cpp
@@ -607,6 +607,10 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
607 if( tex ) 607 if( tex )
608 { 608 {
609 bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code ); 609 bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
610 //------------------------------------------
611 //error check to make sure bump is valid
612 llassert_always(!bump || bump->getNumRefs() == 1) ;
613 //------------------------------------------
610 } 614 }
611 break; 615 break;
612 616
@@ -621,6 +625,11 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
621 625
622 if (bump) 626 if (bump)
623 { 627 {
628 //------------------------------------------
629 //error check to make sure bump is valid
630 llassert_always(bump->getNumRefs() > 0 && bump->getNumRefs() < 100000) ;
631 //------------------------------------------
632
624 bump->bind(1); 633 bump->bind(1);
625 bump->bind(0); 634 bump->bind(0);
626 return TRUE; 635 return TRUE;
@@ -863,9 +872,15 @@ LLImageGL* LLBumpImageList::getBrightnessDarknessImage(LLViewerImage* src_image,
863 { 872 {
864 LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1); 873 LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
865 raw->clear(0x77, 0x77, 0x77, 0xFF); 874 raw->clear(0x77, 0x77, 0x77, 0xFF);
875
876 //------------------------------
866 bump = new LLImageGL( raw, TRUE); 877 bump = new LLImageGL( raw, TRUE);
867 bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); 878 //immediately assign bump to a global smart pointer in case some local smart pointer
879 //accidently releases it.
868 (*entries_list)[src_image->getID()] = bump; 880 (*entries_list)[src_image->getID()] = bump;
881 //------------------------------
882
883 bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
869 884
870 // Note: this may create an LLImageGL immediately 885 // Note: this may create an LLImageGL immediately
871 src_image->setLoadedCallback( callback_func, 0, TRUE, new LLUUID(src_image->getID()) ); 886 src_image->setLoadedCallback( callback_func, 0, TRUE, new LLUUID(src_image->getID()) );
@@ -1020,10 +1035,15 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma
1020 } 1035 }
1021 } 1036 }
1022 1037
1038 //---------------------------------------------------
1023 LLImageGL* bump = new LLImageGL( TRUE); 1039 LLImageGL* bump = new LLImageGL( TRUE);
1024 bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); 1040 //immediately assign bump to a global smart pointer in case some local smart pointer
1025 bump->createGLTexture(0, dst_image); 1041 //accidently releases it.
1026 iter->second = bump; // derefs (and deletes) old image 1042 iter->second = bump; // derefs (and deletes) old image
1043 //---------------------------------------------------
1044
1045 bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
1046 bump->createGLTexture(0, dst_image);
1027 } 1047 }
1028 else 1048 else
1029 { 1049 {