aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimage.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimage.h132
1 files changed, 42 insertions, 90 deletions
diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h
index e2f44e5..54865ff 100644
--- a/linden/indra/newview/llviewerimage.h
+++ b/linden/indra/newview/llviewerimage.h
@@ -41,7 +41,6 @@ class LLViewerImage;
41typedef void (*loaded_callback_func)( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); 41typedef void (*loaded_callback_func)( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
42 42
43class LLVFile; 43class LLVFile;
44class LLViewerImagePacket;
45class LLMessageSystem; 44class LLMessageSystem;
46 45
47class LLLoadedCallbackEntry 46class LLLoadedCallbackEntry
@@ -70,7 +69,8 @@ class LLTextureBar;
70 69
71class LLViewerImage : public LLImageGL 70class LLViewerImage : public LLImageGL
72{ 71{
73// friend class LLViewerImageList; 72 LOG_CLASS(LLViewerImage);
73
74 friend class LLTextureBar; // debug info only 74 friend class LLTextureBar; // debug info only
75 friend class LLTextureView; // debug info only 75 friend class LLTextureView; // debug info only
76 76
@@ -78,8 +78,6 @@ public:
78 static void initClass(); 78 static void initClass();
79 static void cleanupClass(); 79 static void cleanupClass();
80 static void updateClass(const F32 velocity, const F32 angular_velocity); 80 static void updateClass(const F32 velocity, const F32 angular_velocity);
81 static void receiveImage(LLMessageSystem *msg, void **user_data);
82 static void receiveImagePacket(LLMessageSystem *msg, void **user_data);
83 static BOOL bindTexture(LLImageGL* image, const U32 stage = 0) 81 static BOOL bindTexture(LLImageGL* image, const U32 stage = 0)
84 { 82 {
85 if (image) 83 if (image)
@@ -188,24 +186,6 @@ public:
188 186
189 const LLUUID& getID() { return mID; } 187 const LLUUID& getID() { return mID; }
190 188
191 void setFormattedImage(LLImageFormatted* imagep);
192
193 // Load an image from the static VFS
194 BOOL loadLocalImage(const LLUUID& uuid);
195
196 // Start loading of data from VFS, if any
197 BOOL startVFSLoad();
198 void startImageDecode();
199
200 // Methods for loading and decoding data
201 void setDecodeData(U8 *data, U32 size);
202 void decodeImage(const F32 decode_time = 0.0);
203 bool isDecoding();
204
205 // Poll the VFS to see if the read is complete. Returns TRUE if
206 // the read is complete (and sets mStreamFile to NULL).
207 BOOL loadStreamFile();
208
209 // New methods for determining image quality/priority 189 // New methods for determining image quality/priority
210 // texel_area_ratio is ("scaled" texel area)/(original texel area), approximately. 190 // texel_area_ratio is ("scaled" texel area)/(original texel area), approximately.
211 void addTextureStats(F32 pixel_area, 191 void addTextureStats(F32 pixel_area,
@@ -216,9 +196,6 @@ public:
216 // Process image stats to determine priority/quality requirements. 196 // Process image stats to determine priority/quality requirements.
217 void processTextureStats(); 197 void processTextureStats();
218 198
219 // Checks image data and decodes if ready. Returns true if packets were decoded or are pending
220 BOOL checkPacketData();
221
222 // Set callbacks to get called when the image gets updated with higher 199 // Set callbacks to get called when the image gets updated with higher
223 // resolution versions. 200 // resolution versions.
224 void setLoadedCallback(loaded_callback_func cb, 201 void setLoadedCallback(loaded_callback_func cb,
@@ -226,13 +203,11 @@ public:
226 BOOL keep_imageraw, 203 BOOL keep_imageraw,
227 void* userdata); 204 void* userdata);
228 205
206 // ONLY call from LLViewerImageList
229 BOOL createTexture(S32 usename = 0); 207 BOOL createTexture(S32 usename = 0);
230 BOOL destroyTexture();
231 208
232 BOOL needsAux() const { return mNeedsAux; } 209 BOOL needsAux() const { return mNeedsAux; }
233 void setNeedsAux(const BOOL needs_aux) { mNeedsAux = needs_aux; } 210 void setNeedsAux(const BOOL needs_aux) { mNeedsAux = needs_aux; }
234 BOOL needsDecode() const { return mNeedsDecode; }
235 void setNeedsDecode(const BOOL needs_decode) { mNeedsDecode = needs_decode; }
236 211
237 // setDesiredDiscardLevel is only used by LLViewerImageList 212 // setDesiredDiscardLevel is only used by LLViewerImageList
238 void setDesiredDiscardLevel(S32 discard) { mDesiredDiscardLevel = discard; } 213 void setDesiredDiscardLevel(S32 discard) { mDesiredDiscardLevel = discard; }
@@ -247,20 +222,20 @@ public:
247 enum 222 enum
248 { 223 {
249 BOOST_NONE = 0, 224 BOOST_NONE = 0,
250 BOOST_TERRAIN = 1, 225 BOOST_AVATAR_BAKED = 1,
251 BOOST_AVATAR_BAKED = 2, 226 BOOST_AVATAR = 2,
252 BOOST_AVATAR = 3, 227 BOOST_CLOUDS = 3,
253 BOOST_CLOUDS = 4,
254 228
255 BOOST_HIGH = 10, 229 BOOST_HIGH = 10,
256 BOOST_SELECTED = 11, 230 BOOST_TERRAIN = 11, // has to be high priority for minimap / low detail
257 BOOST_HUD = 12, 231 BOOST_SELECTED = 12,
258 BOOST_AVATAR_BAKED_SELF = 13, 232 BOOST_HUD = 13,
259 BOOST_UI = 14, 233 BOOST_AVATAR_BAKED_SELF = 14,
260 BOOST_PREVIEW = 15, 234 BOOST_UI = 15,
261 BOOST_MAP = 16, 235 BOOST_PREVIEW = 16,
262 BOOST_MAP_LAYER = 17, 236 BOOST_MAP = 17,
263 BOOST_AVATAR_SELF = 18, // needed for baking avatar 237 BOOST_MAP_LAYER = 18,
238 BOOST_AVATAR_SELF = 19, // needed for baking avatar
264 BOOST_MAX_LEVEL 239 BOOST_MAX_LEVEL
265 }; 240 };
266 void setBoostLevel(S32 level); 241 void setBoostLevel(S32 level);
@@ -275,111 +250,88 @@ public:
275 // the priority list, and cause horrible things to happen. 250 // the priority list, and cause horrible things to happen.
276 void setDecodePriority(F32 priority = -1.0f); 251 void setDecodePriority(F32 priority = -1.0f);
277 252
253 bool updateFetch();
254
278 // Override the computation of discard levels if we know the exact output 255 // Override the computation of discard levels if we know the exact output
279 // size of the image. Used for UI textures to not decode, even if we have 256 // size of the image. Used for UI textures to not decode, even if we have
280 // more data. 257 // more data.
281 void setKnownDrawSize(S32 width, S32 height); 258 void setKnownDrawSize(S32 width, S32 height);
282 259
283 void setIsMissingAsset(BOOL b) { mIsMissingAsset = b; } 260 void setIsMissingAsset();
284 BOOL isMissingAsset() { return mIsMissingAsset; } 261 BOOL isMissingAsset() { return mIsMissingAsset; }
285 262
286 BOOL getNeedsCreateTexture() const { return mNeedsCreateTexture; }
287
288 bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; } 263 bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; }
289 264
290 void doLoadedCallbacks(); 265 bool doLoadedCallbacks();
291 S32 getLastPacket() { return mLastPacket; }
292 F32 getDecodeProgress(F32 *data_progress_p = 0);
293 266
294 void abortDecode();
295 void destroyRawImage(); // Delete the raw image for this discard level
296
297private: 267private:
298 /*virtual*/ void cleanup(); // Cleanup the LLViewerImage (so we can reinitialize it) 268 /*virtual*/ void cleanup(); // Cleanup the LLViewerImage (so we can reinitialize it)
299 269
300 void init(bool firstinit); 270 void init(bool firstinit);
301 void hoseStreamFile();
302 void resetPacketData();
303 271
304 // Used to be in LLImageGL 272 // Used to be in LLImageGL
305 LLImageRaw* createRawImage(S8 discard_level = 0, BOOL allocate = FALSE); 273 LLImageRaw* createRawImage(S8 discard_level = 0, BOOL allocate = FALSE);
274 void destroyRawImage();
306 275
307public: 276public:
308 S32 mFullWidth; 277 S32 mFullWidth;
309 S32 mFullHeight; 278 S32 mFullHeight;
310 LLVFile *mStreamFile;
311 279
312 // Data used for calculating required image priority/quality level/decimation 280 // Data used for calculating required image priority/quality level/decimation
313 mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need? 281 mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need?
314 mutable F32 mMaxCosAngle; // The largest cos of the angle between camera X vector and the object 282 mutable F32 mMaxCosAngle; // The largest cos of the angle between camera X vector and the object
315 283
316 F32 mTexelsPerImage; // Texels per image. 284 F32 mTexelsPerImage; // Texels per image.
285 F32 mDiscardVirtualSize; // Virtual size used to calculate desired discard
317 286
318 S8 mInImageList; // TRUE if image is in list (in which case don't reset priority!) 287 S8 mInImageList; // TRUE if image is in list (in which case don't reset priority!)
319 S8 mIsMediaTexture; // TRUE if image is being replaced by media (in which case don't update) 288 S8 mIsMediaTexture; // TRUE if image is being replaced by media (in which case don't update)
320 S8 mInStaticVFS; // Source data in local VFS
321 S8 mFormattedFlushed;
322 289
323 S8 mRequested; // An image request is currently in process.
324 S8 mFullyLoaded;
325
326 // Various info regarding image requests 290 // Various info regarding image requests
327 LLFrameTimer mRequestTime;
328 S32 mRequestedDiscardLevel; 291 S32 mRequestedDiscardLevel;
329 F32 mRequestedDownloadPriority; 292 F32 mRequestedDownloadPriority;
293 S32 mFetchState;
294 U32 mFetchPriority;
295 F32 mDownloadProgress;
296 F32 mFetchDeltaTime;
297 F32 mRequestDeltaTime;
298 S32 mDecodeFrame;
299 S32 mVisibleFrame; // decode frame where image was last visible
330 300
331 // Timers 301 // Timers
332 LLFrameTimer mLastDecodeTime; // Time since last decode.
333 LLFrameTimer mLastPacketTimer; // Time since last packet. 302 LLFrameTimer mLastPacketTimer; // Time since last packet.
334 LLFrameTimer mLastReferencedTimer; 303 LLFrameTimer mLastReferencedTimer;
335 304
336private: 305private:
337 LLUUID mID; 306 LLUUID mID;
338 LLPointer<LLImageFormatted> mFormattedImagep;
339 307
340 S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space 308 S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space
341 S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have 309 S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have
342 S8 mGotFirstPacket; 310 S8 mNeedsCreateTexture;
343 S8 mNeedsCreateTexture;
344
345 S8 mNeedsDecode; // We have a compressed image that we want to decode, now.
346 S8 mNeedsAux; // We need to decode the auxiliary channels 311 S8 mNeedsAux; // We need to decode the auxiliary channels
347
348 S8 mDecodingAux; // Are we decoding high components 312 S8 mDecodingAux; // Are we decoding high components
349 mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database.
350
351 // Codec of incoming packet data
352 U8 mDataCodec;
353 S8 mIsRawImageValid; 313 S8 mIsRawImageValid;
314 S8 mHasFetcher; // We've made a fecth request
315 S8 mIsFetching; // Fetch request is active
316 S8 mFullyLoaded;
317 mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database.
354 318
355 typedef std::map<U16, LLViewerImagePacket *> vip_map_t;
356 vip_map_t mReceivedPacketMap;
357 S32 mLastPacketProcessed;
358 U32 mLastBytesProcessed; // Total bytes including the last packet rec'd
359
360 // Data download/decode info
361 U32 mPacketsReceived;
362 U32 mTotalBytes;
363 S32 mLastPacket; // Last packet received without a gap.
364 U16 mPackets;
365
366 // VFS info
367 U8 *mCachedData;
368 S32 mCachedSize;
369
370 // Override the computation of discard levels if we know the exact output size of the image. 319 // Override the computation of discard levels if we know the exact output size of the image.
371 // Used for UI textures to not decode, even if we have more data. 320 // Used for UI textures to not decode, even if we have more data.
372 S32 mKnownDrawWidth; 321 S32 mKnownDrawWidth;
373 S32 mKnownDrawHeight; 322 S32 mKnownDrawHeight;
374 323
375 F32 mDecodePriority; // The priority for decoding this image. 324 F32 mDecodePriority; // The priority for decoding this image.
376 S32 mBoostLevel; // enum describing priority level 325 S32 mBoostLevel; // enum describing priority level
377 326
378 typedef std::list<LLLoadedCallbackEntry*> callback_list_t; 327 typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
379 callback_list_t mLoadedCallbackList; 328 callback_list_t mLoadedCallbackList;
380 329
381 LLPointer<LLImageRaw> mRawImage; 330 LLPointer<LLImageRaw> mRawImage;
382 S32 mRawDiscardLevel; 331 S32 mRawDiscardLevel;
332 S32 mMinDiscardLevel;
333 F32 mCalculatedDiscardLevel; // Last calculated discard level
334
383 // Used ONLY for cloth meshes right now. Make SURE you know what you're 335 // Used ONLY for cloth meshes right now. Make SURE you know what you're
384 // doing if you use it for anything else! - djs 336 // doing if you use it for anything else! - djs
385 LLPointer<LLImageRaw> mAuxRawImage; 337 LLPointer<LLImageRaw> mAuxRawImage;