diff options
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/llassetuploadresponders.h | 1 | ||||
-rw-r--r-- | linden/indra/newview/lltexlayer.cpp | 57 | ||||
-rw-r--r-- | linden/indra/newview/lltexlayer.h | 4 |
3 files changed, 51 insertions, 11 deletions
diff --git a/linden/indra/newview/llassetuploadresponders.h b/linden/indra/newview/llassetuploadresponders.h index c08f299..9102f6b 100644 --- a/linden/indra/newview/llassetuploadresponders.h +++ b/linden/indra/newview/llassetuploadresponders.h | |||
@@ -74,6 +74,7 @@ public: | |||
74 | class LLBakedUploadData; | 74 | class LLBakedUploadData; |
75 | class LLSendTexLayerResponder : public LLAssetUploadResponder | 75 | class LLSendTexLayerResponder : public LLAssetUploadResponder |
76 | { | 76 | { |
77 | LOG_CLASS(LLSendTexLayerResponder); | ||
77 | public: | 78 | public: |
78 | LLSendTexLayerResponder(const LLSD& post_data, | 79 | LLSendTexLayerResponder(const LLSD& post_data, |
79 | const LLUUID& vfile_id, | 80 | const LLUUID& vfile_id, |
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp index 5175cbb..c8e1298 100644 --- a/linden/indra/newview/lltexlayer.cpp +++ b/linden/indra/newview/lltexlayer.cpp | |||
@@ -61,6 +61,8 @@ | |||
61 | 61 | ||
62 | using namespace LLVOAvatarDefines; | 62 | using namespace LLVOAvatarDefines; |
63 | 63 | ||
64 | const S32 MAX_BAKE_UPLOAD_ATTEMPTS = 4; | ||
65 | |||
64 | // static | 66 | // static |
65 | S32 LLTexLayerSetBuffer::sGLByteCount = 0; | 67 | S32 LLTexLayerSetBuffer::sGLByteCount = 0; |
66 | 68 | ||
@@ -98,6 +100,8 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* owner, S32 width, S32 he | |||
98 | mNeedsUpdate( TRUE ), | 100 | mNeedsUpdate( TRUE ), |
99 | mNeedsUpload( FALSE ), | 101 | mNeedsUpload( FALSE ), |
100 | mUploadPending( FALSE ), // Not used for any logic here, just to sync sending of updates | 102 | mUploadPending( FALSE ), // Not used for any logic here, just to sync sending of updates |
103 | mUploadFailCount( 0 ), | ||
104 | mUploadAfter( 0 ), | ||
101 | mTexLayerSet( owner ) | 105 | mTexLayerSet( owner ) |
102 | { | 106 | { |
103 | LLTexLayerSetBuffer::sGLByteCount += getSize(); | 107 | LLTexLayerSetBuffer::sGLByteCount += getSize(); |
@@ -151,6 +155,18 @@ void LLTexLayerSetBuffer::requestUpload() | |||
151 | { | 155 | { |
152 | mNeedsUpload = TRUE; | 156 | mNeedsUpload = TRUE; |
153 | mUploadPending = TRUE; | 157 | mUploadPending = TRUE; |
158 | mUploadAfter = 0; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | // request an upload to start delay_usec microseconds from now | ||
163 | void LLTexLayerSetBuffer::requestDelayedUpload(U64 delay_usec) | ||
164 | { | ||
165 | if (!mNeedsUpload) | ||
166 | { | ||
167 | mNeedsUpload = TRUE; | ||
168 | mUploadPending = TRUE; | ||
169 | mUploadAfter = LLFrameTimer::getTotalTime() + delay_usec; | ||
154 | } | 170 | } |
155 | } | 171 | } |
156 | 172 | ||
@@ -161,6 +177,14 @@ void LLTexLayerSetBuffer::cancelUpload() | |||
161 | mNeedsUpload = FALSE; | 177 | mNeedsUpload = FALSE; |
162 | } | 178 | } |
163 | mUploadPending = FALSE; | 179 | mUploadPending = FALSE; |
180 | mUploadAfter = 0; | ||
181 | } | ||
182 | |||
183 | // do we need to upload, and do we have sufficient data to create an uploadable composite? | ||
184 | BOOL LLTexLayerSetBuffer::needsUploadNow() const | ||
185 | { | ||
186 | BOOL upload = mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal() && (gAgent.mNumPendingQueries == 0); | ||
187 | return (upload && (LLFrameTimer::getTotalTime() > mUploadAfter)); | ||
164 | } | 188 | } |
165 | 189 | ||
166 | void LLTexLayerSetBuffer::pushProjection() | 190 | void LLTexLayerSetBuffer::pushProjection() |
@@ -187,7 +211,7 @@ void LLTexLayerSetBuffer::popProjection() | |||
187 | BOOL LLTexLayerSetBuffer::needsRender() | 211 | BOOL LLTexLayerSetBuffer::needsRender() |
188 | { | 212 | { |
189 | LLVOAvatar* avatar = mTexLayerSet->getAvatar(); | 213 | LLVOAvatar* avatar = mTexLayerSet->getAvatar(); |
190 | BOOL upload_now = mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal() && gAgent.mNumPendingQueries == 0; | 214 | BOOL upload_now = needsUploadNow(); |
191 | BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; | 215 | BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; |
192 | if (needs_update) | 216 | if (needs_update) |
193 | { | 217 | { |
@@ -229,9 +253,6 @@ BOOL LLTexLayerSetBuffer::render() | |||
229 | // Default color mask for tex layer render | 253 | // Default color mask for tex layer render |
230 | gGL.setColorMask(true, true); | 254 | gGL.setColorMask(true, true); |
231 | 255 | ||
232 | // do we need to upload, and do we have sufficient data to create an uploadable composite? | ||
233 | // When do we upload the texture if gAgent.mNumPendingQueries is non-zero? | ||
234 | BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); | ||
235 | BOOL success = TRUE; | 256 | BOOL success = TRUE; |
236 | 257 | ||
237 | // Composite the color data | 258 | // Composite the color data |
@@ -239,7 +260,7 @@ BOOL LLTexLayerSetBuffer::render() | |||
239 | success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mWidth, mHeight ); | 260 | success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mWidth, mHeight ); |
240 | gGL.flush(); | 261 | gGL.flush(); |
241 | 262 | ||
242 | if( upload_now ) | 263 | if( needsUploadNow() ) |
243 | { | 264 | { |
244 | if (!success) | 265 | if (!success) |
245 | { | 266 | { |
@@ -387,7 +408,8 @@ void LLTexLayerSetBuffer::readBackAndUpload() | |||
387 | std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); | 408 | std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); |
388 | 409 | ||
389 | if(!url.empty() | 410 | if(!url.empty() |
390 | && !LLPipeline::sForceOldBakedUpload) // Toggle the debug setting UploadBakedTexOld to change between the new caps method and old method | 411 | && !LLPipeline::sForceOldBakedUpload // Toggle the debug setting UploadBakedTexOld to change between the new caps method and old method |
412 | && (mUploadFailCount < MAX_BAKE_UPLOAD_ATTEMPTS-1)) // allow last ditch attempt via asset store, since capabilty seems prone to transient failures. | ||
391 | { | 413 | { |
392 | llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; | 414 | llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; |
393 | 415 | ||
@@ -436,12 +458,14 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* user | |||
436 | 458 | ||
437 | LLVOAvatar* avatar = gAgent.getAvatarObject(); | 459 | LLVOAvatar* avatar = gAgent.getAvatarObject(); |
438 | 460 | ||
439 | if (0 == result && | 461 | if (avatar && !avatar->isDead() && |
440 | avatar && !avatar->isDead() && | 462 | baked_upload_data && |
441 | baked_upload_data->mAvatar == avatar && // Sanity check: only the user's avatar should be uploading textures. | 463 | baked_upload_data->mAvatar == avatar && // Sanity check: only the user's avatar should be uploading textures. |
442 | baked_upload_data->mLayerSet->hasComposite()) | 464 | baked_upload_data->mLayerSet->hasComposite()) |
443 | { | 465 | { |
444 | LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mLayerSet->getComposite(); | 466 | LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mLayerSet->getComposite(); |
467 | S32 failures = layerset_buffer->mUploadFailCount; | ||
468 | layerset_buffer->mUploadFailCount = 0; | ||
445 | 469 | ||
446 | if (layerset_buffer->mUploadID.isNull()) | 470 | if (layerset_buffer->mUploadID.isNull()) |
447 | { | 471 | { |
@@ -469,9 +493,20 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* user | |||
469 | } | 493 | } |
470 | else | 494 | else |
471 | { | 495 | { |
472 | // Avatar appearance is changing, ignore the upload results | 496 | ++failures; |
473 | llinfos << "Baked upload failed. Reason: " << result << llendl; | 497 | llinfos << "Baked upload failed (attempt " << failures << "/" << MAX_BAKE_UPLOAD_ATTEMPTS << "), "; |
474 | // *FIX: retry upload after n seconds, asset server could be busy | 498 | if (failures >= MAX_BAKE_UPLOAD_ATTEMPTS) |
499 | { | ||
500 | llcont << "giving up."; | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | const F32 delay = 5.f; | ||
505 | llcont << llformat("retrying in %.2f seconds.", delay); | ||
506 | layerset_buffer->mUploadFailCount = failures; | ||
507 | layerset_buffer->requestDelayedUpload((U64)(delay * 1000000)); | ||
508 | } | ||
509 | llcont << llendl; | ||
475 | } | 510 | } |
476 | } | 511 | } |
477 | else | 512 | else |
diff --git a/linden/indra/newview/lltexlayer.h b/linden/indra/newview/lltexlayer.h index 020ba86..31b175e 100644 --- a/linden/indra/newview/lltexlayer.h +++ b/linden/indra/newview/lltexlayer.h | |||
@@ -218,6 +218,7 @@ public: | |||
218 | BOOL needsRender(); | 218 | BOOL needsRender(); |
219 | void requestUpdate(); | 219 | void requestUpdate(); |
220 | void requestUpload(); | 220 | void requestUpload(); |
221 | void requestDelayedUpload(U64 delay_usec); | ||
221 | void cancelUpload(); | 222 | void cancelUpload(); |
222 | BOOL uploadPending() { return mUploadPending; } | 223 | BOOL uploadPending() { return mUploadPending; } |
223 | BOOL render( S32 x, S32 y, S32 width, S32 height ); | 224 | BOOL render( S32 x, S32 y, S32 width, S32 height ); |
@@ -234,12 +235,15 @@ public: | |||
234 | private: | 235 | private: |
235 | void pushProjection(); | 236 | void pushProjection(); |
236 | void popProjection(); | 237 | void popProjection(); |
238 | BOOL needsUploadNow() const; | ||
237 | 239 | ||
238 | private: | 240 | private: |
239 | BOOL mNeedsUpdate; | 241 | BOOL mNeedsUpdate; |
240 | BOOL mNeedsUpload; | 242 | BOOL mNeedsUpload; |
241 | BOOL mUploadPending; | 243 | BOOL mUploadPending; |
242 | LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) | 244 | LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) |
245 | S32 mUploadFailCount; | ||
246 | U64 mUploadAfter; // delay upload until after this time (in microseconds) | ||
243 | LLTexLayerSet* mTexLayerSet; | 247 | LLTexLayerSet* mTexLayerSet; |
244 | 248 | ||
245 | static S32 sGLByteCount; | 249 | static S32 sGLByteCount; |