diff options
Diffstat (limited to 'linden/indra/newview/lltexlayer.cpp')
-rw-r--r-- | linden/indra/newview/lltexlayer.cpp | 57 |
1 files changed, 46 insertions, 11 deletions
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 |