aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexlayer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-05-24 02:59:24 -0500
committerJacek Antonelli2009-05-24 02:59:40 -0500
commitb2627d927f1642bea84b92adfccd9403676e1341 (patch)
tree07f069e63cfa633b9bd0d07b4eecc229ef67f974 /linden/indra/newview/lltexlayer.cpp
parentSecond Life viewer sources 1.23.1-RC (diff)
downloadmeta-impy-b2627d927f1642bea84b92adfccd9403676e1341.zip
meta-impy-b2627d927f1642bea84b92adfccd9403676e1341.tar.gz
meta-impy-b2627d927f1642bea84b92adfccd9403676e1341.tar.bz2
meta-impy-b2627d927f1642bea84b92adfccd9403676e1341.tar.xz
Second Life viewer sources 1.23.2-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lltexlayer.cpp70
1 files changed, 43 insertions, 27 deletions
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp
index eea4acf..b05da8c 100644
--- a/linden/indra/newview/lltexlayer.cpp
+++ b/linden/indra/newview/lltexlayer.cpp
@@ -68,8 +68,12 @@ S32 LLTexLayerSetBuffer::sGLBumpByteCount = 0;
68//----------------------------------------------------------------------------- 68//-----------------------------------------------------------------------------
69// LLBakedUploadData() 69// LLBakedUploadData()
70//----------------------------------------------------------------------------- 70//-----------------------------------------------------------------------------
71LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id ) : 71LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar,
72 LLTexLayerSet* layerset,
73 LLTexLayerSetBuffer* layerset_buffer,
74 const LLUUID & id ) :
72 mAvatar( avatar ), 75 mAvatar( avatar ),
76 mLayerSet( layerset ),
73 mLayerSetBuffer( layerset_buffer ), 77 mLayerSetBuffer( layerset_buffer ),
74 mID(id) 78 mID(id)
75{ 79{
@@ -485,7 +489,8 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data)
485 if( valid ) 489 if( valid )
486 { 490 {
487 // baked_upload_data is owned by the responder and deleted after the request completes 491 // baked_upload_data is owned by the responder and deleted after the request completes
488 LLBakedUploadData* baked_upload_data = new LLBakedUploadData( gAgent.getAvatarObject(), this, asset_id ); 492 LLBakedUploadData* baked_upload_data =
493 new LLBakedUploadData( gAgent.getAvatarObject(), this->mTexLayerSet, this, asset_id );
489 mUploadID = asset_id; 494 mUploadID = asset_id;
490 495
491 // upload the image 496 // upload the image
@@ -547,40 +552,51 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* user
547 // Sanity check: only the user's avatar should be uploading textures. 552 // Sanity check: only the user's avatar should be uploading textures.
548 if( baked_upload_data->mAvatar == avatar ) 553 if( baked_upload_data->mAvatar == avatar )
549 { 554 {
550 // Because the avatar is still valid, it's layerset buffers should be valid also. 555 // Composite may have changed since the pointer was stored - need to do some checking.
551 LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mLayerSetBuffer; 556 LLTexLayerSetBuffer* prev_layerset_buffer = baked_upload_data->mLayerSetBuffer;
552 layerset_buffer->mUploadPending = FALSE; 557 // Can't just call getComposite() because this will trigger creation if none exists.
553 558 LLTexLayerSetBuffer* curr_layerset_buffer =
554 if (layerset_buffer->mUploadID.isNull()) 559 baked_upload_data->mLayerSet->hasComposite()?baked_upload_data->mLayerSet->getComposite():NULL;
560
561 if (prev_layerset_buffer != curr_layerset_buffer)
555 { 562 {
556 // The upload got canceled, we should be in the process of baking a new texture 563 llinfos << "Baked texture out of date, composite no longer valid, ignored" << llendl;
557 // so request an upload with the new data
558 layerset_buffer->requestUpload();
559 } 564 }
560 else if( baked_upload_data->mID == layerset_buffer->mUploadID ) 565 else
561 { 566 {
562 // This is the upload we're currently waiting for. 567 curr_layerset_buffer->mUploadPending = FALSE;
563 layerset_buffer->mUploadID.setNull(); 568
564 569 if (curr_layerset_buffer->mUploadID.isNull())
565 if( result >= 0 ) 570 {
571 // The upload got canceled, we should be in the process of baking a new texture
572 // so request an upload with the new data
573 curr_layerset_buffer->requestUpload();
574 }
575 else if( baked_upload_data->mID == curr_layerset_buffer->mUploadID )
566 { 576 {
567 ETextureIndex baked_te = avatar->getBakedTE( layerset_buffer->mTexLayerSet ); 577 // This is the upload we're currently waiting for.
568 U64 now = LLFrameTimer::getTotalTime(); // Record starting time 578 curr_layerset_buffer->mUploadID.setNull();
569 llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; 579
570 avatar->setNewBakedTexture( baked_te, uuid ); 580 if( result >= 0 )
581 {
582 ETextureIndex baked_te = avatar->getBakedTE( curr_layerset_buffer->mTexLayerSet );
583 U64 now = LLFrameTimer::getTotalTime(); // Record starting time
584 llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl;
585 avatar->setNewBakedTexture( baked_te, uuid );
586 }
587 else
588 {
589 llinfos << "Baked upload failed. Reason: " << result << llendl;
590 // *FIX: retry upload after n seconds, asset server could be busy
591 }
571 } 592 }
572 else 593 else
573 { 594 {
574 llinfos << "Baked upload failed. Reason: " << result << llendl; 595 llinfos << "Received baked texture out of date, ignored." << llendl;
575 // *FIX: retry upload after n seconds, asset server could be busy
576 } 596 }
577 }
578 else
579 {
580 llinfos << "Received baked texture out of date, ignored." << llendl;
581 }
582 597
583 avatar->dirtyMesh(); 598 avatar->dirtyMesh();
599 }
584 } 600 }
585 } 601 }
586 else 602 else