aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimage.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimage.h130
1 files changed, 102 insertions, 28 deletions
diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h
index 980ff56..fdf8ff0 100644
--- a/linden/indra/newview/llviewerimage.h
+++ b/linden/indra/newview/llviewerimage.h
@@ -41,6 +41,7 @@
41#include <map> 41#include <map>
42#include <list> 42#include <list>
43 43
44class LLFace;
44#define MIN_VIDEO_RAM_IN_MEGA_BYTES 32 45#define MIN_VIDEO_RAM_IN_MEGA_BYTES 32
45#define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons. 46#define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons.
46 47
@@ -75,6 +76,43 @@ public:
75 76
76class LLTextureBar; 77class LLTextureBar;
77 78
79//=====================================
80struct LLViewerImageBoostLevel
81{
82 enum
83 {
84 BOOST_NONE = 0,
85 BOOST_AVATAR_BAKED = 1,
86 BOOST_AVATAR = 2,
87 BOOST_CLOUDS = 3,
88 BOOST_SCULPTED = 4,
89
90 BOOST_HIGH = 5,
91 BOOST_TERRAIN , // has to be high priority for minimap / low detail
92 BOOST_SELECTED ,
93 BOOST_HUD ,
94 BOOST_AVATAR_BAKED_SELF ,
95 BOOST_UI ,
96 BOOST_PREVIEW ,
97 BOOST_MAP ,
98 BOOST_MAP_VISIBLE ,
99 BOOST_AVATAR_SELF ,// needed for baking avatar
100 BOOST_MAX_LEVEL,
101
102 //LLImageGLCategory
103 TEXLAYER_BUMP = BOOST_MAX_LEVEL,
104 AVATAR_SCRATCH_TEX,
105 FONT,
106 BUMP_IMAGE,
107 DYNAMIC_TEX,
108 TEXLAYER_CACHE,
109 MEDIA,
110 ATLAS,
111 OTHER,
112 MAX_GL_IMAGE_CATEGORY
113 };
114};
115//=====================================
78class LLViewerImage : public LLImageGL 116class LLViewerImage : public LLImageGL
79{ 117{
80 LOG_CLASS(LLViewerImage); 118 LOG_CLASS(LLViewerImage);
@@ -175,15 +213,15 @@ protected:
175 /*virtual*/ ~LLViewerImage(); 213 /*virtual*/ ~LLViewerImage();
176 214
177public: 215public:
178 LLViewerImage(const std::string& filename, const LLUUID& id, BOOL usemipmaps = TRUE); 216 LLViewerImage(const std::string& url, const LLUUID& id, BOOL usemipmaps = TRUE);
179 LLViewerImage(const LLUUID& id, BOOL usemipmaps = TRUE); 217 LLViewerImage(const LLUUID& id, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
180 LLViewerImage(const U32 width, const U32 height, const U8 components, BOOL usemipmaps); 218 LLViewerImage(const U32 width, const U32 height, const U8 components, BOOL usemipmaps);
181 LLViewerImage(const LLImageRaw* raw, BOOL usemipmaps); 219 LLViewerImage(const LLImageRaw* raw, BOOL usemipmaps);
182 220
183 /*virtual*/ void dump(); // debug info to llinfos 221 /*virtual*/ void dump(); // debug info to llinfos
184 222
185 /*virtual*/ bool bindError(const S32 stage = 0) const; 223 /*virtual*/ bool bindError(const S32 stage = 0) const;
186 /*virtual*/ bool bindDefaultImage(const S32 stage = 0) const; 224 /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
187 /*virtual*/ void forceImmediateUpdate() ; 225 /*virtual*/ void forceImmediateUpdate() ;
188 226
189 void reinit(BOOL usemipmaps = TRUE); 227 void reinit(BOOL usemipmaps = TRUE);
@@ -192,8 +230,13 @@ public:
192 230
193 // New methods for determining image quality/priority 231 // New methods for determining image quality/priority
194 // texel_area_ratio is ("scaled" texel area)/(original texel area), approximately. 232 // texel_area_ratio is ("scaled" texel area)/(original texel area), approximately.
195 void addTextureStats(F32 virtual_size) const; 233 void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
196 void resetTextureStats(BOOL zero = FALSE); 234 void resetTextureStats();
235 void setAdditionalDecodePriority(F32 priority) ;
236 F32 maxAdditionalDecodePriority() ;
237
238 BOOL isLargeImage() ;
239 BOOL isUpdateFrozen() ;
197 240
198 // Process image stats to determine priority/quality requirements. 241 // Process image stats to determine priority/quality requirements.
199 void processTextureStats(); 242 void processTextureStats();
@@ -207,6 +250,7 @@ public:
207 // ONLY call from LLViewerImageList 250 // ONLY call from LLViewerImageList
208 BOOL createTexture(S32 usename = 0); 251 BOOL createTexture(S32 usename = 0);
209 void destroyTexture() ; 252 void destroyTexture() ;
253 void addToCreateTexture();
210 254
211 BOOL needsAux() const { return mNeedsAux; } 255 BOOL needsAux() const { return mNeedsAux; }
212 256
@@ -217,32 +261,12 @@ public:
217 void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); } 261 void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); }
218 262
219 // Host we think might have this image, used for baked av textures. 263 // Host we think might have this image, used for baked av textures.
220 void setTargetHost(LLHost host) { mTargetHost = host; }
221 LLHost getTargetHost() const { return mTargetHost; } 264 LLHost getTargetHost() const { return mTargetHost; }
222 265
223 enum
224 {
225 BOOST_NONE = 0,
226 BOOST_AVATAR_BAKED = 1,
227 BOOST_AVATAR = 2,
228 BOOST_CLOUDS = 3,
229 BOOST_SCULPTED = 4,
230
231 BOOST_HIGH = 10,
232 BOOST_TERRAIN = 11, // has to be high priority for minimap / low detail
233 BOOST_SELECTED = 12,
234 BOOST_HUD = 13,
235 BOOST_AVATAR_BAKED_SELF = 14,
236 BOOST_UI = 15,
237 BOOST_PREVIEW = 16,
238 BOOST_MAP = 17,
239 BOOST_MAP_LAYER = 18,
240 BOOST_AVATAR_SELF = 19, // needed for baking avatar
241 BOOST_MAX_LEVEL
242 };
243 void setBoostLevel(S32 level); 266 void setBoostLevel(S32 level);
244 S32 getBoostLevel() { return mBoostLevel; } 267 S32 getBoostLevel() { return mBoostLevel; }
245 268
269 void updateVirtualSize() ;
246 F32 getDecodePriority() const { return mDecodePriority; }; 270 F32 getDecodePriority() const { return mDecodePriority; };
247 F32 calcDecodePriority(); 271 F32 calcDecodePriority();
248 static F32 maxDecodePriority(); 272 static F32 maxDecodePriority();
@@ -271,6 +295,24 @@ public:
271 S32 getOriginalWidth() { return mOrigWidth; } 295 S32 getOriginalWidth() { return mOrigWidth; }
272 S32 getOriginalHeight() { return mOrigHeight; } 296 S32 getOriginalHeight() { return mOrigHeight; }
273 297
298 BOOL isForSculptOnly() const ;
299 void setForSculpt();
300
301 void checkCachedRawSculptImage() ;
302 LLImageRaw* getRawImage()const { return mRawImage ;}
303 S32 getRawImageLevel() const {return mRawDiscardLevel;}
304 LLImageRaw* getCachedRawImage() const { return mCachedRawImage ;}
305 S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;}
306 BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;}
307 BOOL isRawImageValid()const { return mIsRawImageValid ; }
308
309 void forceToSaveRawImage(S32 desired_discard = 0) ;
310 void destroySavedRawImage() ;
311
312 BOOL isSameTexture(const LLViewerImage* tex) const ;
313
314 void addFace(LLFace* facep) ;
315 void removeFace(LLFace* facep) ;
274private: 316private:
275 /*virtual*/ void cleanup(); // Cleanup the LLViewerImage (so we can reinitialize it) 317 /*virtual*/ void cleanup(); // Cleanup the LLViewerImage (so we can reinitialize it)
276 318
@@ -279,14 +321,19 @@ private:
279 // Used to be in LLImageGL 321 // Used to be in LLImageGL
280 LLImageRaw* readBackRawImage(S8 discard_level = 0); 322 LLImageRaw* readBackRawImage(S8 discard_level = 0);
281 void destroyRawImage(); 323 void destroyRawImage();
282 324 void saveRawImage() ;
325 BOOL forceFetch() ;
326
327 void scaleDown() ;
328 void switchToCachedImage();
329 void setCachedRawImage() ;
283public: 330public:
284 S32 mFullWidth; 331 S32 mFullWidth;
285 S32 mFullHeight; 332 S32 mFullHeight;
286 333
287 S32 mOrigWidth; 334 S32 mOrigWidth;
288 S32 mOrigHeight; 335 S32 mOrigHeight;
289 std::string mLocalFileName; 336 std::string mUrl;
290 337
291 // Data used for calculating required image priority/quality level/decimation 338 // Data used for calculating required image priority/quality level/decimation
292 mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need? 339 mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need?
@@ -318,6 +365,7 @@ private:
318 S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space 365 S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space
319 S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have 366 S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have
320 S8 mNeedsCreateTexture; 367 S8 mNeedsCreateTexture;
368 mutable S8 mNeedsGLTexture;
321 S8 mNeedsAux; // We need to decode the auxiliary channels 369 S8 mNeedsAux; // We need to decode the auxiliary channels
322 S8 mDecodingAux; // Are we decoding high components 370 S8 mDecodingAux; // Are we decoding high components
323 S8 mIsRawImageValid; 371 S8 mIsRawImageValid;
@@ -332,6 +380,7 @@ private:
332 S32 mKnownDrawHeight; 380 S32 mKnownDrawHeight;
333 381
334 F32 mDecodePriority; // The priority for decoding this image. 382 F32 mDecodePriority; // The priority for decoding this image.
383 mutable F32 mAdditionalDecodePriority; // priority add to mDecodePriority.
335 S32 mBoostLevel; // enum describing priority level 384 S32 mBoostLevel; // enum describing priority level
336 385
337 typedef std::list<LLLoadedCallbackEntry*> callback_list_t; 386 typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
@@ -342,12 +391,30 @@ private:
342 S32 mMinDiscardLevel; 391 S32 mMinDiscardLevel;
343 F32 mCalculatedDiscardLevel; // Last calculated discard level 392 F32 mCalculatedDiscardLevel; // Last calculated discard level
344 393
394 //keep a copy of mRawImage for some special purposes
395 //when mForceToSaveRawImage is set.
396 BOOL mForceToSaveRawImage ;
397 LLPointer<LLImageRaw> mSavedRawImage;
398 S32 mSavedRawDiscardLevel;
399 S32 mDesiredSavedRawDiscardLevel;
400
345 // Used ONLY for cloth meshes right now. Make SURE you know what you're 401 // Used ONLY for cloth meshes right now. Make SURE you know what you're
346 // doing if you use it for anything else! - djs 402 // doing if you use it for anything else! - djs
347 LLPointer<LLImageRaw> mAuxRawImage; 403 LLPointer<LLImageRaw> mAuxRawImage;
348 404
405 //a small version of the copy of the raw image (<= 64 * 64)
406 LLPointer<LLImageRaw> mCachedRawImage;
407 S32 mCachedRawDiscardLevel;
408 BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit.
409
349 LLHost mTargetHost; // if LLHost::invalid, just request from agent's simulator 410 LLHost mTargetHost; // if LLHost::invalid, just request from agent's simulator
350 411
412 BOOL mForSculpt ; //a flag if the texture is used for a sculpt data.
413 mutable BOOL mNeedsResetMaxVirtualSize ;
414
415 typedef std::list<LLFace*> ll_face_list_t ;
416 ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture
417
351public: 418public:
352 static const U32 sCurrentFileVersion; 419 static const U32 sCurrentFileVersion;
353 // Default textures 420 // Default textures
@@ -361,6 +428,7 @@ public:
361 static S32 sRawCount; 428 static S32 sRawCount;
362 static S32 sAuxCount; 429 static S32 sAuxCount;
363 static LLTimer sEvaluationTimer; 430 static LLTimer sEvaluationTimer;
431 static S8 sCameraMovingDiscardBias;
364 static F32 sDesiredDiscardBias; 432 static F32 sDesiredDiscardBias;
365 static F32 sDesiredDiscardScale; 433 static F32 sDesiredDiscardScale;
366 static S32 sBoundTextureMemoryInBytes; 434 static S32 sBoundTextureMemoryInBytes;
@@ -369,6 +437,12 @@ public:
369 static S32 sMaxTotalTextureMemInMegaBytes; 437 static S32 sMaxTotalTextureMemInMegaBytes;
370 static S32 sMaxDesiredTextureMemInBytes ; 438 static S32 sMaxDesiredTextureMemInBytes ;
371 static BOOL sDontLoadVolumeTextures; 439 static BOOL sDontLoadVolumeTextures;
440
441 static S32 sMaxSculptRez ;
442 static S32 sMinLargeImageSize ;
443 static S32 sMaxSmallImageSize ;
444 static BOOL sFreezeImageScalingDown ;//do not scale down image res if set.
445 static S32 sLLViewerImageCount ;
372}; 446};
373 447
374#endif 448#endif