aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimage.cpp99
1 files changed, 51 insertions, 48 deletions
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp
index 0b70f51..6ad6ca2 100644
--- a/linden/indra/newview/llviewerimage.cpp
+++ b/linden/indra/newview/llviewerimage.cpp
@@ -149,23 +149,13 @@ F32 texmem_middle_bound_scale = 0.925f;
149//static 149//static
150void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity) 150void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity)
151{ 151{
152 sBoundTextureMemory = LLImageGL::sBoundTextureMemory; 152 sBoundTextureMemory = LLImageGL::sBoundTextureMemory;//in bytes
153 sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; 153 sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;//in bytes
154 sMaxBoundTextureMem = gImageList.getMaxResidentTexMem(); 154 sMaxBoundTextureMem = gImageList.getMaxResidentTexMem();//in MB
155 155 sMaxTotalTextureMem = gImageList.getMaxTotalTextureMem() ;//in MB
156 sMaxTotalTextureMem = sMaxBoundTextureMem * 2; 156
157 if (sMaxBoundTextureMem > 64000000) 157 if ((sBoundTextureMemory >> 20) >= sMaxBoundTextureMem ||
158 { 158 (sTotalTextureMemory >> 20) >= sMaxTotalTextureMem)
159 sMaxTotalTextureMem -= sMaxBoundTextureMem/4;
160 }
161
162 if ((U32)sMaxTotalTextureMem > gSysMemory.getPhysicalMemoryClamped() - (U32)min_non_tex_system_mem)
163 {
164 sMaxTotalTextureMem = (S32)gSysMemory.getPhysicalMemoryClamped() - min_non_tex_system_mem;
165 }
166
167 if (sBoundTextureMemory >= sMaxBoundTextureMem ||
168 sTotalTextureMemory >= sMaxTotalTextureMem)
169 { 159 {
170 // If we are using more texture memory than we should, 160 // If we are using more texture memory than we should,
171 // scale up the desired discard level 161 // scale up the desired discard level
@@ -176,8 +166,8 @@ void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity)
176 } 166 }
177 } 167 }
178 else if (sDesiredDiscardBias > 0.0f && 168 else if (sDesiredDiscardBias > 0.0f &&
179 sBoundTextureMemory < sMaxBoundTextureMem*texmem_lower_bound_scale && 169 (sBoundTextureMemory >> 20) < sMaxBoundTextureMem*texmem_lower_bound_scale &&
180 sTotalTextureMemory < sMaxTotalTextureMem*texmem_lower_bound_scale) 170 (sTotalTextureMemory >> 20) < sMaxTotalTextureMem*texmem_lower_bound_scale)
181 { 171 {
182 // If we are using less texture memory than we should, 172 // If we are using less texture memory than we should,
183 // scale down the desired discard level 173 // scale down the desired discard level
@@ -1210,45 +1200,58 @@ void LLViewerImage::setKnownDrawSize(S32 width, S32 height)
1210} 1200}
1211 1201
1212// virtual 1202// virtual
1213BOOL LLViewerImage::bind(S32 stage) const 1203bool LLViewerImage::bindError(S32 stage) const
1214{ 1204{
1215 if (stage == -1) 1205 if (stage < 0) return false;
1206
1207 if (gNoRender)
1216 { 1208 {
1217 return TRUE; 1209 return false;
1218 } 1210 }
1211
1212 bool res = true;
1219 1213
1220 if (gNoRender) 1214 // On failure to bind, what should we set the currently bound texture to?
1215 if (mIsMissingAsset && !sMissingAssetImagep.isNull() && (this != (LLImageGL *)sMissingAssetImagep))
1221 { 1216 {
1222 return true; 1217 res = gGL.getTexUnit(stage)->bind(sMissingAssetImagep.get());
1223 } 1218 }
1224 BOOL res = bindTextureInternal(stage); 1219 if (!res && !sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep))
1225 if (res)
1226 { 1220 {
1227 //llassert_always(mIsMissingAsset == FALSE); 1221 // use default if we've got it
1228 1222 res = gGL.getTexUnit(stage)->bind(sDefaultImagep.get());
1229 } 1223 }
1230 else 1224 if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep))
1231 { 1225 {
1232 // On failure to bind, what should we set the currently bound texture to? 1226 res = gGL.getTexUnit(stage)->bind(sNullImagep.get());
1233 if (mIsMissingAsset && !sMissingAssetImagep.isNull() && (this != (LLImageGL *)sMissingAssetImagep)) 1227 }
1234 { 1228 if (!res)
1235 res = sMissingAssetImagep->bind( stage ); 1229 {
1236 } 1230 llwarns << "LLViewerImage::bindError failed." << llendl;
1237 if (!res && !sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep))
1238 {
1239 // use default if we've got it
1240 res = sDefaultImagep->bind(stage);
1241 }
1242 if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep))
1243 {
1244 res = sNullImagep->bind(stage);
1245 }
1246 if (!res)
1247 {
1248 llwarns << "LLViewerImage::bindTexture failed." << llendl;
1249 }
1250 stop_glerror();
1251 } 1231 }
1232 stop_glerror();
1233 return res;
1234}
1235
1236bool LLViewerImage::bindDefaultImage(S32 stage) const
1237{
1238 if (stage < 0) return false;
1239
1240 bool res = true;
1241 if (!sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep))
1242 {
1243 // use default if we've got it
1244 res = gGL.getTexUnit(stage)->bind(sDefaultImagep.get());
1245 }
1246 if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep))
1247 {
1248 res = gGL.getTexUnit(stage)->bind(sNullImagep.get());
1249 }
1250 if (!res)
1251 {
1252 llwarns << "LLViewerImage::bindError failed." << llendl;
1253 }
1254 stop_glerror();
1252 return res; 1255 return res;
1253} 1256}
1254 1257