diff options
author | thickbrick | 2010-10-16 03:16:14 +0200 |
---|---|---|
committer | thickbrick | 2010-10-16 03:16:14 +0200 |
commit | ee23c250612b9b2da34472c47c740746232c6104 (patch) | |
tree | d5e01996f2b2d4d55129bf4b93f509a22f7f8762 | |
parent | Fix the fix - bad logic for failed http requests (diff) | |
download | meta-impy-ee23c250612b9b2da34472c47c740746232c6104.zip meta-impy-ee23c250612b9b2da34472c47c740746232c6104.tar.gz meta-impy-ee23c250612b9b2da34472c47c740746232c6104.tar.bz2 meta-impy-ee23c250612b9b2da34472c47c740746232c6104.tar.xz |
Port of SNOW-802: Use UDP for baked textures.
Port of SNOW-802 from SG1. Originally ported by Robin cornelius from
SG 2.1.
Also added a paramter can_use_http to the LLTextureFetchWorker
constructor, to avoid messing with locks.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lltexturefetch.cpp | 12 | ||||
-rw-r--r-- | linden/indra/newview/lltexturefetch.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/llviewerimage.cpp | 6 | ||||
-rw-r--r-- | linden/indra/newview/llviewerimage.h | 4 | ||||
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 1 |
5 files changed, 17 insertions, 8 deletions
diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index a39e2df..f63deb8 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp | |||
@@ -176,7 +176,7 @@ protected: | |||
176 | LLTextureFetchWorker(LLTextureFetch* fetcher, const LLUUID& id, const LLHost& host, | 176 | LLTextureFetchWorker(LLTextureFetch* fetcher, const LLUUID& id, const LLHost& host, |
177 | F32 priority, S32 discard, S32 size); | 177 | F32 priority, S32 discard, S32 size); |
178 | LLTextureFetchWorker(LLTextureFetch* fetcher, const std::string& url, const LLUUID& id, const LLHost& host, | 178 | LLTextureFetchWorker(LLTextureFetch* fetcher, const std::string& url, const LLUUID& id, const LLHost& host, |
179 | F32 priority, S32 discard, S32 size); | 179 | F32 priority, S32 discard, S32 size, bool can_use_http); |
180 | 180 | ||
181 | private: | 181 | private: |
182 | /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD) | 182 | /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD) |
@@ -390,7 +390,8 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, | |||
390 | const LLHost& host, // Simulator host | 390 | const LLHost& host, // Simulator host |
391 | F32 priority, // Priority | 391 | F32 priority, // Priority |
392 | S32 discard, // Desired discard | 392 | S32 discard, // Desired discard |
393 | S32 size) // Desired size | 393 | S32 size, // Desired size |
394 | bool can_use_http) // Try HTTP first | ||
394 | : LLWorkerClass(fetcher, "TextureFetch"), | 395 | : LLWorkerClass(fetcher, "TextureFetch"), |
395 | mState(INIT), | 396 | mState(INIT), |
396 | mWriteToCacheState(NOT_WRITE), | 397 | mWriteToCacheState(NOT_WRITE), |
@@ -422,7 +423,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, | |||
422 | mNeedsAux(FALSE), | 423 | mNeedsAux(FALSE), |
423 | mHaveAllData(FALSE), | 424 | mHaveAllData(FALSE), |
424 | mInLocalCache(FALSE), | 425 | mInLocalCache(FALSE), |
425 | mCanUseHTTP(true), | 426 | mCanUseHTTP(can_use_http), |
426 | mHTTPFailCount(0), | 427 | mHTTPFailCount(0), |
427 | mRetryAttempt(0), | 428 | mRetryAttempt(0), |
428 | mActiveCount(0), | 429 | mActiveCount(0), |
@@ -1556,7 +1557,7 @@ LLTextureFetch::~LLTextureFetch() | |||
1556 | } | 1557 | } |
1557 | 1558 | ||
1558 | bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, | 1559 | bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, |
1559 | S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux) | 1560 | S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http) |
1560 | { | 1561 | { |
1561 | if (mDebugPause) | 1562 | if (mDebugPause) |
1562 | { | 1563 | { |
@@ -1618,6 +1619,7 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con | |||
1618 | worker->lockWorkMutex(); | 1619 | worker->lockWorkMutex(); |
1619 | worker->setImagePriority(priority); | 1620 | worker->setImagePriority(priority); |
1620 | worker->setDesiredDiscard(desired_discard, desired_size); | 1621 | worker->setDesiredDiscard(desired_discard, desired_size); |
1622 | worker->setCanUseHTTP(can_use_http); | ||
1621 | worker->unlockWorkMutex(); | 1623 | worker->unlockWorkMutex(); |
1622 | if (!worker->haveWork()) | 1624 | if (!worker->haveWork()) |
1623 | { | 1625 | { |
@@ -1633,7 +1635,7 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con | |||
1633 | } | 1635 | } |
1634 | else | 1636 | else |
1635 | { | 1637 | { |
1636 | worker = new LLTextureFetchWorker(this, url, id, host, priority, desired_discard, desired_size); | 1638 | worker = new LLTextureFetchWorker(this, url, id, host, priority, desired_discard, desired_size, can_use_http); |
1637 | mRequestMap[id] = worker; | 1639 | mRequestMap[id] = worker; |
1638 | } | 1640 | } |
1639 | worker->mActiveCount++; | 1641 | worker->mActiveCount++; |
diff --git a/linden/indra/newview/lltexturefetch.h b/linden/indra/newview/lltexturefetch.h index 61f76bc..5fa2d1c 100644 --- a/linden/indra/newview/lltexturefetch.h +++ b/linden/indra/newview/lltexturefetch.h | |||
@@ -60,7 +60,7 @@ public: | |||
60 | /*virtual*/ S32 update(U32 max_time_ms); | 60 | /*virtual*/ S32 update(U32 max_time_ms); |
61 | 61 | ||
62 | bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, | 62 | bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, |
63 | S32 w, S32 h, S32 c, S32 discard, bool needs_aux); | 63 | S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool use_http); |
64 | void deleteRequest(const LLUUID& id, bool cancel); | 64 | void deleteRequest(const LLUUID& id, bool cancel); |
65 | bool getRequestFinished(const LLUUID& id, S32& discard_level, | 65 | bool getRequestFinished(const LLUUID& id, S32& discard_level, |
66 | LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux); | 66 | LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux); |
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp index 400fb2f..4f23a05 100644 --- a/linden/indra/newview/llviewerimage.cpp +++ b/linden/indra/newview/llviewerimage.cpp | |||
@@ -346,6 +346,8 @@ void LLViewerImage::init(bool firstinit) | |||
346 | mForceToSaveRawImage = FALSE ; | 346 | mForceToSaveRawImage = FALSE ; |
347 | mSavedRawDiscardLevel = -1 ; | 347 | mSavedRawDiscardLevel = -1 ; |
348 | mDesiredSavedRawDiscardLevel = -1 ; | 348 | mDesiredSavedRawDiscardLevel = -1 ; |
349 | |||
350 | mCanUseHTTP = true; //default on if cap/settings allows us | ||
349 | } | 351 | } |
350 | 352 | ||
351 | // virtual | 353 | // virtual |
@@ -1213,7 +1215,7 @@ bool LLViewerImage::updateFetch() | |||
1213 | // bypass texturefetch directly by pulling from LLTextureCache | 1215 | // bypass texturefetch directly by pulling from LLTextureCache |
1214 | bool fetch_request_created = false; | 1216 | bool fetch_request_created = false; |
1215 | fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), decode_priority, | 1217 | fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), decode_priority, |
1216 | w, h, c, desired_discard, needsAux()); | 1218 | w, h, c, desired_discard, needsAux(), mCanUseHTTP); |
1217 | 1219 | ||
1218 | if (fetch_request_created) | 1220 | if (fetch_request_created) |
1219 | { | 1221 | { |
@@ -1292,7 +1294,7 @@ BOOL LLViewerImage::forceFetch() | |||
1292 | c = getComponents(); | 1294 | c = getComponents(); |
1293 | } | 1295 | } |
1294 | fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), maxDecodePriority(), | 1296 | fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), maxDecodePriority(), |
1295 | w, h, c, desired_discard, needsAux()); | 1297 | w, h, c, desired_discard, needsAux(), mCanUseHTTP); |
1296 | 1298 | ||
1297 | if (fetch_request_created) | 1299 | if (fetch_request_created) |
1298 | { | 1300 | { |
diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h index c82b68b..3bee51c 100644 --- a/linden/indra/newview/llviewerimage.h +++ b/linden/indra/newview/llviewerimage.h | |||
@@ -314,6 +314,8 @@ public: | |||
314 | void addFace(LLFace* facep) ; | 314 | void addFace(LLFace* facep) ; |
315 | void removeFace(LLFace* facep) ; | 315 | void removeFace(LLFace* facep) ; |
316 | 316 | ||
317 | void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}; | ||
318 | |||
317 | friend class LocalBitmap; // tag: vaa emerald local_asset_browser | 319 | friend class LocalBitmap; // tag: vaa emerald local_asset_browser |
318 | 320 | ||
319 | private: | 321 | private: |
@@ -418,6 +420,8 @@ private: | |||
418 | typedef std::list<LLFace*> ll_face_list_t ; | 420 | typedef std::list<LLFace*> ll_face_list_t ; |
419 | ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture | 421 | ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture |
420 | 422 | ||
423 | bool mCanUseHTTP; // can this image be fetched by http | ||
424 | |||
421 | public: | 425 | public: |
422 | static const U32 sCurrentFileVersion; | 426 | static const U32 sCurrentFileVersion; |
423 | // Default textures | 427 | // Default textures |
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index d2aa3d8..7bbaf48 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -5196,6 +5196,7 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, | |||
5196 | 5196 | ||
5197 | void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level) | 5197 | void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level) |
5198 | { | 5198 | { |
5199 | imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. | ||
5199 | mMaxPixelArea = llmax(pixel_area, mMaxPixelArea); | 5200 | mMaxPixelArea = llmax(pixel_area, mMaxPixelArea); |
5200 | mMinPixelArea = llmin(pixel_area, mMinPixelArea); | 5201 | mMinPixelArea = llmin(pixel_area, mMinPixelArea); |
5201 | imagep->addTextureStats(pixel_area / texel_area_ratio); | 5202 | imagep->addTextureStats(pixel_area / texel_area_ratio); |